CodeFutures News & Industry Commentary Blog

Tuesday, February 15, 2005

Java Software Factories: Part 4 - Reuse

Code reuse was supposed to be one of the major benefits of object orientation. Of course, I'm old enough remember that it was also supposed to be a key benefit of structured programming. I'm not a DBA, but I can guess that reuse is also touted as a key benefit of using Stored Procedures.

But I have never really seen systematic code. It seems to be quite rare, in fact, because I did a quick check with some developers to confirm my impression is correct..

In fact, the opposite of reuse, reinvention, is actually more common. It's far more common for software developers to want to throw away code, the existing architecture, choice of tools and platforms, and start from scratch. This happens all the time. It even happens when it's strategically very the wrong decision to make (think about what happened to Netscape's market share while they wasted years rewriting Navigator). And it happens on all the time when its technically unnecessary and tactically not the best use of development resources.

It does not help that many software developers want to try out unproven new technologies - which is far more interesting than getting on with the daily grind of writing code.

One of the main reasons for all this waste is that other people's code is difficult to read. Even with internal coding style guides, developers produce very different solutions to the same problem.

Some of the fundamental principles of Java Software Factories will help eliminate reuse problems:

Design patterns: it's much easier to recognize a design pattern and therefore read the code. Start with the Core J2EE Design Patterns.

Code generation: it's much easier to make a simple change and then reapply the code generator

Systematic architectures: if particular types of applications within an organization always have the same architecture, it's easier to understand the source code.

PJ Murray
CodeFutures Software

0 Comments:

Post a Comment

<< Home