Saturday 23 February 2013

Improve your Programming Skills.

Follow Naming Conventions

The naming conventions are guidelines that focus on the program's physical structure and appearance. They make the code easier to read, understand and maintain.

As you know that variables, constants etc. make an important part of a application be it made in any programming language like VB, Ruby, JavaScript, Java etc. you must follow naming conventions while naming them. 

Most common guideline that you get is objects should be named with consistent prefix that makes it easy to identify the type of object. 



Ensure Clarity of Expressions

Expressions carry out the specified actions. Thus they must be clearly understood by the users. There should not be any compromise with the clarity of Expressions.

a) Avoid programming skills/tricks whose intent is not clear to the reader.

b) Never sacrifice clarity of expressions even if changed  code.

Use Commands and Indentation  

Comments play a very important role as they provide internal documentation of a program. Indentation makes the statements clear and readable. Sometimes, comments and indentation are not used to save on program writing time , but remember there should not be any compromise on readability and understandability. Comments are described in different ways in different languages.

a) Insert explanatory comments wherever applicable since they explain  the role and purpose of the other identifiers, variables, constants and statements.

b) Use comments to help identify programming constructs  (such as If...End If, Select.....End Select, Loops etc. ) greatly enhance program understanding.

c) Always indent statements to highlight nesting of groups of control statements.

 Insert Blank Lines and White Spaces

VB script learn
The insertion of blank lines and blank spaces at appropriate spaces also enhance the program readability. The blank lines are inserted to separate declaration blocks, comment, boxes and procedures. Normally, blank lines are inserted before labels, variables declaration.

Though formatting style does not make a difference  for the compiler but the reader face difficulty in understanding the program. Therefore, use of free formatting should be avoided and indentation and blank lines, spaces will be used while writing a program.      

"When program formatting is done to make a program more readable , it is called Prettyprinting.

No comments :

Post a Comment