<< Slides, DocBook, PowerPoint Free, ... | Home | Things we don't understand >>

DRY, SPOT, at what cost, ...

I've heard a lot about the DRY principle: Don't Repeat Yourself, lately. It is also called the SPOT rule.

This really is easier said than done. And violations of this principle can be found everywhere.

A case in point: In Java, any public class Foo must be defined in a file named Foo.java. This is a source of irritation for Java beginners. (Another source is the match up of package declarations with directory structures. Although not required, failing to do so causes problems with the javac compiler in finding the source for a class.)

However the cost of reducing this duplication is too high: either change the language, or use a preprocessor. Imagine writing code like this:

public class __BASENAME__ {
  // ...
}

So we learned to tolerate this ducplication.




Add a comment Send a TrackBack