Top 3 practices of Programmer for writing beautiful code

Writing code is an art.Any programmer can write the code that can understood by a computer but what makes the programmer unique is writing a code that can be understood by co-programmers.As a programmer I suggest in saying add style to code.Adding style to code brings you the great impression along with good feedback.Even when some one wants to scroll down your code ,he should not get feel of walking on thorns.Make him to think the output or result in his mind at the time of reading the code.

1.Comments

ornaments

Comments are ornaments.Ornaments add the beauty to the body and Comments add beauty to the code.They add some extra information or explanation which clears the doubt “why this is for?” or “what this is for?”. A small comment helps a lot like a small boat helping to cross a river. Too much of commenting in coding brings you the odd feel like waste around the dustbin. Commenting should be very concise ,clear,neat ,simple just like logo of company which has to be clean and simple but should be more explained one.

Commenting the code is great habit .Even when you come after a great time gap you can just read the comments for the complete figure of the code.Comments have a beautiful look,if you decorate the code in a precise way it looks awesome.To be a great comment writer you just should me more creative in that field.Try to add the comments no sooner you begin the new function or block of codes.

Tips for commenting code

  1. try to keep it in single line
  2. need not to be like full sentence.
  3. add some extra symbols on the either side of comment ex./*—>creates network <—*/.
  4. use special symbol notations for specific type of code .
  5. don’t waste your time in writing comments.

2.Nomenclature

namenclature

 

Giving name is nothing but giving identity.The definition of nomenclature is “the devising or choosing of names for things, especially in a science or other discipline.”The name should give the information of “what it will do?” to the one who is reading the code .Seeing the name of the variable one should understand what it has been coded  for.At the time of the requirement of variable he shouldn’t  look back for a variable name for how he declared it .Giving name is huge tough one in coding,if we haven’t fix certain format it will be more complicated when the lines of code  growing fast.Naming should not bring you the confusion while you use the variables or functions .Every conceptual topic should be their own unique names.

The identification is more important in the fields of searching and  using it in repeat.The nomenclature helps us in the situations of finding he ring in the middle of the ocean.Giving perfect names to perfect ones can save a lot of time in coding.Calling will be more easy in coding if you have some format in naming some kinda code.Naming with good names is boon for a programmer.The names should reflect the theme of the application.

Tips for Naming Variables and Functions

  1. never use single word names for variables.
  2. name should be neither short nor long.
  3. try add the prefix for the names.
  4. maintain the format through out the application.
  5. try to avoid using of reserved words.

3.Uniformity in coding

uniform

Uniformity adds rich look to code.Never add some extra spaces or tab spaces or line breaks in the middle of the code.That spaces even though they can’t be seen but they impact on the code beauty.The more the even,the more the beauty.Many of programmers have the habit of hitting the enter unnecessarily.Even some programmers hit the spaces at the end of the lines. If the code is even it brings the impression.We can find some programmers adding some extra enter hits after completion of the function definition,some times we see the programmers writing the code for declaring variables one line start with space at the beginning of the line code.Try to avoid the spaces at the beginning of the line even though it cause no error it creates the feel of something odd in the minds of other programmers reading the code.

We can see the school students with  wearing the uniform they looks more beautiful when they stand together .This also applies for coding lines too in program. When your code is more uniform it creates the picture in mind,and helps to read the more lines of code.

If I miss something in writing how the programmer can add the beauty to the coding means you just comment it let others know it.

 

 

Advertisements

any comment please?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s