Why team leaders, senior developers advises comments in C#

Amatya
Posted by in Best Practices category on for Beginner level | Points: 250 | Views : 505 red flag

Comments in coding plays a vital role when we work in a team or individual. Here in this article we will get to know why to use comments while coding and how its help us.

Introduction

Here in this article we will discuss about the benefits of comments in C#
 
Normally, when we were were fresher in IT industry, completing the task given to us by our seniors or deeds which we used to set to do in particular day or duration. So during the phase when we were coding the steps and methods output we and God know, but after some weeks or month that codes only God knows(Many developer have that story). Now when we use to see some of that codes our self don't know for what purpose we have written unless and until we do debug.

So to overcome this all problem comments comes in picture. Comments is basically use to put the work or operation which the line of code or method is doing.

Their are 3 types of comments in C#.We will discuss here about 
a) Single line comment(//) 
b) Multi Line comment(/*... */)

Why Comments

1. Understanding  - Basically when the coder codes for any task the team leader or senior developer does not reviews the whole code line by line, they just want to know that the given task is working or not(as they do not have much time to go through it), so if the coder comments at the lines of codes for which it has written it will be easy to understand that the particular line has logic and the particular line is focus of the particular task.

2. Effects in  Change request - When the change request comes for particular modules or functionality, then comments makes a vital role. Developer should have a practice of commenting the existing code and writing a new code which should have a meaningful comment i.e. why the change request is been done, and what the functionalities will be affected(This i realized when I did coding and after some change request came, and I was speechless because i forgotten the flow, and it took much time to recall it).

3. Helps everybody - Just imagine you are on leave for couple of week and some urgent requirement comes, so it will be very difficult for your team leader or your own colleagues to understand the flow and the modules if the proper comments is not their. so its a good practice to comment in your code snippet.

4. Good Practice - Its always a good practice to place comment in your code for better understanding. Moreover you can find the code easily which you have used for specific purpose. It happens many times with that We have written some code, that similar functionality when We want in other module We can get easily due to proper comment.


Conclusion

Hope you guys will get some points to remember that comments are also important part of coding.
We know its little bit difficult to put comments while you are coding as it distracts from the deeds to be done, but after finishing the code snippet we can give time for comments in our code

Senior team leaders, developer, mentors tips are welcome here, so we can get the tips and benefits for DNF member. Happy weekend.

Reference

A talk with my seniors software developer.

Page copy protected against web site content infringement by Copyscape

About the Author

Amatya
Full Name: Amatya Agyey
Member Level: Silver
Member Status: Member
Member Since: 5/9/2015 12:56:12 AM
Country: India
Feel free to share informations 9731764134 mail Id ' adityagupta200@gmail.com Thanks
http://www.dotnetfunda.com
Software Enginner

Login to vote for this post.

Comments or Responses

Posted by: Davidcyryl on: 5/31/2017 | Points: 25
Comments are very good for every website... because comments tells us how this page is valuable or not ? and more over that tells us about the worth of the products ... etc

http://www.webeidea.com/seo-services/
Posted by: Amatya on: 5/31/2017 | Points: 25
Correct dude Davidcyryl :)

Login to post response

Comment using Facebook(Author doesn't get notification)