There is one usecase that most Flash developers will come across. Lets say
we have a loader.swf in which the main (or base) class is loads main.swf, main.swf has as main (or base) class needs to give a signal to the loaded main.swf and tries to type
the instance on the stage as Main. This way, will makes sure the
file that is loaded is who he expects it to be (namely
The above situation poses a problem. If references, will be compiled into loader.swf as well. In most cases this will
result in a loader.swf that is of the same size as main.swf. In order to fix
this we need to make use of an interface.
The will implement the interface and will type not
as Main, but as the interface. This way only the interface will be compiled
into the loader and not the implementation (or While this solves
the problem described earlier it also gives some extra benefits. The loader
is suddenly reusable. It no longer depends on a specific implementation of
any class. It will accept all classes that implement the interface.
I hope this usecase adds anything to the discussion.
Greetz Erik
On Tue, Aug 26, 2008 at 4:32 AM, ben gomez farrell <[EMAIL PROTECTED]>wrote:

> Yah, maybe the word isn't "contract" but a "contract with loopholes".
>  Anyway, it does a good job of getting intention across, regardless, across
> a broad set of code.  But yah, i can see the value in it, and I can see that
> its a little extra effort that might not be worth it.  I'm still more in the
> stage where I try to apply it to things to see if it's useful.  I'm not sure
> if it's helped so far, but it hasn't hurt.
Flashcoders mailing list

Reply via email to