Posts

Showing posts from June, 2009

10 Steps to be a good programmer!!

1.- DRY: Don’t repeat yourself. DRY is usually the easiest principle to understand, but it is quite harder to apply. It means that when finding similar code in two or more places, we should abstract them into a new method and change the previous code fragments so they will now call the new method with the appropriate parameters. DRY is maybe the most universal coding principle, I have never found a developer who would argue that repeating code is good, but, I have found developers that forget about this principle when coding unit tests, as an example: imagine that you have changed the interface of a class which had lots of unit tests, if you haven’t used DRY, you will have to manually change the call to this class interface to match the new signatures to each test case. 2.- Write short methods. There are three very good reasons for writing short methods . Your code will be easier to read. Your code will be easier to reuse (short methods are likely to produce loose coupling). Your code...