Wednesday, November 14, 2007

Safe Coding with Coding Marker

Here's what I do while coding in between svn commit especially when doing lots of experimental code and trace messages : use temporary Code Marker. These marker basically function as "recycle bin", edit buffer for referencing original code and tag for cleaning things up after the code is working so less code clutter. Using this, I could focus on the goal of the task without having to memorize many little stuff too much since I can refer the old code anytime , do little "manual revert" easily when I need to and just do search for clean things up before commit.

Marker that I use :

  • //TEMP : Added before the new added line(s). Temporary console output for debugging marked as this too.
  • //DELETE : Added before (commented/uncompiled) lines that will be deleted when the current coding task is working. In the case of changing some part of a block of code, I copy that block and paste below it, comment and mark the original with this mark and play with the copy (with the bonus of having the original above it for reference and rollback just in case something happen).
  • //TODO : I don't use todo for task that I will done later/tomorow/next week (I use other stuff for that i.e: trac, xplanner), I use it only to mark todo list within update-commit window. I use this marker for todo list that come up in that window when I code something else and not yet finished.
I use those marker when working micro task, clean some up when it's done (using project-wide search funtion on IDE), do another micro task and repeat until I have changes worth committing. At that time, I do full cleanups before commit. This is where the last marker come into play : //DEBUGOUT. This one is used for replacing //TEMP marker that has trace output below it that at the time of the commit it seems worth keeping for future debugging purposes (or to be put as formal program logging). //DEBUGOUT is put in commented/uncompiled state and marked //DEBUGOUTOPEN when it's being uncommented/used.

Those zen-programmer might not need this, but for us mere mortal, any help that can help our already-crowded brain to focus will be very much appreciated.

No comments: