Exactly. I'm using this functionality in a similar manner.

- David


________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of graeme
Sent: Friday, July 01, 2005 7:18 AM
To: Mike Vincent; Agavi Development
Subject: Re: [agavi-dev] Singleton Models

I don't see how Singletons would encourage bad design...

I might have an application I'm writing, it has data on an organisation and
its staff members. The data needs to be recovered from a database. I'd have
a class called Organisation and a class called Staff. Since there is a
single organisation, I'd like to use the Singleton model, whilst there is an
unknown number of staff so for those I'd use the Model as my parent class.
This gives me the security in knowing that whenever I get the organisation
object I know I'm getting the only one that exists. This certainly helps if
the object is stored with the User object and each time the program is
invoked it is either created or recovered from the user object, I know that
only one instance of the object will exist.

Then again maybe I misunderstood your concerns.

graeme.

Mike Vincent wrote: 
On 6/27/05, David Zülke <[EMAIL PROTECTED]> wrote:
  
P.S: there's not much harm in adding this functionality; I expect the
performance impact to be minimal, since it'
    

Except that it may encourage bad design. The points you made are all
good cases for extending the model class, I dont see how they
illustrate the benefits of the model class being a singleton? :) What
is the use case for a singleton model?

I reverted your commit to trunk earlier as I had been working on some
changes to it but didnt have a chance to finish them before you merged
and I think it's still worth discussing.

-Mike
_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev


  


_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to