Skip to main content

Patterns, Shmatterns

Posted by chet on August 8, 2003 at 6:30 PM PDT

Seeing as how this is my first blog, I thought it was
reasonable to go on a complete tangent instead of spending
my soapbox time rambling on about upcoming features and
cool Java graphics things. Maybe I'll get into that
stuff in a later column...

For years now, we've been hearing about how Patterns and Components will make
our code much better, easier, reusable, etc. etc. etc. (etc.).
But I have yet to see patterns or components created for the
most commonly used and recreated things of all: bugs.

I find myself continually writing new code with completely
new features, yet I invariably end up inserting the same type
of bugs in it. There's the array overrun error (at least
in native code). Then there's the "Whoops! I
used the wrong local variable to dereference my data structure
inside of this loop bug." There's the "I forgot to initialize
that variable bug." Or the "I forgot to Unlock that thing that
I had previously Locked" bug.

Think how much easier and better and cooler our code (and lives)
would be if we no longer had to worry about creating these
problems from scratch, but could just rely on standard patterns,
or even reusable components to do them for us?

Efficiency:
Coding time would be much less because I could just grab those
objects at any time and jam them into my code without
even thinking about it:

"I need to fail out of this loop right about here;
what if I use the BadDereference pattern?"

Debugging:
Debugging would be way faster. We wouldn't even have to
use a debugger or analyze the code at all; we could simply
glance at it and find the problems by inspection:

"I see you have a BadLoopVariableIncrementor
pattern at work here. Let's try taking that out
and see if the code works."

Management:
Managers and program mangers would find it much easier to
quantify programmers' productivity and effectiveness:

"My bugfinder script found 87 bugs
in the 4 new files you've checked in. This is
6.7% more than last month; we need to make that
number go down, not up."

Life will be so much better with BugPatterns and BugObjects.
The promises of object reusability will finally come true;
after all, what single object in the software world is more
used than a bug?

And why do you think they called it Oops to begin with?

I'll get to work soon on these patterns, and then a library of
BugObjects. I'll try to open source the project so that
everyone can contribute. If we can get everyone to
participate, then maybe we can nail the whole spectrum of
bugs and we won't have to write any of our own bugs anymore!

First I have to finish working on my jdk1.5 features, which
includes fixing various bugs. Man, if I could only fix them
by grep'ing through the code for BugObject instances...

Chet.


(Currently working on 1.5 features and bug fixes, including
new VolatileImage API and fixing various things
related to hardware acceleration on Windows. Wish me luck.)

Related Topics >>