Interview with Ken Arnold on Design 12
Bill Venners writes "Artima.com recently completed publishing a six-part interview with Ken Arnold on distributed systems, JavaSpaces, and design. In Perfection and Simplicity, Ken explains why there's no such thing as a perfect design and proposes the radical notion that
programmers are people. In Taste and Aesthetics, Ken discusses the role of taste and arrogance in design, the value of other people's problems, and the virtue of simplicity. In Designing Distributed Systems, Ken addresses the concerns of distributed systems design, including the need to expect failure, avoid state, and plan for recovery. In Sway with JavaSpaces, Ken describes the basic idea of a JavaSpace, illustrates how decoupling leads to reliability. In Data, Decoupling, and Iteration, Ken explains how JavaSpaces lets you "throw in a grain and watch it grow." In Java Design Issues, Ken discusses whether to prohibit subclassing, whether to use Cloneable or copy constructors, and when to use marker interfaces."
What he means by "prohibit subclassing" (Score:2)
So ... should all non-leaf classes be abstract, and all leaf classes be final? Or should you be able to subclass a concrete class?
It's an interesting discussion to have. I'm not committed to either side.
"you want to make illegal things impossible" (Score:2, Interesting)
Re:"you want to make illegal things impossible" (Score:2)
Re:"you want to make illegal things impossible" (Score:1)
It's in a different context, but I'd say it's a good idea: if you try to close a file a second time, nothing happens! And that's how standard Java file-like objects work, their close() methods does nothing if the file is already closed.
Re:"you want to make illegal things impossible" (Score:1)
In this case it's not so bad because any write might fail, so you have to deal with failures anyway.
C++ (Score:2, Informative)
This is an interesting point. I know a good bit of C++, but I don't often code in it. Why? Because I spend twice as much time looking up methods and classes than I do actually coding. Half the time I still later discover that I reinvented the wheel.
Re:C++ (Score:1)
I find your comment somewhat ironic, considering that the articles are mostly about Java, whose library dwarfs C++'s. What is your preferred language? C? Or are you suggesting that Java's library is simpler than C++'s?
A large library can be overwhelming, but it is a great tool to have at one's disposal. I learned C++ before I learned Java, and, at first, Java's mammoth library confounded me. These days, I consider it almost indispensible. I felt the same way when I transitioned from C to C++.
Re:C++ (Score:1)
Or are you suggesting that Java's library is simpler than C++'s?
I think that's true, but I don't think it's the main reason why I prefer writing in java.
In my mind the problem with C++ is the patterns - there's too many of them.
Pass by value, pass by reference, who takes ownership of this memory, is it shared?
Difference groups of people do it a different way, and so each time you use their code, you have to work out what patterns they use, and find a way to bind them into your design.
That problem is made worse by the fact that the std library is quite small, and historically was even smaller - lots of people wrote lots of libraries and there's no common theme.
In java it's easier. Most things follow the same pattern - partly because there are less patterns to chose from (all the memory managament ones dissappear) and partly because the library is more cohesive.
A minor point (Score:2)
If its in a subclass, shouldn't its constructor have already completed by the time your superclass's constructor is executing?
-Zipwow