Development Strategies

Developing is like playing with lego bricks, you can build a plane using lego in different colors, different styles , resulting in different properties.

Same goes for development, you can achieve the same end result in different ways, having different side effects. Its very important to adhere to effeciency and effectiveness of your code in order to build maintainable applications.

Key guidelines you should print out and put above your monitor are

– No 3 lines of code should be repeated 3 or more times.

– target an architecture with 10 lines of code per function, 10 functions per class and 10 classes per package/folder

– Add a comment above each function saying what it will do, what are the inputs and outputs

– A comment for each  class saying what this class is to be used for

– A comment on every code line / set of lines , where you are doing a complex operation which is not visible at a quick glance.

– Inherit / extend if you want variants

– Build components instead of pages /views . Components that are re-used in your next projects.

– Build packages / classes that do re-usable functions

– If using a framework in the long run,  build plugins for own use, share online if you want to.

– automate your testing when you find yourself spending a lot of time testing your code.


while it seems very difficult to adhere to some of the guidelines but it is always important to target such an architecture. You can have functions going 100 lines too, but you will need to comment them more appropriately but keeping an average around 10 or so is important. The idea behind this approach is to increase readability and troubleshooting.

Not repeating same lines of code is very very important, you will not spend time refactoring your code if you have not repeated the same thing again. Many of us will have seen beginners build html websites with header copied in 10 files. a small change in logic just needs the change in 10 places, one small mistake every now and then and you soon find you have built an un-maintainable mess and want to restart from scratch.

It is also important to design your code to write least amount of lines as more often than not, this is the highest performing method too. Lets take an example, We want to integrate with a service exposing 10 APIs on json following a similar pattern. We have have json format specified format specified in each function of our client consuming these APIs , or we can prepare an array in a config file, which is read to display the inputs to be taken and calling the API with the parameters defined in the api call. That way we can add another 100 APIs by just adding 100 lines to that array. There is of course a limitation if we need some special treatment but the idea should be clear that the part which is repetitive and needs little effort is often replaceable with a more intelligent function.

No doubt the final answer is a fully intelligent framework that can build , test, improve and fine tune itself  in response to a conversation with the programmer and react to the user actions by further undertaking a continuous improvement process.



Leave a reply

Your email address will not be published. Required fields are marked *