PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: dgtlmonk on June 25, 2008, 07:33:43



Title: Interfaces
Post by: dgtlmonk on June 25, 2008, 07:33:43
Hi,
 
 I notice in some examples, some implements interface and some don't (i.e. in FlickerGallery demo it only declares "public class ApplicationFacade extends Facade", while in HelloWorld demo is declares "public class ApplicationFacade extends Facade implements IFacade" ... I know the best practice is to program to Interface .. or is not declaring "implement InterfaceName" just a lazy way to do it even though it will work?

Thanks


Title: Re: Interfaces
Post by: puremvc on June 26, 2008, 05:03:51
The implements params are there primarily as hints to the reader of the code. The interface is usually inherited. Tacking on the implements will not, however let you use a class that doesn't actually implement or inherit the interface.

Also, back in the early mists of time, there was a problem in Flash's AS2 engine that meant you had to put the 'implements' on a class that you were going to manipulate via interface. Although the methods were inherited the 'implements' had to be explicitly placed on each implementor. This is how I remember it anyway.

-=Cliff>