Improve Coding standards using Coding Kata
Kata means “form”
in Japanese. Coding Kata is an approach where in you improve your coding
standards, style, etc. by continuously working on a given problem. I know it is
difficult to find time in your daily work routine, but trust me this will
improve your coding to a great extent. (Try to find at least 1 hour per week
for this, which would suffice).
Kata is generally used in Karate. Karate has set of Kata. Kata are basically
set of kicks and punches that you perform in a pattern. Idea behind this is to
develop the pattern so thoroughly that, in emergencies you use technique to
save yourself effectively.
Similar to the karate, we use Kata in day to day
programming. What you actually do is, follow certain standards, styles on a day
to day basis so that you become thorough with this. Practice makes perfect. More
you practice more thorough you become with this. When you face a real life
problem, code automatically flows through you. And mind you, the code will be
of good quality.
In order to learn or use TDD, we make use of Kata. The
principle behind this is, you need to code the Test before coding the actual
production code. Firstly, you will write failing test (what scenarios my code
might fail) and then write the passing test (all success scenarios).
You start developing the test project. Gradually adding code
to the production project that makes this test pass. Eventually you will end up in the production
code which is perfect (well almost!). For example start with simple problems, for
instance, Stack. Every week you try to improve the Stack. You should delete the
previous week’s code and start afresh.
Using TDD in your day to day work improves efficiency and
makes the code more maintainable.
No comments:
Post a Comment