22 points · by edw519 · 18y ago · 5 comments
One of the big problems, though, is that inheritance is much easier in most programming languages than composition is. Java, for example, has absolutely no support for composition or delegation, whereas inheritance requires a single keyword. C++ has multiple inheritance, which you can kind of re-purpose for the sake of composition, but it's still not very elegant and tends to just exacerbate the misuse of inheritance instead. Ruby has a pretty elegant mixin model, and you can pretty much do whatever you want in Javascript if you're willing to roll the solution yourself (I confess that my Python knowledge is more limited so I have no idea if there's support there), but the most mainstream OO languages require you to really fight them in order avoid using inheritance inappropriately.
It's a shame that students have to begin their programming careers by working around bad tools.
Anyway, I think everyone with a degree in computer science should at least be able to write programs in Smalltalk, C, Lisp, and a dynamic language (Perl/Python/Ruby). Let them learn .NET and Java in trade school. They are of dubious educational value.