INTRODUCTION OF C++

INTRODUCTION OF C++

C ++ is an object oriented programming language that allows programmers to build large and complex applications in a useful and efficient way.  It enables programmers to improve the quality of code produced, thus making reusable code easier to write.  C ++ is one of the universal language that is used by programmers around the world.  It is used for making real world applications.  It is the key to increase productivity and improve reliability for making complex applications.  It is a flexible language that helps the programmer to write the bug free programs which are easier to maintain.

  HISTORY of C ++ 

C ++ was developed by Bjarne Stroustrup at AT & T Bell Laboratories in Muarry Hill, New Jersy (USA) in 1983. The version 1.0 of C ++ became commercially available in 1983, version 2.0 in 1989 and version  3.0 in 1992. Before the evolution of Object oriented language C ++, many other object oriented languages ​​existed.  One of the earliest Object Oriented languages ​​that existed was Simula 67 which was developed in Norway in 1968. The Object Oriented Languages ​​which existed before C ++ were slow and inefficient.
   So, Bjarne Stroustrap who was a great admirer and master of C and SIMULA 67 combined the features of both the languages ​​into more powerful language that could support the concepts of object oriented programming and still could retain the features of C.  SIMULA 67 and C resulted in the development of a new language called C with Classes by Bjarne Stroustrup in 1979. C with Classes lacked some Object Oriented features like operator overloading, virtual functions, references etc.  Therefore later on some ideas were borrowed from ALGOL 68 (Algorithmic Language) programming language which were then combined with language C with classes that resulted in the formation of Object Oriented language, C ++.  The Fig.  1.1 shows the evolution of C ++ from various languages.

The name C ++ is credited to Rick Mascitti who suggested this name and was first used in 1983.
The name signifies the evolutionary nature of the changes from C. It is named C ++ not C + or ++ C because C + has been used as the name of an earlier unrelated language and C ++ is more commonly used than ++  C.
Moreover, the language is not called uage because it is an extension of C language as in addition to existing features of C language, new features were added to remove the existing problems.  So it was named as C ++.

Evolution of Object Oriented Programming Approach: 

The Object Oriented Programming approach is now a days the most commonly used approach for designing large and complex real world applications.  Before the evolution of this approach, many programming approaches existed which had many shortcomings that led to the development of the Object Oriented Programming approach.
Programming approaches have been passing through revolutionary phases just like computer hardwares.  Initially for designing small and simple programs, the machine level language was being used.  Next came the assembly language which was used for writing larger programs comparatively.  Both these approaches were machine dependent.  Next came the development of Procedural Programming approach that enabled us to write large programs that contained several hundred lines of code.  Then in 1970, a new programming approach called structured programming approach was developed for designing medium sized applications.  The eighties saw that the size of applications kept on increasing and with more developers working on the same applications, there was a need of paradigm shift in the programming approaches.  As the previous approaches failed in designing such large and complex applications and to allow more complex programs to be written, a new approach known as Object Oriented approach was invented.  Object oriented programming approach can be defined as a way by which a computer program is designed and written around objects.

The various categories of programming approaches are classified as follows:
a) Monolithic Programming Approach
b) Procedural Programming Approach
c) Structured Programming Approach
d) Object Oriented Programming Approach
In Monolithic Programming approach, the program consists of sequence of statements that modify data which is global  throughout the whole program.  The program control is achieved through the use of jumps (i.e. goto statements) and code is duplicated each time as there is no support for the function.  This duplication of code is the main disadvantage of this approach.  More over, data is not fully protected as it can be accessed from any part of the program.  So this methodology is useful for developing simple and small programs.  The Programming languages ​​like ASSEMBLY and BASIC follow this approach.
Monolithic programming approach

Procedural Programming approach is a top down approach in which a program is divided into functions that perform a specific task and also provide a clearly defined interface to other functions in the program.  Data is global and all the functions can access the global data.  In this approach, emphasis is laid more on function rather than data.  Program flow control is achieved through the use of jumps (GOTO statements) and function calls.  This approach avoids the repetition of code which is the main drawback of the monolithic programming.  The basic drawback of procedural programming approach is that data is not secured as it can be accessible by all the functions.  This approach is mainly used for medium sized applications.  But while developing large programs, a mass of tangled jumps and conditinal branching made the program virtually impossible to understand and consumed a lot of development time.  The programming languages ​​like FORTRAN and COBOL follow this approach.
Procedural programming approach

In structured programming approach, a program is divided into functions and modules. Each module has a set of related functions. The use of modules and functions makes the program more comprehensible. It  helps to write cleaner code and maintain control over each function. It also introduce the concept of user-defined data type and support modular programming. This approach emphasize more on functions rather than data.  It focuses on the development of large software applications in which different parts of the application are developed independently.  The programming languages ​​PASCAL and C follow this approach.  With the improvement in the hardware and increased demand for designing very large and complex applications, some problems like maintenance and understanding complex code developed with this approach.

DRAWBACKS OF CONVENTIONAL PROGRAMMING:

The traditional programming (structured or procedural approach is a top down approach that starts by first finding all the things that needs to be done and then decompose each task into smaller tasks using functions. Each function can have its own data and logic  and call other functions of the program. In many programs, important data declared as global which can be accessible by all the functions. This approach is mainly used for making medium sized applications but many problems arise when developing complex applications using this approach.


The conventional approach when used for making large and complex applications can lead to the following drawbacks.
1. Unauthorized access to data: As data is global so unauthorized functions can manipulate this data accidently and thus make it inconsistent.  Hence, security to data is not provided.
For example: To calculate the fine of a particular student, the account office needs the attendance data from the General office.  Since data is global so finel) function can corrupt data of general office by mistake which can lead to serious problems for general office.
2. More emphasis on function rather than data: In this approach, more stress is given to a function that performs some specific task and not to the data which is given a second class status even though data is reason for program's existence.  For example: During the automation of various departments of the college, we are more concerned about the various functions performed by each department rather than the security and integrity of the Global data.
3. Non real world modeling: The arrangement of separate data and functions does not model the real world very well.  In other words, the way the problem is solved using this approach is not close to reality.  For example - If account office want to access data from the general office then it can be accessed directly as data is global which represent a poor real world model.  But in real world, if one department want to access information from some other department it has to follow a proper channel (sending memo and receiving acknowledgment).
4. A large complex application makes the program difficult to modify because whenever a change occurs in the global datatypes, we need to check all the functions in the program that may access that global datatype and rewrite all the functions accessing that data type which is very  tedious, costly and time consuming process.
5. The procedural programming give more emphasis on how to solve a problem rather than what to do.  In other words, the traditional programming concern primarily with the implementation of the program i.e.  the steps that compose each function and particulars of the data to be operated upon.
6. Data passes globally from one function to another function.

OBJECT ORIENTED PROGRAMMING APPROACH:

The Object Oriented Programming approach came into existence to remove some of the flaws encountered in the traditional programming approach for designing large and complex programs.  Unlike the traditional programming approach, the object oriented approach lays more emphasis on data rather than functions and does not allow data to be accessed freely in the system.  The term object oriented programming was originally coined by Xerox PARC to designate a computer application that describes the methodology of using objects as the foundation for computation.  The use of object oriented programming speeds up the program development process, improves maintenance and enhances reusability of programs.
The basic principle of the objective oriented programming approach is to combine both data and functions that operate on that data into a single unit.  Such a unit is called an object.  The only way to access the data of an object is by its functions.  This secures data from any accidential modification from the outside function.


No comments

Powered by Blogger.