Smallfish

Tips, Tricks, Shticks & Anything That Can Help You Be better Developer

Quality Code Short Tip #2 – Don’t Create What Isn’t Required

In Israel, this sign say “one-way street Update: dead-end” (you enter and exit the same side):

 OneWay

Now, if you see this sign, its meaning is clear. But if you see this sign:

WrongOneWay

You will start to think “What is this number? is it until 2011? from 2011? serial number of the sign?” etc.

So, why it is not as clear in development?

Many times, developers “prepare for the future” adding variables, db columns, tables etc. for “future use” - “I know we will need it in the future…”, but as in the sign, if you add it now you are adding “noise” to the code / db / etc. and may mislead your fellow developer (or you?)

so: Don’t Create What Isn’t Required Now!

Now, you are working on current tasks, create just what you need to accomplish the current task.

Comments

Offir Shvartz said:

first of all the sign is dead-end and not one-way street.

I must say I partial agree with you, it's good to think about the future while writing your code – you should not implement what you don't need but write your code in a way it could change or grow. This can help you easly maintain your code in the future.

# October 10, 2009 3:00 PM

Yair Cohen said:

@Offir, Thanks!

Ok, I will update it soon.

I totally agree with you that software should be able to "change or grow" but in means of extensibility points and not concrete implementations now that should support future.

# October 11, 2009 11:39 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: