Concepts of Programming Methodology
Programming is basically solving a particular problem by giving coded instructions to the computer. Furthermore, the whole scenario of programming cycle involves writing, testing, troubleshooting, debugging, and maintaining a computer program. Moreover, a good program should have clarity and simplicity of expressions, should make use of proper name of identifiers, contain comments, and have proper indentation.
Programming Process Cycle
The steps of programming are as follows:
This step involves writing the desired output of the code. besides, drawing a flowchart depicting all the steps from beginning to end. Then the programmer writes the first copy of the code on the programming software.
This step is about testing the code against the test cases. If the output is according to desired test cases, the code is correct.
After testing the program we perform the error correction in this step.
It is the process of finding the exact location of error in the code.
After all these steps the program is run to get the desired output.
Browse more Topics Under General Concepts of Programming Methodology
- Use of Proper Names for Identifiers
- Program Maintenance
- Running and Debugging Programs
- Syntax Errors
- Run-time Errors
- Logical Errors
What is an efficient program?
A program that gives the correct desired output for every input, including the wrong input is an efficient program. Moreover, it should produce correct results in less time and use less memory space. Besides, an efficient program should have clarity and simplicity of expressions, should make use of proper name of identifiers, contain comments, and have proper indentation. Here, we will study about clarity and simplicity of expressions in detail.
Clarity and simplicity of expressions
We know that, a computer simply follows the instructions of the programmer. Therefore, it becomes necessary to give clear instructions in the code for a successful program. There are basically two ways to give clear instructions namely, clarity and simplicity of expressions.
Clarity of expression
An expression is basically composed of operators and operands. It is a sequence of operators and operands which can perform arithmetic or logical operations. A valid expression can be as follows:
- defining a variable, object, or class.
- comparison of two values.
- arithmetic calculations of two or more values.
- retrieving or updating data in database.
Simplicity of instructions
It is important to write simple instructions notonly for the computer to understand. Besides, it should be easy for the programmer and other readers to understand the code. Therefore, this results in simplifying the task of modifying and maintaining the program in future.
To maintain clarity you can follow the steps as follows:
- Avoid such clever instructions so that people can understand the code.
- Do not try to include many tasks in a single instruction. Since this can complicate the instrcution.
- Follow the standards and guidelines of the programming languages.
Steps to maintain clarity and simplicity of expressions
Use library functions
The use of library functions makes the program powerful. Moreover, everyone can understand the standard functions easily.
Simplify the expressions
We should avoid writing complex expressions and siplyfy them as follows:
x = ( a + b ) / ( a – b ) – ( c + d ) / ( c – d )
x1 = ( a + b ) / ( a – b )
x2 = ( c + d ) / ( c – d )
x3 = x1 – x2
Avoid clever and tricky instructions
We should not use such tricks or clever instructions which the readers cannot understand.