See API Design at its new home on bradley-holt.com.
Artima has an older (but still relevant and interesting) interview with Josh Bloch, a Sun Microsystems Architect. While the interview focuses on Java, Josh Bloch has some interesting things to say about software design in general. The main topic is thinking about design in terms of APIs instead of monolithic software construction.Reuse is extremely important but difficult to achieve. You don't get it for free, but it is achievable.The lure of object-oriented programming is the ability to reuse code. However, creating reusable code is not as simple as switching from procedural to object-oriented programming. One may make the switch from procedural to object-oriented programming and then be disappointed that object-oriented programming didn't deliver on the promise of reuse. Josh Bloch has a potential solution to this problem but it requires one to think about software in terms of public APIs.
Being disappointed with object-oriented programming, one may then decide to try agile programming, perhaps even extreme programming. One tenant of extreme programming is to "do the simplest thing that could possible work." Josh Bloch points out that this is easy to misconstrue:
The extreme programming proponents don't advocate writing something that will barely work as fast as you can. They don't advise you to forgo any design. They do advocate leaving out the bells, whistles, and features you don't need and add them later, if a real need is demonstrated. And that's incredibly important, because you can always add a feature, but you can never take it out. Once a feature is there, you can't say, sorry, we screwed up, we want to take it out because other code now depends on it. People will scream. So, when in doubt, leave it out.He goes on to talk about other topics such as minimizing mutability, protected vs. private members, when to make a class final, and the copy constructor as a cloning mechanism. It is interesting reading if you are striving for the goal of reusable object-oriented code.
No comments:
Post a Comment