Roedy Green said:
If the code is running unmodified in 20 years, most likely that code
is so obscure nobody knows how to change it, so it locks a business
rule into place, that really should be flexible.
Typically it is not the code that is obscure. Code in PL/I, COBOL etc etc
is generally easy to read.
What locks a business rule in place is the Parent of ALL business rules:
"Business rules cannot change, after all, they are business rules".
I've seen code 15 years old that is perfectly understandable - we just
cannot find anyone to explain the "why".
I've seen code 15 years old that is perfectly understandable and continues
to do what it was supposed to and no one actually has asked for it to be
changed (outside of additional auditing information that was added in early
90's and again in the 00's).
So, to summarize, the "why" is often more important than the "how".
Flexibility is important if (a) It really is needed and (b) It doesn't
become bigger than the problem. KIS.
In real life I have seen people emulating code for hardware that has
not existed for a decade mainly because they long ago lost the source
code.
The problem here is that they don't know what the old source was doing and
nothing more. An old employee of ours actually managed to lose some 5 year
old source code once. We knew what it did and we rewrote it...comparative
tests showed all was well. No problem.
Consider how many times that code will have to be read by maintenance
programmers, even if not changed, over that 20 years. You want to go
for something that is READABLE.
Absolutely. But we want to have the annotated cliff notes that give the
summary of what it is doing it for.
Java Gui code is not readable, but non-gui code is fairly good. It
should be considerably better with Java 1.5.
All the things I see are definite improvements for readability, the enhanced
for loop and autoboxing. I'm not sure on the metadata front because most of
that "boilerplate" code is generated anyhow - it's just more hidden.
All these things though are just details. Nothing substitutes a good design
and it will be just as easy to write crap 1.5 as it was to write crap 1.1.
It's kind of like literature. We can remove grammatical constructs, reduce
words and make things nice and simple like Harry Potter....but 100 years
from now people will still be figuring out Shakespeare and it's
quirks...whilst Harry Potter gets studied at "alternative" colleges....It's
the grand picture that makes something important with value that will last
JCE