[Nitro] help with og!
zimba.tm at gmail.com
Sat Dec 3 13:52:45 EST 2005
On 03/12/05, David Corbin <dcorbin at machturtle.com> wrote:
> On Friday 02 December 2005 05:40 am, zimba-tm wrote:
> > On 02/12/05, TRANS <transfire at gmail.com> wrote:
> > > On 11/28/05, zimba-tm <zimba.tm at gmail.com> wrote:
> > Do you have real-world examples that show it's really needed to have
> > unstored attributes of an objet ? I think KirbyBase will store them
> > all, but I might be wrong.
> Well, real world experience. We do it all the time where I work. It's a
> common optimization technique. Say a model object is responsible for
> generating a bitmap. You might want to only generate it once, on demand.
Ok, I think it's a valid point.
> > An alternative would be to rely on the constructor. I think an object
> > should be instanciable with only default parameters. Maybe it's
> > doesn't validate, but it should be instanciable. It's also usefull to
> > create "empty" objects that can be stored in the sessions and filled
> > by multiple form pages (using continuation?) unless they are valid and
> > can be transferred in the database.
> In an ideal world, it would be impossible to construct an invalid object. Some
> objects have no concept of 'default' parameters. It just doesn't make sense.
I don't agree with you. In a real world, defect objects are created
and it doens't necessarily matter until you can't detect that they
aren't In an ideal world, ruby would provide the facilities to specify
an attribute's type instead of using property. So your classes are
specifically built anyway. What difference between that and using
'default' parameters, except that the latter is at a language level ?
More information about the Nitro-general