Clean Your Code

Clean Your CodeCoding can be fun if you like problem solving and just like problem solving, everyone has their own approach to coding. In a positive light, this diversity leads to better and innovative code emerging. In a negative light, it leads to all sorts of haphazard coding. It is the latter that concerns us here in this article. Putting in good practices when you code is very important, especially if you are working as part of a group. This means that at some point, someone else will look at your code and analyze it. This may be due to an effort to optimize it or to debug it or even to check if it is doing what it is supposed to do. Whichever the reason, it is your duty to make the code readable to anyone who wants to take a look at it.Commenting on code is an essential part of good coding.

It allows anyone to understand at a glance what the following code is supposed to do. Documenting classes and functions is also another practice that lends a lot of value to a piece of code.Giving your functions, classes and variables meaningful names will make your code very user/coder friendly. Indenting your code is another practice that makes reading it very easy. It helps to identify blocks of code which could look quite complicated otherwise. One more thing you can do is to use braces to denote where a loop begins and ends. This helps debuggers a great deal when it comes to figuring out complicated code.When fixing a bug, try not to delete code. If you identify a section of code that is causing trouble, just comment it out. That way you can always come back to it and use parts of it, if the new fix caused trouble elsewhere in the code.