4 ms·
Interesting points, but I think you're bordering on straw manning the author. I'll grant you that maybe C++ is about as bad an example as you can get of puttin
by j_baker 16y ago
Interesting points, but I think you're bordering on straw manning the author. I'll grant you that maybe C++ is about as bad an example as you can get of putting responsibility in the hands of the programmer.
In fact, it was behind a lot of Java's decision to take that power out of the developers' hands. I would argue that Java was an overreaction. It corrected the safety issues, but also removed a lot of the ability to create abstractions. Want a global variable? Those are bad, don't use them. Want multiple inheritance? That's bad, don't use it. Want operator overloading? That's bad, don't use it.
The problem is that the fact that those things are bad in some cases (even arguably most cases), doesn't mean they should be forbidden. I know what I'm doing. If I want to use a global variable I should be able to. I know what I'm writing. The language designer doesn't.
In other words, to make a long story short: I don't think he was trying to say that responsibility needs to be in the developers' hands in all cases. But I think that he makes a valid case that newer languages are right in moving some of that responsibility back to the programmer.
- jmillikin 16y agoJava supports global variables just fine -- in fact, most Java code uses far too many globals for my taste. Multiple inheritance and operator overloading aren't bad, but at the time Java was designed, nobody had any idea how to use them properly. Python 2 gets MI right (though Py3 fucks it up a bit with magical super()), and Haskell provides a clean implementation of overloading, but it'll be years before these improvements filter through to Java (if they ever do).
- j_baker 16y ago"Multiple inheritance and operator overloading aren't bad, but at the time Java was designed, nobody had any idea how to use them properly." I think this is an example of the kind of reasoning Feathers was talking about. Perhaps it did make sense at the time, but that's largely irrelevant. What is relevant is that the idea that programmers aren't capable of making decisions on their own isn't a good idea these days.
- cabalamat 16y ago> Multiple inheritance and operator overloading aren't bad, but at the time Java was designed, nobody had any idea how to use them properly. Really? I was coding C++ using multiple inheritance and operator overloading around then, and AFAICT was using them properly.
- jmillikin 16y agoSorry; I meant language designers didn't know how to use them. C++ is a perfect example of operator overloading gone horribly wrong.
- jules 16y ago> Multiple inheritance and operator overloading aren't bad, but at the time Java was designed, nobody had any idea how to use them properly. It's not hard to figure out a better the way to do it than not doing it at all with a few hours thought. And in fact Dylan got both multiple inheritance and operator overloading right before Java existed. Method ordering is the most significant problem with multiple inheritance. You arrive at the simple (just use the lexical ordering of the superclass list) or the more complex (Dylan's method ordering, now also in Python) purely by reasoning logically. I'm pretty sure someone like Guy Steele would be able to figure this out. Operator overloading: what could possibly be worse than x.multiply(y)? You either have a fixed list of operators that you can override by defining a method in a class, or you have an expandable set of operators for which you can specify the precedence and which way it associates. This is not a hard problem.
- crystalis 16y agoThere are two problems - everything that you add distracts the human elements, and adds some computational cost. The human element ranges pretty far, from the neophile trying to grasp every piece, the seasoned veteran evaluating a new language, the maintainer considering what part to improve, or what patch to consider, and so on. Not every lawn needs a thousand pink flamingos, even if they're better than no flamingos at all.