Seven Habits of Highly Effective Programmers

On technicat Philip Chu wrote an essay about delivering software projects on time. It's title 'Seven habits of highly effective programmers' refere to a book I red some years ago 'Seven habits of highly effective people' from Stephen R. Covey. Many ideas in the article are close to the ExtremeProgramming philosphy. One thing I consider an important issue is the 'Cut-andPaste' problem: most programmers do it and it is really a bad habit. It really is so easy to declare a new class, import from your default implementation, tell eclipse to implement the methods I have to and start with the coding from there. Copy past does not take less time.

Copy-Paste problems:
  • constructors with unnecessary arguments
  • variable names don't represent the real context, they refere to the copied context
  • documentation is wrong, referes to the copied context (or does not exist since the programmer is in a hurry (as always))
  • the mistakes done in the original code are repeated, code is not necessarily understanded but just adapted
  • unneded variables
  • you never know when you're done, there is already so much code it is hard to see if the needed adaptations are already done in specific parts of the code or not
Really, do code from scratch, it's the only way do know what your do. Everytime I don't follow this rule I get busted later with stupid bugs.

And, if there is so much in common to the original code, than you should refactor it to make it more genera or put parts of the functionality in a manager or helper class.