Click here to Skip to main content
15,894,955 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: MVC Pattern question Pin
Quake2Player16-Jun-09 12:16
Quake2Player16-Jun-09 12:16 
GeneralRe: MVC Pattern question Pin
led mike17-Jun-09 4:50
led mike17-Jun-09 4:50 
AnswerRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 7:50
Leslie Sanford18-Jun-09 7:50 
GeneralRe: MVC Pattern question Pin
Quake2Player18-Jun-09 8:17
Quake2Player18-Jun-09 8:17 
GeneralRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 8:21
Leslie Sanford18-Jun-09 8:21 
GeneralRe: MVC Pattern question Pin
Quake2Player18-Jun-09 8:30
Quake2Player18-Jun-09 8:30 
GeneralRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 8:59
Leslie Sanford18-Jun-09 8:59 
AnswerRe: MVC Pattern question Pin
CodingYoshi7-Jul-09 17:28
CodingYoshi7-Jul-09 17:28 
For a few reasons:

1. Separation of Concerns (SOC): The model should be what the name states--just a model. It should not have other logic. Any logic which is outside the domain model of the "model" and is used for controlling should go in the controller.
2. A pattern is to build vocabulary amongst developers. You do not have to implement it this way. And if you don't, then you are no longer using MVC so you can not tell other developers, "I used MVC pattern here but I decided to throw out the controller."
3. There are many occasions wherein designers have decided to put the controller logic within the model, for example, many .NET classes do databinding this way. DataTable sends an event when data is changed, and the DataGridView handles the event.

Your question below about option a and b, I would go with option b and pass the object over. But instead of asking the object for its state using properties, I would do the following:

Lets say I have Employee class

public class Employee
{
public string Name
{get;}
public string LastName
{get;}
public string FullName
{get;}
public int Age
{get;}
// I will have one method as below which will return the state in a structure in one shot
public EmployeeProperties GetState()
{
EmployeeProperties props = new EmployeeProperties();
props.Name = this.Name;
props.LastName = this.LastName;
props.Age = this.Age;

return props;
}
}

public struct EmployeeProperties
{
// The fields for the struct
}


There is no right and wrong way. It is like art, you might have a more elegant solution than anyone has ever had.

CodingYoshi

Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07

GeneralRe: MVC Pattern question Pin
Quake2Player7-Jul-09 17:37
Quake2Player7-Jul-09 17:37 
QuestionClient Server Protocol Definition - Best Practices Pin
Member 404718314-Jun-09 17:16
Member 404718314-Jun-09 17:16 
AnswerRe: Client Server Protocol Definition - Best Practices Pin
Jimmanuel15-Jun-09 0:40
Jimmanuel15-Jun-09 0:40 
AnswerRe: Client Server Protocol Definition - Best Practices Pin
led mike15-Jun-09 4:28
led mike15-Jun-09 4:28 
QuestionI have a couple of design issues Pin
Mycroft Holmes13-Jun-09 15:54
professionalMycroft Holmes13-Jun-09 15:54 
AnswerRe: I have a couple of design issues Pin
CodingYoshi11-Jul-09 9:24
CodingYoshi11-Jul-09 9:24 
GeneralRe: I have a couple of design issues Pin
Mycroft Holmes11-Jul-09 14:56
professionalMycroft Holmes11-Jul-09 14:56 
GeneralRe: I have a couple of design issues Pin
CodingYoshi13-Jul-09 3:35
CodingYoshi13-Jul-09 3:35 
GeneralRe: I have a couple of design issues Pin
Mycroft Holmes13-Jul-09 14:37
professionalMycroft Holmes13-Jul-09 14:37 
QuestionGod object problem Pin
Quake2Player9-Jun-09 13:50
Quake2Player9-Jun-09 13:50 
AnswerRe: God object problem Pin
Mycroft Holmes9-Jun-09 14:50
professionalMycroft Holmes9-Jun-09 14:50 
GeneralRe: God object problem Pin
Quake2Player9-Jun-09 14:58
Quake2Player9-Jun-09 14:58 
GeneralRe: God object problem Pin
Mycroft Holmes9-Jun-09 15:53
professionalMycroft Holmes9-Jun-09 15:53 
AnswerRe: God object problem Pin
CodingYoshi13-Jul-09 3:40
CodingYoshi13-Jul-09 3:40 
QuestionRS232 protocol Pin
AlecJames4-Jun-09 23:04
AlecJames4-Jun-09 23:04 
AnswerRe: RS232 protocol Pin
led mike5-Jun-09 4:21
led mike5-Jun-09 4:21 
AnswerRe: RS232 protocol Pin
Luc Pattyn9-Jun-09 5:38
sitebuilderLuc Pattyn9-Jun-09 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.