I've been casually looking at zend framework for the last week or so now.
Regarding it's implementation of the MVC pattern, is there a recommended way to implement a model, or shall we just implement them as ordinary objects.
Best Regards,
Kieran
MVC
2006-07-27 13:24:45
Well, a model is usually a method of communicating with a
data source,
so objects will usually do the trick.
On 7/26/06, Kieran McDougall <Kieran.McDougallausenco.com> wrote:
>
>
>
> I've been casually looking at zend framework for the
last week or so now.
>
> Regarding it's implementation of the MVC pattern, is
there a recommended way
> to implement a model, or shall we just implement them
as ordinary objects.
>
> Best Regards,
>
> Kieran
--
Chris Hartjes
"The greatest inefficiencies come from solving
problems you will never have."
-- Rasmus Lerdorf
TheBallpark - http://www.li
ttlehart.net/attheballparkTheKeyboard - http://www.li
ttlehart.net/atthekeyboard
MVC
2006-07-29 00:07:13
Hi Kieran,
A model to me is an encapsualtion of a responsibiity.
Some people think that an active record is a model. This is somewhat misleading. An active record is a version of storage data. Try not to be constrained by this.
A model describes some area of your problem set. Lets consider a credit
card. It has a name, number, expiry date, ccvs number. Sure this data
is easily stored in a database but that does not define the
object.
A credit card object can be communicated with. You provide it information and ask it questions such as.
Are you expired ?
What Type are you? Is your number valid ?
These requests may be passed on to the object modelling a credit card
number which is able to validate itself and determine its type.
The date of a credit card may be an object which can validate itself and compare itself to another date.
As far as I can tell the Zend framework is not approaching modeling at all. It is up to you how you implment your models. The ZF is for interfacing your models to other things such as the user and storage.
my $0.02 worth,
Cheers, Gerrit.
I've been casually looking at zend framework for the last week or so now.
Regarding it's implementation of the MVC pattern, is there a recommended way to implement a model, or shall we just implement them as ordinary objects.