Using Clear Instructions

As you know, computer does not have intelligence of its own; it simply follows the instructions given by the user. Instructions are the building blocks of a computer program, and hence a software. Giving clear instructions is crucial to building a successful program. As a programmer or software developer, you should get into the habit of writing clear instructions. Here are two ways to do that.

Clarity of Expressions

Expression in a program is a sequence of operators and operands to do an arithmetic or logical computation. Here are some examples of valid expressions −

  • Comparing two values
  • Defining a variable, object or class
  • Arithmetic calculations using one or more variables
  • Retrieving data from database
  • Updating values in database

Writing unambiguous expressions is a skill that must be developed by every programmer. Here are some points to be kept in mind while writing such expressions −

Unambiguous Result

Evaluation of the expression must give one clear cut result. For example, unary operators should be used with caution.


Avoid Complex Expressions

Do not try to achieve many things in a single expression. Break into two or more expressions the moment things start getting complicated.

Simplicity of Instructions

It’s not just for computers that you need to write clear instructions. Any one reading the program later (even you yourself!!) should be able to understand what the instruction is trying to achieve. It is very common for programmers not to get a hang of their own programs when they revisit it after some time has passed. This indicates that maintenance and modification of such programs would be quite difficult.

Writing simple instructions helps in avoiding this problem. Here are some tips to write simple instructions −

  • Avoid clever instructions − Clever instructions might not look that clever later if no one is able to understand it properly.

  • One instruction per task − Trying to do more than one thing at a time complicates instructions.

  • Use standards − Every language has its standards, follow them. Remember you are not working alone on the project; follow project standards and guidelines for coding.