Wednesday, September 16, 2009

The "Right" way to Code

In the days before Google, I had formulated the CTP theory which I proposed as the "Right" or better way to Code for Junior Developers. With the advent of Google, this theory transformed to the GCTP theory.


CTP:
Before Google came up, junior programmers often used to copy & reuse existing code which was written either by them or someone else they knew or they had somehow got hold of the relevant code.
This caused a lot of problem when I was managing a team of such developers, so I formulated the CTP Theory.

The first thing I did was to encourage them to use their imagination & creativity to solve the problem themselves. If required, they could look-up the code base that most of the consulting companies already have to gain insight into ways the problem could be solved, and then come up with their own solution.
However, if there was a time crunch and/or it was felt that reinventing the wheel provided no benefit, then CTP should be applied.

C : Copy - find & copy the portion of code / routine you want
T : Transform - transform/change the code to suit your needs - this step was missed most often
P : Paste - paste the changed code in the right place

If CTP was used diligently, it provided greater success to the project


GCTP:
However, with the arrival of Google, everyone started to just google the solution and so I had to come up with the next version of the theory which I named GCTP.

Again, the first thing I did was to encourage them to use their imagination & creativity to solve the problem themselves.
However, if there was a time crunch and/or it was felt that reinventing the wheel was of no benefit, then GCTP should be applied.

G : Google the problem - google the problem
C : Copy - find & copy the portion of code / routine you want from the google results
T : Transform - transform/change the code to suit your needs - this step was missed most often
P : Paste - paste the changed code in the right place

If GCTP is used diligently, it will provide greater success to the project and quicker coding maturity to the junior developers with the least amount of hand-holding/supervision.

Note that the emphasis on both these methods is first to try to use your own brain. But in case these need to be used, then the emphasis in on T - Transform as that is where I found the junior developers making most of the mistakes most probably because either they did not understand the real problem or the way the solution had been coded.

No comments:

LinkWithin

Related Posts Plugin for WordPress, Blogger...