Sohan's Blog

Living the Developer's Life

Know Your Enemies Before They Kill You!

From darekb
You know what, this is a political world. So, enemies will seemingly look like your friends until the moment when.. well, its time for the kill! My dear readers, its time to know the enemies!

I have met with a few enemies off late. I will go one by one here.

If you are a software developer like me, you will often see this enemy, camouflaged variables, methods, classes and namespaces. For example, I have recently seen a Stack camouflaged as Visitor! I really mean this. I found a class called Visitor, so I was expecting a Visitor Design Pattern implementation or something similar, but what I got was a Stack under the hood with two methods Push and Pop! This enemies are very bad for your health, as they will keep you guessing all the time… you never know what they do from looking at their names!

Another enemy you will often see are the very skinny ones, to skinny to have any meat in them. I met some enemies like this as well. What happens when you do over engineering with interface explosion and a lot of one method classes? Is it really that difficult? Is it really a class? Is it really a package? I don’t think so! You can spoil a piece of code by introducing a class/package for a single method. This enemy often surfaces because of the fact that, the design pattern book only shows classes with one/two key methods in them… which is of course not intended. But this is life… you gotta balance between class explosion and God classes… really, or this enemy will kill you someday.

I have just touched two common enemies… but there is another enemy we all are aware of, CMD+c (OS X) or Ctrl + C (Win). Its such a pain to copy a code fragment and use it in a different class… this is exactly the form of reuse that kills everything. Make sure you don’t let this germ to grow, or it will outgrow you and leave you crying.

Have you reviewed your code by someone else today? If yes, keep up the good work. If not, beware of the enemies before they get you. Best of luck!

Comments

jackob
Hi dude,
i read your blog,This is a wonderful blog.I was able to get the
information that I had been looking for. Thanks once again.
Thank You
Ruby Software