Sunday, May 4, 2014

Last Mile Quick Tips #4 – Keep Your Code Clean

As your creating your masterpiece take care to ensure that you keep your code clean.  One ByteMaster’s golden rules of software development imageis the only code that is guaranteed to not cause you problems in the long run is code that doesn’t exists.  What exactly does this mean?  use some basic principles, like DRY, Do not Repeat Yourself, refactor your code often, put some thought into your naming conventions, rather than commenting out unused code, just remove it.  If you do need to comment it out for some reason, add some comments as to why it’s commented out.  Although a personal preference, I try to keep my methods under about 20 lines, sometimes as little as 3-5 line.  Pick a standard naming coding convention and keep it consistent across your application.  One of my pet-peeves – if you are helping someone on an application, and they use a different naming convention, a you just know that yours is superior *cough* *cough*, swallow your pride and just following the app’s naming convention. 

Of course these are just touching on some of the basics, but there is a tendency when creating apps to think of them as something you can just hack together and publish, rather than something you need to put some thought into and engineer them properly.  Once you get to the final phase of your project if you don’t keep your code clean, you’ll be spending more time then you want just fighting with stupid stuff, tracking down edge cases and generally not having much fun.



  1. "methods under about 20 lines, sometimes as little as 3-5 line". I try to follow the Clean Code book rule instead that methods should have one atomic responsibility which leads to 3-5 line methods. This is better then arbitrary line count rules since its logical. There are many 20 line methods that should be broken apart and sometimes rarely 100 plus line methods that should remain as one method. For example, a DTO mapping method.

  2. What kind of app is this 'AppCamp'? I mean what is the purpose of this app? and how can we benefit from this? Share all the possible information, please.