writingsolidcode:Writing Better Code – Keepin’ it Maintainable

The Developer's Dilemma

There are two main ideas to keep in mind and should follow in order to keep our code maintainable:

1) Complexity is the enemy!

2) Fragility is the enemy!

The problem we face as developers is that when we are speaking in terms of these two opposing forces, there is a inverse relationship between them. Creating more flexibility to reduce fragility in our code requires more complex code.

So what can we do? We basically have two options...

We can write very (very) simple code but it will not respond well to change and be very (very) rigid and fragile. The extreme case would be to have procedural code that does not take advantage of any object oriented constructs. But what happens when something has to change? We have to go back in the code and rewrite large pieces of it which we can't finish before our deadline.

We can write code that takes every possible change into account and uses all the fancy design patterns we have ever found. When we first run across a cool new pattern we naturally look for places to throw it in. If we're really smart, we can even invent a few new _disibledevent=MsoBodyText>Happy Coding

Tags:  writing makeitbetter itisbetter writingsolidcode

延伸阅读

最新评论

发表评论