Results 21 to 22 of 22
Thread: What's the point in interfaces?
- 04-29-2011, 03:10 PM #21
As has been pointed out, the usefulness of interfaces is really apparent in larger, more complicated systems. I would point out the various Renderer and Model classes and interfaces, for example for use with JTable.
And I know your logic would be something like "well then just make a Renderer class and a Model class", but that wouldn't work for other cases where you have two implementations of an interface that don't share implementation details. An example of that would be the Collection interface and the ArrayList and TreeSet implementations.
And, as has been said, if you're arguing that abstract classes with only abstract methods should be used in cases such as that, you're simply arguing for the semantics of an interface with a different name.
But this argument really doesn't matter. It's like saying "Your favorite color can't be red because my favorite color is green". This is entirely subjective. Apparently interfaces don't fit into your brain- I'm not saying you're unintelligent, just that your brain fits things together in a way that doesn't translate into interfaces.
Some people have brains that do more easily jive with interfaces. Presumably, the makers of Java were such people, which is why it's set up the way it is. I, and most others here, are the same way, so we prefer interfaces.
If you aren't one of those people, you can use a different language. The makers of Java aren't going to read your post and smack themselves on the forehead, proclaiming, "My god! We've had it wrong this whole time!" and then change the language specification.
- 04-29-2011, 03:30 PM #22Senior Member
- Join Date
- Jun 2008
- Rep Power
- By blug in forum New To JavaReplies: 3Last Post: 03-08-2011, 05:01 AM
- By minime12358 in forum New To JavaReplies: 9Last Post: 09-02-2010, 03:24 PM
- By jon80 in forum New To JavaReplies: 2Last Post: 05-03-2008, 10:57 PM
- By imran_khan in forum New To JavaReplies: 5Last Post: 07-30-2007, 09:11 AM