Sunday, March 28, 2010

Code Etiquette

Valuable lessons learned this week in the wonderful world of test coding.

Here are some of my hopefully old habits!

1.  Write code
2.  Re-factor and compress repeat code into useful methods
3.  Comment out old code to validate new methods

Sounds reasonable, right?

Then I do the following:

1.  Fail to check in the code
2.  Get in a hurry to check in the code
3.  Leave commented out code when checking the code in
4.  Fail to execute the tests as a unit prior to checking in code
5.  Fail to do an update to the code base prior to developing new code

A couple of major flaws in my actions or non-actions are that I check in new code that is already outdated because I failed to do an update.  I check in ugly crusty code full of meaningless commented out lines.  My team has absolutely no clue as to where I left off or what demons I was battling.

So I need to start a new set of developer habits as a test developer.

1.  Start each effort updating the target project
2.  Execute a "Diff" on all files that have differences
3.  Closely examine the differences and make smart choices on which file is more current or when to merge
4.  Continue to write code, re-factor and comment out old lines of code, BUT clean all of this up prior to checking in the code
5.  If I have demons I am battling during development (examples - Java Script timing issues, or page builders) I plan to clearly annotate these areas with comments and TO DO lists so team members can at least have a sense as to where I left off
6.  Seek help if I am stuck for to long a small area of code
7.  Test the code, Test the code, Test the code -  What this means is test it locally in isolation, test the suite of code locally, and test the code on our production system
8.  Checking in any code at the end of each day regardless if I am complete or not.  The code should include clear concise documentation if there are non-functional areas and not crusty commented out lines of code that server absolutely no purpose.

I definitely have to find a way to have better developer habits.  The last thing we need to do is cause unnecessary tension within a great team.  I am not a developer by nature so I really have to work at it.  But I do promise to always strive for continuous improvement.

If anyone has other suggestions for skills improvement please leave a comment!

Happy coding!

1 comment:

Scott said...

Wow! Excellent Post!