2008年7月23日星期三

Re: [fw-mvc] Best practices in a thin-controller application

HI David,

David Mintz wrote:
> Which brings me to another question, maybe sort of OT. If your model's
> constructor requires an id parameter, how do you instantiate a "blank"
> object to be populated with data provided by the user and then --
> excuse me for thinking database -- inserted into a table? I am
> thinking of RDMSes that have auto-incrementing.You find out the id
> after the insert.
>

One possibility would be to use a Special Case [1] object to encapsulate
the "blank object" concept. The special case should be interchangeable
with the the "real" object.

[1] http://martinfowler.com/eaaCatalog/specialCase.html

Regards,
Bryce Lohr

> --
> David Mintz
> http://davidmintz.org/
>
> The subtle source is clear and bright
> The tributary streams flow through the darkness

没有评论: