Well, although it is good to know the accepted lingo, and although I
must say Juan's post was an enjoyable read, I do have to say that it
supports my point, and Jason's post illustrated exactly what I was saying.
(...continuing my IMove example, which was most definitely not as clear,
but is what you were describing with your collision detection example)
I believe an interfaces only real usefulness is in the ability to make
sure it conforms without having to a bunch of checks. Because you could
have thousands of different animals, like cat, dog, human, etc., but
unless using * as the type
e.g.
makeItJump (obj:*){/*code to test if it can jump goes here, and then
code to make it jump*/}
makeItRun(obj:*){/*code to test if it can run goes here, and then code
to make it run*/}
and then checking that the object was in a list of objects allowed to
use makeItJump, or testing if the passed object had the required
methods, it can only type check against one type at a time; yet, an
interface can allow all animals that have the IMoveable interface cat,
dog, human, rodent, etc.. without having all that code
e.g.
makeItJump(obj:IMove){/*code to make it jump goes here*/}
makeItRun(obj:IMove){/*code to make it run goes here*/}
which, is obviously better; yet, by just looking at it, it seems that it
should be has-a, because you are testing if it has the capability to do
something, or has-a given interface. Therefore, considering you are
essentially asking if it's capable, I think the logic for the accepted
lingo is screwy.
Unless you are just trying to get across that it is-an object that is
movable, I still think that the usage of is-a has-a as descriptions is
non-sense.
I-am Anthony
Anthony is-a Human
Anthony has-a voice because he implements the voicebox interface
But Anthony just has to be difficult and different, so please excuse him.
On 9/23/2010 10:37 PM, Anthony Pace wrote:
On 9/23/2010 3:51 PM, Henrik Andersson wrote:
you say Picture IS-A IDrawable.
Despite what the naming conventions are, since the only thing, IMHO,
that interfaces are useful for, is determining if the object being
passed to a method complies and has methods/properties that can be
used, without having to write code to check if the object being passed
actually has all the desired methods/properties.
e.g. According to my understanding:
human, cat, dog are different objects, but they all have an
IMoveAround interface
So I know If I pass one of the objects to a method that it can use the
blueprints defined by the interface without something breaking, and
have each walk,crawl, Jump, etc... in their own way.
so shouldn't it be has-a? or it-has? or they-have? or is-able?
Maybe I am not experienced enough with solid OOP, but that's the way I
am understanding things right now.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders