How to write Good Code?


1.Don’t use numbers
if (students.age> 23) {
Here, do you know what is 23? How am I supposed to know what that is,  it is terrible ,so first create meaning full variable then use it like this
age= 23;
if (students.age> age) {
2.Use meaningful variable name.
If you write random name for the variable then its not good,you can’t understand that code after 10-15 Days.For example write String name=”John” instead of String s=”John” .
3.Follow Rule
There are lots of rules to give name to variables,methods and class.For examle in JAVA to create class First character of the class should in capital letter.
4.Write Comment
Code without comment is understand to hard.make sure you write proper comment and it should be understandable for other developers. Being a good developer doesn’t mean writing the cleverest code, it means being a good teammate. Quality software is rarely developed alone, eventually other people will need to read your code.
Thanks for reading.Do you know any other tips to write good code? write in comment and share your thought.

Comments

Popular Posts