Dumb and Bore Programming Rules

None of my writings apply to declarative programming like Prolog.

Do you agree that bugs usually don't arise by calling a function or assigning values? Most bugs arise when you do these at inappropriate places. One of my friends complained me that he has difficuly maintaining a code that has problem 17 indentations down.

Think of a decision-less program. Can there exist a bug? Yes. Either the whole program works or it does not. But there could not be unending series of bugs catching us by surprise.

Ideally we would like to write the code without decision. Alas, the life is not simple!

The next best is to have a policy of "minimum decisions". Even reducing number of decisions is not possible beyond certain limit.

The question remains: What increases the probability of having code at inappropriate places?

The answer is simple – number of candidate places! What did I say? The more decisions, the more distinguishable places are in the program.

So the next best is to push the decisions out of explicit code and into the design.

Through this blog, I want to bring out some points that helps us write code with as less explicit decisions as possible. In turn, the chances of having bugs would reduce.

However, in rarity of decisions, the code would be very less indented, resembling a soliloquy. As we know, monologues are usually dumb and bore. 

I choose to be such a killjoy so that maintainer of your code have to scratch his head less often.

Together we will find out coding patterns that help us avoid unnecessary decisions. I will also do a sales pitch for OOP on how it helps reducing decisions.

0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s