2/02/2007

Two New Coding Mantras

What we tell ourselves drives what we are. A simple psychobabble statement. To a developer this drives what we produce.

Are you won't to say "that is good enough" or "sure that will work".

Or are you more likely to ask yourself "is this the best approach?" or "what would happen if we tried this alternative?".

Certainly, time and pressures push us back and forth between these attitudes so this isn't driven by personality alone but also represents an assessment of your personal priorities.

While reviewing code today I noticed two symptoms that represents trends of focus that the developer needed to address.

The first was the attention attributed to which class file they were typed their code in. Every word we type has a domain relevance that should force us to consider its appropriateness in the class we are editing.

The second is the tendency to think in instances instead of across time. The code I write today works today but will it work tomorrow or in another situation or environment. This actually occurred in a test for proving a date manipulation method worked and the test only worked yesterday.

So, from these two observations I decided I needed to more mantras to add to my preaching.

Every word in the correct class.

All tests work always.

They could probably be made a little more succinct and perhaps the second shouldn't be test specific but "that is good enough".

No comments: