Programming Concepts





Step of Programming

 

The programming is the coding instruction codes to solve particular problems. If there is a problem, its solution is also available, but programmers have to follow some important steps to achieve objective of programming.

 

 

These steps are described below:

Steps of Programming

Steps of Programming


  • Problem Analysis: The problem analysis is the first and foremost steps of computer programming. If you have no any problem, you cannot concentrate your capability on programming work. If you have a problem, you engage you’re self in programming. The first thing is a analytical brain can help programmer to quickly understand problems and analyze problem for next step.
  • Outlining: If you have understood your problem, outline of solution is next important steps. The problem is divided into several modules or tasks and assigned to each programmer. The software industries are based on efficient system analyst, and competent programmers.
  • Algorithm: Algorithm is a step by step presentation of programming and its logic.
  • Coding: The coding is done by programmers. Before doing the coding, the programmer has to choose a computer language based on the following considerations:

(a) The nature of the problem.

(b) The programming language available on the computer.

(c) The facilities and limitations of the computer installation.

Generally, programmers choose general purpose programming languages. The specific type’s languages are used for specific types of software.

  • Debugging: The correction of inevitable error is called debugging.

 

Syntax, Semantics, bugs, debugging and program errors:

 

Syntax: The syntax is a rule that indicates about validity of programs. The program is a set of instructions that follow valid syntax rules. Generally, syntax is a valid program strings and it differs language to languages.

Example: data Type variable=value;

In this syntax, value is assigned to variable. The semi-colon (;), data type (int) and operator (=) are also part of syntax.

int x = 12;

 

Semantics: The rules that give meaning to programs are called the semantics of the programming languages. We can say syntax has specific output oriented meaning, which is called semantics.

Example:

(a) Sum = x + y: the semantics tells that sum of x and y is assigned to variable sum.

(b) S =u*t+1/2*t*t: It is a syntax which has two set of variables. In right set has ‘u’, ‘t’ and ‘a’ variables and left set has only one variable ‘s’. The semantics tells that right side has operators +, / and * working over variables. In first step, variables are multiplied (one set ‘u’ and ‘t’ and other set a, t and t), then 1 is divided by2*a*t*t and added to u * t, and sum is assigned to s.

Syntax is the rule programming grammar. So programming statement may be correct on the basis of Syntax, but it may be semantically wrong.

Bugs and Debugging: When we compile program, error messages are displayed due to syntax error, we debug (removing the bug or error is called debugging) program and program is executed without any erroneous message. It is a very common daily life event in software industries. When program is coded carefully, bugs are also crept very stealthily in the program. Some compilers are equipped with debugger to remove programming errors. These compilers diagnose errors and debug them carefully.

 

There are three types of errors in the program:

  • Syntax Error
  • Run time Error or Execution Error, and
  • Logical Errors

(a) Syntax Error: Syntax errors are result of avoidness of rules of program coding. These errors are occurred due to lack of concentration on language syntax. Some QBASIC experts learn C or C+ +, avoid semicolon at the end of statements or use crater (^) sign for exponential. These types of syntax errors are occurred due to transference of skill of one language into others and syntax errors are occurred.

Example:

Sn.

QBASIC

C/C++

1.

Sum=X + Y

It is a correct statement in QBASIC.

SUM = X +Y

This statement is correct in QBASIC, but incorrect in C/C++ due to avoidness of data type and semicolon. Its correct form is :

Int sum = x + y;

2.

If(age>=18) then

Print “Case Vote”

Print “OK”

End if

It is a correct QBASIC statement. In QBASIC, end if is used to close block.

If(age>=18) then

Printf “Case Vote”;

Printf “OK”;

Endif

In C/C++, then is not used. Printf() is a function, so parenthesis is not avaoiable. Instead od endif, braces are used. Its correct form is

If(age>=18)

{

Printf(“case vote”);

Printf(“ok”);

}

 

Some General causes of Syntax errors

  • Missing parenthesis or extra parenthesis causes syntax errors.
  • In some language (Pascal, C, C++, C#, JAVA), statements’ terminators are used. Missing terminators or extra terminators cause syntax errors.
  • Misspelled key words.
  • Extra blanks or missing blanks also cause syntax errors.
  • All type of operators is very sensitive to produce syntax errors, when not used properly.
  • The use of colon (:) instead of semi-colon (;) causes syntax errors.

The syntax errors are displayed at the time of program compilation because compilers and interpreters are equipped with error-diagnostic features. These errors are easily debugged from programs and some compilers check erroneous input and recover errors also. The 50 to 75% overall programming times are to be spent on debugging.

(b) Run-time Errors: The errors appeared at the time of program execution is called run-time errors. Compilers do not detect these types of errors because these types of errors are not appeared due to avoidness of syntax rules.

(c) Logical Errors: The incomplete logic codes produce logical errors in program. These type of errors provide incorrect output. The compiler and interpreter are unable to detect these type of errors:

Example:

x1=-b+sqrt(d)/(2*a);

x2=_b+sqrt(d)/(2*a);

Syntactically acceptable and would not cause any error message but produce wrong outputs.

 

Program Testing

The bugging and testing are quite different processes. In bugging, errors of programs are removed but in testing customers desire and intentions are measured through programs. It is a very sensitive phase of software development cycle. Program is tested again and again, modified again and again to satisfy a large numbers of users. It is a user-oriented process. So after several tests, software becomes a market’s product. There are many methods are available for program testing:

  • Unit Testing
  • Top-down Integration testing
  • Bottom -up Integration Testing
  • Regression Testing
  • Smoke Testing
  • Recovery Testing
  • Security Testing and
  • Stress testing

(1) Testing is a process to obtain absolutely correct program, but some errors crept into after a lot of care.

(2) Tested program is compared with the expected output when any discrepancy occurs, the program is checked.

(3) To test program, program is divided into self-contained modules and each module is checked.

(4) For program testing, we select a set of test-data and use these data to obtain output in varying environments.

Alpha testing and Beta testing: Alpha and beta testing is a last phases of testing done before lunching in the markets. Alpha testing produces alpha version of software and Beta testing produce beta version of software. Beta version software is fully tested and errorless software for sale in market.

Alpha testing:

  • Alpha testing is done in developer’s site, under supervision of developers
  • done by users in controlled environments
  • Errors and problems are recorded for modifications..

Beta testing:

  • Program is tested in one and more customers‘ site in the absence of developers
  • Errors and problems are recorded and informed to developers regularly.
  • Software engineers do modifications and software is ready for sale in market


Related posts:

  1. Procedural oriented programming Procedural oriented programming (pop):- A program in a procedural language...
  2. Programming Language Language is a medium of communication. There are several languages...
  3. Object oriented programming Object oriented programming : The main idea behind object oriented...
  4. Introduction to operating system Operating System: An operating system is a collection of system...
  5. BIOS The BIOS (Basic Input Output System) can be defined as...