I guess it a matter of style, but by making it private you are
essentially saying this is my variable and I'm looking after it.
I would also add that by making it protected a person could come along
and not redeclare it but clear it meaning that other singleton objects
will be lost and so they will need to be recreated in the process losing
the data that was put in them.
graeme
David Zülke wrote:
You're right, but what's the problem about the var being protected. Not
publicly accessible, but you can change it by subclassing. I'm sure that if
I make it private, one day someone will show up and ask why it isn't
protected because he needs to do blah blah blah ;)
- David
________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of graeme
Sent: Saturday, July 02, 2005 12:00 PM
To: Agavi Development
Subject: Re: [agavi-dev] Singleton
But why would you want to offer that? Surely the point of putting code in a
framework is so that a developer doesn't need need to go down that path. All
it would provide (as I can see) is the ability to create a smaller array
with which to do the search for isset.
graeme.
David Zülke wrote:
It's protected to allow sublasses to implement the singleton functionality
themselves. You cannot redeclare a private member, and $instance is the
common name for the instance variable.
- David
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of graeme
Sent: Saturday, July 02, 2005 11:25 AM
To: 'Agavi Development'
Subject: [agavi-dev] Singleton
Just had a peek at the code for SingletonModel. (revision 151)
I think the $instance array should be private. Only that class wants to
be able to manage the array list whilst, yes constructors should be
protected allowing the subclasses to modify the constructor.
graeme.
_______________________________________________
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
_______________________________________________
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