!title Discovering Reuse. In response to [[http://www.loudthinking.com/arc/000557.html][http://www.loudthinking.com/arc/000557.html]], entitled "Reuse is vastly overrated" The refactoring part of the test-code-refactor cycle in TDD focuses (at least in part) on eliminating duplication. You write a tiny piece of a test, then just enough code to get it to pass, then you refactor to a better design (by removing duplication). I think that we tend to think of that at a fairly granular level, but it applies at more macro levels as well. In the same way that we can extract a method that can serve more than one component, we can extract entire components as well. But the time to do that is when you see the duplication, not in advance - not when you '''think''' that something '''might''' be reusable, but when it actually '''is'''. I guess what I'm saying is that reuse is best discovered, not planned. We all (most) accept this to be true for methods, and even classes. Why not packages and even entire libraries? ---- !commentForm !* Fri, 3 Feb 2006 05:21:26, nraynaud, Frameworks I agree for the home-managed code (what scaries me is that I was sinking about this issue yesterday night and you post it today, are a brain spy or something ?). But what about reusable framworks ? I think it is a shame that HashSet and HashMap aren't pluggable like TreeSet and TreeMap are in java for example, this is unanticipated reuse. Or there is no other way to format tooltips other than HTML in swing. Do you have good guidelines for this ? The best is having a (smart) user at home to feed us with requirements, but this is not always the case. *! !* Fri, 3 Feb 2006 07:39:06, Ryan Cooper, Frameworks Ideally, frameworks should emerge as you eliminate duplication in client applications (you should start without a framework, and refactor to it), and framework APIs should not be solidified until they have been put to extensive use. You won't get by with a smart user, you need many users trying to do different things with the framework. This will expose the real usage patterns of the API, not just the usage patterns you anticipate. It is more problematic to include features which will never be used than to not include features which will be needed. After all, it's a lot easier to add features to an API than to remove features from it. The hard part of developing frameworks (to me) is managing the evolution of published APIs. How do you meet new requirements or usage patterns, and maintain backwards compatibility, without leading to API bloat? I'm by no means a framework expert; I'd be interested in gathering some opinions on this. *! !* Fri, 3 Feb 2006 08:06:06, , I doubt that there's anybody who disagrees with this sentiment and it works well within one team or a department in which different teams frequently communicate. But how do you scale it up to large organisations in which hundreds or thousands of developers are working on different projects around the world? This is what the reuse community is trying to address and knee-jerk exhortations to "just refactor" don't even begin to address the issues involved. *! !* Fri, 3 Feb 2006 12:20:16, Ryan Cooper, larger organizations When it comes to large-scale frameworks with large user bases, I think Eclipse is a good example of how things can work. Erich Gamma shares some thoughts about frameworks and reuse in this article, which I found quite interesting: [[http://www.artima.com/lejava/articles/reuse.html][http://www.artima.com/lejava/articles/reuse.html]] *! !* Mon, 20 Feb 2006 22:27:22, David Allen, large-scale reuse Thanks Ryan, the interview with Eric Gamma is excellent. Bertrand Meyer provides additional advice for large-scale reuse, in "Object-Oriented Software Construction, Second Edition, Chapter 4." He not only speaks of the technical and tool related issues, but he also speaks about the social, political, and organizational issues. *!
Use alt+s (Windows) or control+s (Mac OS X) to save your changes. Or, tab from the text area to the "Save" button!
Grab the lower-right corner of the text area to increase its size (works with some browsers).