When you can code, why not make it better?

There are certain rules which need not be necessarily followed by a developer, but it is definitely good and makes a difference if followed. My experience speaks out few of such things. This is useful especially for beginners. 

1) Naming convention. This aspect of coding might seem trivial, but it's significant. We should always keep in mind that there are many others getting their hands dirty on the same code base. So, it's important for everyone to understand that giving proper names to classes, functions, variables etc., would bring in more meaning and understanding to the code. 

2) Code standards. Make it a habit to follow the coding standards. When we look at the underlying architecture of any framework, we observe that all those who developed it have strictly followed the standards defined. This might not be practised in your current project, but you can always initiate and put it in use!

3) Code linting. A piece of code that you developed might be very optimized, logical and named properly. But, if it's not formatted properly, it might not look appealing (to read/change). It's important to lint the code while development. The code should not only be machine readable but also human readable. 

4) Code comments. Many of us might modify the existing piece of code. It would be better to add comments (with a date stamp/relevant ticket # if possible) wherever necessary and applicable. In that way, other developers would be aware of the reason for modifying. 

5) Code refactoring. We might sometimes encounter our old code and realize that it can be written in a single line instead of 2-3 lines. You can work on refactoring that piece of code but at the same time make sure that it's not impacting the current behavior/functionalities. Refactoring can be marked as a secondary goal while developing something. 

6) Code exceptions. It's really important to include exception handling in the application. We get to know more about it with practice. It's a good start to include exception handling wherever applicable. 

7) Code review. I personally feel peer review would help us to improve ourselves. 

8) Code coverage. Given a problem statement, it's important to think not just about the implementation but also on impact. Think about all positive and negative scenarios, communicate if necessary and start development. 

9) It's common for us to look upon Stack Overflow or any other site when we are stuck with a problem. It's a good practice to post your ideas/solutions in such sites. Two reasons : One - You are helping out someone who has got a similar issue. Two - You can always go back and see what the problem was and what the solution is. 

10) Learn from other's code. There are many people who write beautiful code. Such persons can exist in your own team. You can have a look at their code, understand and see how you can improve your code with their suggestions. 

10) Big or small, keep learning! 

11) Code errors. It's ok to fail too. Nobody does it on purpose. After all, we learn from our mistakes and that's how we grow. 

12) Last but not the least - Coding or cooking, you should make the best use of resources so that you don't fall short of them and also the people around you. 

Stay with a calm mind and you will find the solution. These are not completely my words. I got to know about these while working and while talking to co-developers. Hope it's useful. Thanks for reading. :)  #devnotes #knowledgesharing #codingtips


要查看或添加评论,请登录

社区洞察

其他会员也浏览了