----- Original Message ----- From: "S0 F1" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, September 03, 2008 2:16 PM
Subject: [Flashcoders] Singleton lookups vs Events ...


Any thoughts on whether it's more efficient (in terms of development and
player performance) to use Singleton's (with static public 'getInstance' or
such) instead of Event's when developing mid-sized applications? (for
classes that *are* Singleton's of course). Asking this in regards to when
you know no other class needs notification.

It seems a lot cleaner in terms of code (not having to create and listen for
events). Just a direct call - but what about performance speed, etc.

Is this good practice.

Direct calls? No, because you are binding one class to another and are building restrictions into your classes that mean they are less reusable in the future.

What if you need another class to respond? You need to add another call to class C from class A because class A was built only to call class B. With events class A issues the event and remains unchanged.

I don't understand the supposed correlation between sinletons and avoiding events. Perhaps it's because static classes/singletons are accessible without having to access an instance created elsewhere?

Paul

Cheers.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to