He can, but every other progammer (well, ok, mainly Java developers) are 
familiar with the getInstance convention.  It clearly illustrates that the 
class is a Singleton.

I only use it when my boss says to; otherwise, static all the way baby.

----- Original Message ----- 
From: "Judah" <[EMAIL PROTECTED]>
To: "'Flashcoders mailing list'" <[email protected]>
Sent: Monday, February 20, 2006 1:22 PM
Subject: RE: [Flashcoders] Re: When singletons go bad



Slightly off the subject but why does he have to use getInstance()?
Isn't there a way to use a singleton without calling getInstance? Why can't
he directly use the class like this:

import MyManager;

MyManager.doSomething();

The Math class, Delegate class and other classes let you use methods without
calling getInstance() first.

Judah

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jack Doyle
Sent: Monday, February 20, 2006 11:53 AM
To: [email protected]
Subject: [Flashcoders] Re: When singletons go bad

Just curious if this works better for you:

private function MyManager() {
// constructor
return getInstance();
}

public static function getInstance() : MyManager{
if(_myManager == undefined){
_myManager = new MyManager();
_myManager.init();
}
return _myManager;
}

Sorry, I haven't had the time to follow the whole discussion, but I figured
I'd throw this your way and see if it helps.

Good luck.

Jack



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to