• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MVC paradigm question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MVC paradigm question


  • Subject: Re: MVC paradigm question
  • From: Joakim Danielson <email@hidden>
  • Date: Tue, 25 May 2004 00:49:50 +0200

On 2004-05-23, at 19.51, Frederick C. Lee wrote:

I understand that the 'model' of MVC is designed to be independent of the view and the 'controller' of MVC binds the View with the Model.
My question about the model:

1) Does (should) the model incorporate the data source as well?

If you have a simple datasource you could incorporate it but the general answer is no. It's better to let a control handle it or in a more advanced application there is a four layer approach with MVC and a forth persistence layer handling the storing and loading of data (and transformation between data and model objects). In both cases (control or four layer) you have the advantage of being able to replace your persistence choice with another without having to change the model classes, say moving from a filed based solution to a database solution.

It's generally better to divide different responsibilities between different classes.

Joakim

2) Should the model be concerned with transforming the data-source format into a different format to feed another object?
3) Or should a controller handle/transform the data from the data source, whilst the model remains passive?

That is, should a model only represent the data but not actually handle/extract its data?

I can see a blurry line between a controller and a model.

The scenario: a) multiple data sources that eventually combine into one output; and b) a single view.
One data source (raw data) feeds into a product object that is loaded into an object dictionary for storage. The user could reset the finished output with the original raw data.

The multiple data source is actually: a) raw stock and b) finished object (dictionary), {fed from the raw stock + user input} written to disk.

-----

From what I've read, the model could be considered as the 'noun'; and the controller as the 'verb'.
In which case, most of the work (getting & transforming the data) is done in the controller; whereas the model simply represents the data and hence, much simpler than the controller.

I'm tending toward the design of having a 'raw' controller that gets, transforms & feeds the 'raw' model; the 'main' controller takes the raw model/object and incorporates it into a product object; and writes the product object (NSCoder compliant) to disk.

BTW: The 'raw' controller is actually a category of the main controller.

4) Is this the correct approach?

Thanks in advance.
Regards,

Ric.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >MVC paradigm question (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: Not reliable trackingRect (move the mouse quickly)
  • Next by Date: [ANN] Searchable Cocoa-Dev Web Archive (again)
  • Previous by thread: Re: MVC paradigm question
  • Next by thread: Re: MVC paradigm question
  • Index(es):
    • Date
    • Thread