Design principle:

'Code to interface, not implementation'.

Say you have classic MusicPlayer interface (and this is all psuedo-code):

play()
stop()

ok, now I've got CDPlayer implements MusicPlayer:

play()
stop()
==
nextTrack()

and TapePlayer implements MusicPlayer:

play()
stop()
==
eatTape()

Then, we have system (?RemoteControl) which uses both and perhaps many more
MusicPlayers:

var musicPlayer:MusicPlayer

function setPlayer( player:MusicPlayer ){...}

function play() {
  musicPlayer.play()
}

We can now change behavior of RemoControl at runtime.

A good example is Strategy pattern:

http://en.wikipedia.org/wiki/Strategy_pattern

Scott

On 10/13/06, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:

Hi list...

I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use.  Anyone care to shed some light?

Thanks,
- Michael M.

_______________________________________________
[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




--

: : ) Scott
_______________________________________________
[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