Tuesday, September 25, 2007

Does Intuitive == Maintainable?

What makes code maintainable? What does it mean to be readable? Why does it matter?

My coding standards and styles change constantly.

I have yet to return to a project after a hiatus and understand it without some investigation -- no matter how intuitive it originally seemed.

If this is so, how can something be maintainable? If a project can be written in a few weeks and then not touched for several months, is there any chance you'd automatically understand or agree with the design?

There are very few solutions that cannot be figured out. Sometimes it takes minutes. Other times a bit longer. A lot of times it involves grimacing, cursing and questioning the sanity of the original developer(s).

But no matter how "awful" a solution may be, at one point it made sense to someone, so with some detective work it can be understood.

Something common of software that is easier to maintain is single responsibility and separation of concerns. These principles are not subjective. They don't change with time, mood or business domain.

If a project follows these principles understanding the entire system isn't necessary, just the part that needs to change. It may take some time to find it, but once found, the solution is simple.

3 comments:

Steven "Doc" List said...

As always, intriguing thoughts well stated. I have some disagreement, though...

But no matter how "awful" a solution may be, at one point it made sense to someone, so with some detective work it can be understood.

The phrase "some detective work" must have some pretty broad meaning, if this is to be believed. I've read some truly horrible code that made perfect sense to the author at the time it was written.

I agree that the premise is that it was understandable at some point. I'm just not sure that it's reasonable to put in the effort it takes to decipher some code.

...Doc

wendy said...

Doc,

I agree -- if it costs less to rewrite than refactor, then its not worth the effort.

Anonymous said...

nice to meet you