Breaking MVC separation?

2001-06-19 Thread dhay



I have a small architectural question...

I have a LoggingForm bean for displaying the logging parameters on our own
server.  This contains several variables - boolean whether logging enabled,
String current severity, Vector of possible severities, along with Vector of
categories, each of which is a Parameter object holding key, value, description.

I have a server bean which encapsulates all calls to the Server, and all of the
above variables are obtained from one call to the server which returns a list
containing the above in a specified order.  My question is whether it is okay to
pass the LoggingForm to the server bean and have it fill all the variables at
once, or is this breaking the MVC separation?  Should I, instead, call the
server bean each time, to get/set each of the variables?

I know all this gets a little fuzzy at times, but would appreciate any input.

Thanks,

Dave






Re: Breaking MVC separation?

2001-06-19 Thread Mike Thompson

Everyone is saying use value objects.  So you have your ServerBean return a
java class that just implements java.io.Serializable which is passed back to
your client.  Client does what it wishes to this value object, which is
where all the get/set methods are.  You can do validation here if you
please.  Then when you are ready to update, just pass the value object back
and tada, you have all your parameters set in one foul swoop.  So I
typically have something like

public class ServerObject (this is your EJB)
{
public ServerModel getDetails() throws java.rmi.RemoteException
{
...
}

public void update(ServerModel model)
throws java.rmi.RemoteException,
SomeAppExceptionForInvalidStateIfYouLike
{
...
}
}

public class ServerModel implements java.io.Serializable
{
public String getProperty1() {}
public void setProperty1(String prop) {}
public int getProperty1() {}
public void setProperty1(int prop) {}
}

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 19, 2001 1:15 PM
Subject: Breaking MVC separation?




 I have a small architectural question...

 I have a LoggingForm bean for displaying the logging parameters on our own
 server.  This contains several variables - boolean whether logging
enabled,
 String current severity, Vector of possible severities, along with Vector
of
 categories, each of which is a Parameter object holding key, value,
description.

 I have a server bean which encapsulates all calls to the Server, and all
of the
 above variables are obtained from one call to the server which returns a
list
 containing the above in a specified order.  My question is whether it is
okay to
 pass the LoggingForm to the server bean and have it fill all the variables
at
 once, or is this breaking the MVC separation?  Should I, instead, call the
 server bean each time, to get/set each of the variables?

 I know all this gets a little fuzzy at times, but would appreciate any
input.

 Thanks,

 Dave