Characteristics of good programming

What is a Good Program and what are the Characteristics of good programming?

A Good Program means that it should produce correct and faster results, taking into account all the memory constraints. While making good programs, we need to follow certain guidelines of programming language for creating a successful program. The following is the list of good programming habits that one should keep in mind while writing:

1) Clarity and Simplicity of Expression
2) Use of proper names for identifiers
3) Comments
4) Indentation

Let’s Discuss One By One:

1) Clarity and Simplicity of Expression:

Expressions are use to implement a particular task. It is a combination of Operators, Operands, and Constants. Any expression used in the program should be understood by the user. Example.

  1. Use library functions to make programs more powerful
    Example:
    To find output = x6
    Output = X *X * X * X * X * X
    Instead of writing the above line we can use library function and can make it shorter.
    We can use output = power (X, 6)
  2. Follow simplicity to maintain the clarity of expression
    Example:
    X = A+B/A-B – U +VY/X+Y
    We may simplify the above expression and write:
    X1 = (A+B) / (A-B)
    X2 = (U+V*Y) / (X +Y)
    X = X1 –X2
  • Avoid program tricks usage, whose meaning is difficult to understand by the user.

2) Use of proper names for identifiers :

Identifiers are user defined names. They are use to name things. A name is associated with a function or data object (constants and variables) and used to refer to that function or data object. Identifiers are made up of letters (A-Z, a-z), digits (0-9), and the underscore character ( _ ). They, however, must begin with a letter or underscore and not with a digit.

  1. Give meaningful names for variables (data – object) and function.
    Example:
    To calculate Area of a Square:
    We use the variable names are Area and Side
    Area = Side * Side.
  2. Use proper names for constants.
    Example:
    ¶ = 3.14
    Give Pi = 3.14
    Do not use the same name like custom, customer or account, accountant.
    Do not use one letter identifiers.

3) Comments :

They are usually added with the purpose of making the source code easy to understand. Hence, add comments to your code in simple English language that describes the function of the code and the reason for your decision to do it in a particular way as well.
They are generally categorized as either “block comment‟ or „line comment‟. Block comment is implemented in python by “”” and “”” and line comment is implemented by #.
Example:
“Write a program to print all numbers from 1 to 100 using while loop in python” .
A=1
while (a<100): # While statement print a
a = a+1

4) Indentation:

Leading white space (spaces and tabs) at the beginning of each statement, which is used to determine the group of statements, is known as “indentation‟.
Example:
If A > B :
         print „A is Big‟ # Block1
else:
          print „B is Big‟ # Block2
 If the “if‟ expression evaluates to true, then Block1 is executed, otherwise, it executes Block2.

Characteristics of good programming :

The quality of the program depends upon the instructions given to it. However, it is required to provide the proper and correct instructions to the computer in order to provide a correct and desired output. Hence, a program should be developed to ensure the proper functionality of the computer and also should be easy to understand. A computer program should have some important characteristics, which are as follows :

1) Flexibility
2) User  Friendly
3) Portability
4) Reliability
5) Self-Documenting Code

Let’s discuss the Characteristics of good programming one by one :

1) Flexibility:

A program should be flexible enough to handle most of the changes without having to rewrite the entire program. For example, CAD (Computer-Aided Design) software is use for different purposes such as; engineering drafting, printing circuit board layout, and design, architectural design, technical drawing, industrial art, etc.

2) User  Friendly:

A program that can be easily understood by a beginner is called „user friendly‟. It must interact with the user through understandable messages. In addition, the proper message for the user to input data and to display the result, besides making the program easily understandable and modifiable.

3) Portability:

Portability refers to the ability of an application to run on different platforms (operating systems) with or without minimal changes. Since the change of platform is a common phenomenon nowadays, due to the developments in hardware and the software, portability has to be taken care of it.

High language programs are often more portable than assembly language programs.

4) Reliability:

It is the ability of a program to do its intended function accurately even if there are even small changes in the computer system.
Moreover, the program must be able to handle unexpected situations like wrong input or no input.
For example, if the user does/gives wrong information to input, it should display a proper error message.

5) Self-Documenting Code:

The source code, which uses a suitable name for the identifiers (variables and methods), is called the self-documenting code.
Also, giving a proper name for variables and methods would tell the reader of your code clearly -what is it doing? Hence, a good program must have a self-documenting code.

For more detail on the above topic ” Characteristics of good programming ” you may also write to us @ [email protected]

To check about an earlier topic on Python click below:

https://www.soluversity.in/what-is-python-and-why-so-popular
” https://www.soluversity.in/frameworks-available-for-developing-various-types-of-application-in-python
 “

Sources : www.python.org

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *