5 Basic Concepts of any Programming Language

A computer program is a collection of instructions that performs a specific task when executed by a computer. A computer requires programs to function, and typically executes the program’s instructions in a central processing unit. computer science computer science computer science computer science computer science computer science computer science computer science computer science computer science computer science computer science

A computer program is usually written by a computer programmer in a programming language. From the program in its human-readable form of source code, a compiler can derive machine code—a form consisting of instructions that the computer can directly execute. Alternatively, a computer program may be executed with the aid of an interpreter.

The first programmable computers required the programmers to write explicit instructions to directly manipulate the hardware of the computer. This “machine language” was very tedious to write by hand since even simple tasks such as printing some output on the screen require 10 or 20 machine language commands. Machine language is often referred to as a “low level language” since the code directly manipulates the hardware of the computer.

By contrast, higher level languages such as “C”, C++, Pascal, Cobol, Fortran, ADA and Java are called “compiled languages”. In a compiled language, the programmer writes more general instructions and a compiler (a special piece of software) automatically translates these high level instructions into machine language. The machine language is then executed by the computer. A large portion of software in use today is programmed in this fashion.

There are two different models of programming-

  1. Structured programming– In this type, code is executed one after another. Control statements change which blocks of code are executed next. It is aimed at improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures, for and while loops
  2. Object oriented programming-It is based on the concept of “objects”, which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A feature of objects is that an object’s procedures can access and often modify the data fields of the object with which they are associated. There is no single “flow” of the program as objects can freely interact with one another by passing messages.

1. Program Structure

The overall form of a program, with particular emphasis on the individual components of the program and the interrelationships between these components. Programs are frequently referred to as either well-structured or poorly structured. With a well-structured program the division into components follows some recognized principle such as information hiding, and the interfaces between components are explicit and simple. By contrast, with a poorly structured program the division into components is largely arbitrary (or even non-existent), and interfaces are implicit and complex. At a finer level, a well-structured program employs appropriate data structures and program units with a single entry point and a single exit point, while a poorly structured program has arbitrary data structures and flow of control.

Virtually all structured programs share a similar overall pattern:

  • Statements to establish the start of the program
  • Variable declaration
  • Program statements (blocks of code)

This is the basic “hello world” example used in all programming languages.

Prev1 of 4Next

Leave a Reply

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