So I just finished Head First Java and I'm looking to patch up a couple of misconceptions I'm having. First off, interfaces: how in the world are these useful at all?
It seems to me that going to the trouble of writing an interface and then implementing it in your classes is nothing more than a way of annotating said classes with an additional IS-A marker. EX: Wolf isn't just a Canine, he is also a PredatoryCreature.
But is that really all that helpful, when the methods contained within PredatoryCreature can't contain a body? Sure, they remind you to make sure that Wolf isn't just going to eat(), drink(), and sleep(), that Wolf needs to override methods like attack(), and growl(). but surely there is more to interfaces than a compile-time reminder to override some methods?
Unless their whole usefulness lies in the fact that implementating PredatoryCreature means that I can pass Wolf and some other PredatoryCreature to a method that should only accept PredatoryCreatures? I guess that would be a practical application of adding another IS-A flag to a class....but I could also have just added a boolean value to all my dogs.