Wednesday, January 7, 2009

Workarounds

Lazy coders. I sympathize, but sometimes there are lines to be drawn.

Recently, a problem occurred in regards to a particular parameter sent to a method which resulted in a high severity defect against our application. The message was modified to include new information. The message could also come in different formats.

Problems...
1. The changes in the message were not documented.
2. The code handling the message was not generic.
3. The message parameters were not strongly typed.
4. The message could be formatted in one of two different ways.

There were two suggested solutions to solving this defect.

1. Document the message changes well. Make the message handling code more generic to handle this message more gracefully, yet generically to accomodate future changes. Consider separating the multi-formatted message into two separate messages in order to have a more strict definition for the message.

2. Add an additional guards for the new changes in the message.

Solution #1 was offered by me. This is why good programming and good developers are hard to measure. Adding new guards will solve the immediate problem. The downside is that when new parameters are added to the message in the future (which they inevitably will), the code will break yet again.

I, therefore, emote: *sigh*.

Think generically.

No comments: