5 ms·
A. Stepanov on the STL
- zephjc 17y agoStepanov is a really smart guy, but I find his arguments that OOP methodology is "wrong" or somehow is no good, doesn't hold water. The truth is that a lot of the world is build on at least some OOP principles and that they have worked for countless designs, and been included into languages by lots of other really smart people. It also seems like this interview was done quite some time ago (see his comments about generics in Java) but I can't find a date. Nevertheless, a very interesting interview.
- sorbits 17y agoI think you are misrepresenting him. He says his paradigm is “start with the algorithm” (to make it generic) and that does not work in the OO model, and as an example he gives a simple max(a, b) function which he wouldn’t know how to write in Java. The “OOP principles” adopted by others, which you think voids his argument, you can argue are also used by Stepanov himself. He just calls it data abstraction (iirc).
- seancribbs 17y agoHis argument actually seems to point to dynamically-typed functional programming, which is not surprising, considering his work with Scheme.
- huhtenberg 17y agoBoy, that's old. > Java is a very new language :-)
- d0m 17y agoT max<T>(Comparable a, Comparable b) { if (a.compareTo(b) < 0) { return a; } else { return b; } } Or something.. Explicitly specifying that a and b needs to be comparable instead of shooting an endless template error message. And: "My approach works, theirs does not work." explains perfecly why C++ is what it is.
- jpr 17y agoEquality and comparisons in presence of subclassing etc. are not the business of a sane man. I think it is impossible to write an .equals() in java that satisfies all the relevant laws people usually assume from it.
- joshhart 17y agoIn Eclipse: Alt-Shift-T for refactor. Select "Generate Hash-code and Equals".
- mhansen 17y agoequals(Object o) has a very tricky contract to implement, when you add subclassing to the mix. Auto-generated code won't make those problems go away. See http://www.artima.com/lejava/articles/equality.html http://www.artima.com/lejava/articles/equality.html
- joshhart 17y agoI was mostly joking when I wrote the parent comment. I've read Joshua Block's Effective Java which spends a long time discussing the challenges of properly implementing equals. Generally speaking, Eclipse gets it correct. Implementing equals properly boils down to following a set of rules - something that computers are exceptionally good at.
- jrockway 17y agoI upmodded this for comedy value. This is really how Java programmers think. So what if the code is wrong in corner cases, it was auto-cut-n-pasted!
- sketerpot 17y agoIt's possible to be locally sane. For example, suppose you define an abstract Number class, and define subclasses for ComplexFloat and IntFraction numbers. You could define .equals() methods on each of those that only compare to the same type, and work correctly. You don't always have to deal with weird issues.
- davidmathers 17y agoHe has a book now, Elements of Programming: http://www.amazon.com/dp/032163537X/ http://www.amazon.com/dp/032163537X/
- ryanpetrich 17y ago"As the chief proponent of Java at SGI told me: 'Alex, you have to go where the money is.' But I do not particularly want to go where the money is - it usually does not smell nice there." I really love this quote