Re: "only for polymorphism" Interfaces are great for this because if you have a concrete class that implements an interface, that instance gains another (abstract) type in addition to it's concrete type. This allows you to upcast an instance to the abstract type and allows client code (the code of other programmer's other than yourself) to treat it in a very loosely un-coupled way. If the client code communicates via the public methods of an interface, this will avoid any kind of hard-wiring into the implementation of the concrete class.
The power in all of this is 'reducing the impact of change'. If you have a publically facing interface and an implementation that is okay today but tommorow it is not, all you have to do is substitute the implementation. The new implementation will behave in the manner defined as the interface. In the eyes of client code, they don't really care what it looks like so long as it satisfies expectations (i.e. the interface). ...sounds great in theory! Even more fulfiling in practice. As for singletons, I don't know much of a way either except to put that type of implementation heavy stuff commented into the interface. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Andreas R Sent: Monday, October 23, 2006 4:54 AM To: Flashcoders mailing list Subject: [Flashcoders] Some whining about AS2 interfaces So i'm trying to build a framework around interfaces. To create an application within this framework, ideally all you'd have to do is implement the interfaces and satisfy their conditions. However: No static methods in interfaces means no static methods means no singletons. Bummer. No way to specify private constructors (also for singletons). Bummer. How would you smart people work around this? Documentation? It seems like a major disadvantage to interfaces, but i may just be missing the point entirely. Some tell me interfaces are "only for polymorphism", and while that's nice and all it doesn't make sense to me. - Andreas R _______________________________________________ [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

