Skip to main content

Introducrtion to Object-Oriented Programming


Article No: 1

The Beginning

The earliest computers were programmed in binary. Mechanical switches were used to load programs. With the advent of mass storage devices and larger and cheaper computer memories, the first high-level computer programming languages came into existence. With their arrival, instead of thinking in terms of bits and bytes, programmers could write a series of English like instructions that a compiler could translate into the binary language of computers.

These languages were simple in design and easy to use because programs at that time were primarily concerned with relatively simple tasks like calculations. As a result, programs were pretty short, limited to about a few hundred lines of source code.

As the computers capacity and capability increased, so also did the ability to develop more complex computer programs. However, the earlier programming languages were found wanting in performing the complex programming task.  These languages suffered from the following limitations:

1.      There were no facilities to reuse existing program code. Wherever the same piece of code was required, it was simply duplicated.
2.      The control was transferred via the dangerous goto statement. As a result, there was too much jumping around in the program, often without any clear indication of how, where and why the control is flowing.
3.      All variables in the program were global. Tracking down spurious changes in global data in long convoluted (complex) programs was a very tedious job.
4.      Writing, understanding and maintaining long programs became a programmer’s nightmare.


  Software Development

Ernest Tello, a well known writer in the field of artificial intelligence, compared the development of software technology to growth of a tree. Like a tree, software development has had different layers of growth. These layers were built up one by one over the last 50 years.

To build today’s difficult software it is not just to put together a sequence of programming statements and sets of procedures, but we need to include construction techniques and program structures that are easy to understand, implementable and can be modified.





     ML=Machine Language,                     AL=Assembly Language,
     PO=Procedure-oriented                     OOP=Object Oriented Programming

   Structured Programming
 
To overcome the limitations mentioned above in earlier period, a quest (long search) began to develop new languages with new features that would help to create more sophisticated (complex) applications. The breakthrough occurred in late 60’s and early 70’s with the introduction of structured programming. The long programs that the programmer found difficult to comprehend (understand) could now be broken down into smaller units of few hundred statements. Functions/subroutines/procedures were introduced in these languages to make the programs more comprehensible (understand) to their human creators. A program could now be divided into functions, with each function having a clearly defined purpose and a clearly defined interface to other functions in the program.

A structured program is built by breaking down the program’s primary purpose into smaller pieces that then become functions within the program. Each function can have its own data and logic. Information is passed between functions using parameters and functions can have local data that cannot be accessed outside the function’s scope.

By isolating processes within functions, a structured program minimizes the chance that one procedure will affect another. This also makes it easier to isolate problems, if any. Structured programming helps you to write cleaner code and maintain control over each function. There is less need of global variables, which are now replaced by local variables that have a smaller and more controllable scope. All this makes the development and maintenance of code fast as well as sufficient.

A new concept came into existence with structured programming abstraction. Abstraction permitted the programmer to look at something without being concerned with its internal details. In a structured program it is enough to know which task is performed by function. It does not matter to the programmer how the task is performed so long as the function does it reliably. This is called functional abstraction and is the corner stone of structured programming.

Structured programming ruled the roost for almost two decades. With the constant improvement in the hardware and increasingly more demands from the users for feature-rich programs, the complexity of programs increased multi-fold and that’s the time structured programming approach started showing signs of strain. This occurred because of the weakness in the procedural paradigm (pattern) itself. One of the key reasons for the failure of procedural languages was the role played by data.

In the procedural language, the whole emphasis is on doing things. Subdivision of a program into functions continued this emphasis. Functions do things just as single program statements do. What they do may be more complex, but the emphasis is still on doing. Data is given a second class status in the procedural paradigm even though data is the reason for program’s existence. For example, in a payroll processing application the important part is not the function which displays the data, or the function that checks for current input; the important is the payroll data itself.

In a structured program, data types are processed in many functions, and when changes occur in data types, modifications must be made at every location that acts on those data types within the program. This is a frustrating and time-consuming task for large-sized programs.

Another problem with structured programming is that its primary components-functions and data structures-don’t model the real world very well. For example, suppose you are writing a program to create the elements of a GUI (menus, windows) there are no obvious program elements to which a menu or a window corresponds. This is because the structured programming paradigm emphasizes on fitting a problem to the procedural approach of a language.

Characteristics

·         Emphasis is on doing things (procedures).
·         Large programs are divided into smaller programs known as functions.
·         Most of the functions share global data.
·         Data move openly around the system from function to function.
·         Functions transform data from one form to another.
·         Employs top-down approach in program design.

Dis-Advantages of Procedure Oriented Programming

·         Global data are more harmed due to change by function.
·         In a large program it is very difficult to identify what data is used by which function.
·         It does not model real world problems very well.

Compiled By: Chaudhary Amit V.

Comments

Popular posts from this blog

Characteristics of a Good Programming Language

Till now there are many high level languages which are very popular, and there are others, which could not become so popular in-spite of being very powerful. There might be many reasons for the success of a language, but one obvious reason is the characteristics of the language. Several characteristics believed to be important with respect to making a programming language good are briefly discussed below. Simplicity A good programming language must be simple and easy to learn and use. For example, BASIC is liked by many programmers only because of its simplicity. Thus, a good programming language should provide a programmer with a clear, simple and unified set of concepts which can be easily grasped. It is also easy to develop and implement a compiler or an interpreter for a programming language that is simple. However, the power needed for the language should not be sacrificed for simplicity. The overall simplicity of a programming language strongly affects the readability of the pr...

Angular 4 and Firebase Authentication: Email/Password

In our  previous  article we saw how to create authentication module using Google identity provider. Now we will see how to implement Email and Password authentication using Firebase. We will use Bootstrap form to create intuitive user interface for sign-up and login using Email and Password. Step 1: Create signUp component. ng generate component signUp Step 2: Create custom form in sign-up.component.html file. The result of above code: Step 3: Add two functions for creating the user and login using Email and Password in src/app/providers/AFAuth.ts file. Step 4: Call createUserWithEmailAndPassword function in service from sign-up.component.ts. Step 5: Update routing configuration in app.module.ts  to include signUp component. Step 6: Update Login form to have Bootstrap form. The result of the above code. Step 7: Enable Email/Password component in Firebas...

Angular 4 and Firebase Authentication: Setup

If you have come to this article, it means you are keen to learn new technology and that too Firebase. I love Firebase because it provides all basic but important features of any web application. Take for example, authentication, which is cumbersome and risky if not implemented with utmost care. And when we have the integration of Angular and Firebase, it becomes a lot easier for a developer to build such crucial modules in less time with minimal efforts. In this article we will create a simple Angular application using Firebase. I am going ahead with the understanding that you know the benefits of Firebase and have little knowledge about it. There are plenty of posts out on the web if you are behind. Step 1: Install Angular CLI (if not installed). npm install -g angular-cli Step 2: Create new Angular 4 project. By default now angular CLI will create Angular 4 project so you need not fret. ng new firebase-authentication Step 3: Check whether the ne...