Programming Basics

If you are just beginning to learn programming, you should begin with programming basics. Why is that? Basic programming principles help to understand the logical structure of the program. Once you understand the flow of execution of the program, you will be able to devise your own solutions.

Let us begin with the most basic question here:

What is a program?

A program is a series of instructions for the computer to execute, written in a specific language.

Any language that the computer understands, forms a programming language? No. There are different types of coding language. Not all such languages can be termed as a programming language. For example, HTML and XML are Mark up languages. They do not constitute of programming principles.

There are different types of programming languages such as:

  • Scripting
  • Procedural
  • Functional
  • Object Oriented

They all have a few basic principles in common. These are:

  • Sequence
  • Selection
  • Iteration

Let us understand these principles individually in terms of programming.

What is a program with reference to Sequence?

A program is a sequence of events written in a specific computer language, which triggers sequentially.

What is a program with reference to selection?

A program is a combination of various solutions pertaining to a situation, which is selected intelligently based on data provided.

What is a program with reference to iteration?

A program is a combination of statements which are recursive in nature based on some conditional checks.

 

These are the three basic programming principles, which apply to all programming languages.

Sequence means the lines of code will be executed sequentially. The compiler is used to compile program and then it is interpreted line by line (depending on the fact if the programming languages is both, compiled and interpreted.). These lines of code could be independent code sects or could be a reference to another method within or outside the same program.

Sequence

In structured programming, the flow of execution is from top to bottom, in reference to lines to code. In procedural programming, the flow is from top to bottom in reference to procedures. Main factors defining flow of code are:

  • Code sections
  • Functions/Methods
  • Objects reference

 

Selection means selecting a piece of data from the program on the basis of a logically verified criterion. There are different conditional constructs which are used to select some code or data. Majorly, there are three different conditional constructs widely used.

  • If, If-Else, If-Elseif-Else
  • Switch
  • Ternary operator

conditional constructs

Iteration is the feature of continuously repeating a finite number of steps till the condition is logically satisfied. It is also known as looping. Iteration

Three different types of loops include:

  • While
  • Do While
  • For

 

It is essential to understand these programming fundamentals for an easy sailing through the software development process.

Computer languages have evolved over the years and while mentioning the chronicle, it is often said that B led to C, C led to C++ and eventually, C++ led to Java.

The foundation for C language was a pressing need to have a structured high-level language. What is a structured programming language? A structured programming language is where different functions of the program can be identified and worked upon without getting tangled. Prior to structured programming, GOTO statements were intensively used which led to a lot of jumps within the code.   The advent of structured programming synthesized the conflicting features arising from previous programming languages.

Increasing complexity in the programs led to a quantum leap in advanced programming languages. As the size of the programming project increased, the complexity multiplied. This increase in complexity gave birth to a new way of programming, OOP i.e. Object Oriented Programming. OOPs basically allow the programmer to concentrate on parts of the program in isolation. OOPs helps organize programs using the features inheritance, encapsulation, and polymorphism. It helped in segregating the code basis variety of needs. A balanced program would have modules with high cohesion and less of coupling amongst each other.

C++ was the language which implemented the features of OOPs which helped reduce program complexity.  C++ as a programming language inherited all the features of structured programming from C. It is advancement over the existing language, thus it is called C++.

With the rise of Internet, reaching critical mass and implementation of technology into every sphere of life required yet another innovation in the programming language realm. The primary need of the hour was the development of architecture neutral software. Java was developed to serve the purpose and hence turned out to be platform independent language. Java was developed with a view to working on CPU independent platform. C and C++ require full stack compiler for a specific CPU to execute a program. Compilers are expensive and time consuming to be built to cater to a variety of CPUs.  The platform independent feature of Java language which implies ‘write once run anywhere’ is responsible for the widespread use of the language. Once the program is compiled using the Java compiler, the intermediate product from source code i.e. the bytecode can be interpreted on machines individually which contain only the interpreter. Thus, the need to execute the program on the same architecture as was developed on is eliminated. Software developed using Java could be used in electronic devices such as microwave, remote controls, washing machines, smartphones.

At present Android application development derives its fundamental features from Java language.  Although the android development suite is user-friendly, it comes in handy to have a prior knowledge of Java before beginning to learn android application development.

These were the programming basics for beginners to understand the foundations of programming.

Leave a Comment