MVC Paradigm
MVC Paradigm
- Subject: MVC Paradigm
- From: James Stroud <email@hidden>
- Date: Sat, 25 Sep 2004 15:20:56 -0700
Hello All Experts,
I am trying to wrap my mind around MVC in terms of the functionality of
each component M,V, and C. I am making a simple program to manage a
simple database. I'm sure there are database programs already written,
but I am doing this more or less as a learning exercise. Please don't
be concerned with the precise implementation, I am mostly concerned
about design...
Does the following sound right? Am I using good design here with
respect to MVC? How should I change this?
Thank you in advance for your advice.
(A) Model: The top level of the model will be a class that consists of
(1) Data - essentially an array of Records
(2) Methods that
(a) add(), (b) delete(), (c) return(), (d) set(), and (e) sort() the
records
(B) View: A bunch of buttons and text fields that display data and send
command requests to the Controller. I only have one view right now to
make things simple. Such commands include
(1) Add record
(2) Remove record
(3) Set record
(C) Controller: Does the following, in the order with each request from
the View
(1) Add request (carries reference to Sender)
(a) retrieves data from Sender as a reference to a Record object
(b) passes this Record object to Model's add() method
(c) updates the View
(2) Remove request (carries reference to Sender)
(a) asks Sender which of Model's Records it is working on (index)
(b) asks all registered Views whether
(a) passes this Record reference to Model's delete() method
(b) updates all registered Views
(3) Set request (carries reference to Sender)
(a) asks Sender which of Model's Records it is working on (index)
(b) retrieves data from Sender as a reference to a Record object
(c) passes the data Record object to Model's set() method, using the
result from (b) to determine which Record to Set
----------------------------------------------------------------------
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095-1570
310-825-1402
----------------------------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden