Saturday, January 2, 2010

How c++ language came into existence ?

Who created c++ programming language ?


Bjarne Stroustrup is the creator, inventor and developer of the widely used and popular c++ programming language. He was born on December 30, 1950 in Arhus, Denmark. He is a computer scientist. Stroustrup has a master's degree in mathematics and computer science (1975) from the University of Aarhus, Denmark, and a Ph.D. in computer science (1979) from the University of Cambridge, England. He was the head of AT&T Lab's Large-scale Programming Research department, from its creation until late 2002. He is currently Professor and holder of the College of Engineering Chair in Computer Science at the Texas A&M University.

Why Bjarne Stroustrup created c++ ?


Bjarne stroustrup designed and implemented c++ because he had some problems for which it was the right solution : He needed c-style access to hardware and simula-style program organization.
It turned out that many of his colleagues had similar needs. According to Bjarne Stroustrup, it was not even obvious that C would succeed. At the time, C was gaining a following, but many people still considered serious systems programming in anything but assembler adventurous and there were several languages that—like C—provided a way of writing portable systems programs. One of those others might have become dominant instead of C.

He created C++ in response to a real need. According Bjarne Stroustrup, the languages at the time didn't support abstraction for hard systems programming tasks in the way he needed it. He was trying to separate the functions of the Unix kernel so that they could run on different processors of a multi-processor or a cluster.

How did Bjarne Stroustrup created c++ programming language ?


After completing his studies at Cambridge in 1979, He went to the US to work as a researcher for AT&T Bell Labs in Murray Hill, New Jersey. There, He started a couple of projects related to distributed computing using local area networks. However, He wasn't making good progress because the available tools were inadequate for those projects. So, He developed something He called C with Classes to allow him to use Simula-style program organization (what is now-a-days called object-oriented programming) for simulations and close-to-the-hardware systems programming.

How to pronounce Bjarne Stroustrup ?


click here to download the wav file where Bjarne Stroustrup with his own voice pronounce his name.

What are features of c++ programming language ?


C++ is a general-purpose programming language with a bias towards systems programming that
* it is a better C
* it supports data abstraction
* it supports object-oriented programming
* it supports generic programming

It is defined by an ISO standard, offers stability over decades, and has a large and lively user community.

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off".
- Bjarne Stroustrup

Sunday, December 27, 2009

Object Oriented Programming Concepts

Let’s briefly examine a few of the major elements of object-oriented languages in general, and C++ in particular.

Objects


When you approach a programming problem in an object-oriented language, you no longer ask how the problem will be divided into functions, but how it will be divided into objects. Thinking in terms of objects, rather than functions, has a surprisingly helpful effect on how easily programs can be designed. This results from the close match between objects in the programming sense and objects in the real world.

What kinds of things become objects in object-oriented programs? The answer to this is limited only by your imagination, but here are some typical categories to start you thinking:

*Physical objects
Automobiles in a traffic-flow simulation
Electrical components in a circuit-design program
Countries in an economics model
Aircraft in an air traffic control system

*Elements of the computer-user environment
Windows
Menus
Graphics objects (lines, rectangles, circles)
The mouse, keyboard, disk drives, printer

*Data-storage constructs
Customized arrays
Stacks
Linked lists
Binary trees

*Human entities
Employees
Students
Customers
Salespeople

* Collections of data
An inventory
A personnel file
A dictionary
A table of the latitudes and longitudes of world cities

* User-defined data types
Time
Angles
Complex numbers
Points on the plane

* Components in computer games
Cars in an auto race
Positions in a board game (chess, checkers)
Animals in an ecological simulation
Opponents and friends in adventure games

The match between programming objects and real-world objects is the happy result of combining data and functions: The resulting objects offer a revolution in program design. No such close match between programming constructs and the items being modeled exists in a procedural language.

Classes


In OOP we say that objects are members of classes. What does this mean? Let’s look at an analogy. Almost all computer languages have built-in data types. For instance, a data type int, meaning integer, is predefined in C++
You can declare as many variables of type int as you need in your program:

int day;
int count;
int divisor;
int answer;

In a similar way, you can define many objects of the same class. Class serves as a plan, or blueprint. It specifies what data and what functions will be included in objects of that class. Defining the class doesn’t create any objects, just as the mere existence of data type intdoesn’t create any variables. A class is thus a description of a number of similar objects.

Encapsulation


When an engineer needs to add a resistor to the device she is creating, she doesn’t typically build a new one from scratch. She walks over to a bin of resistors, examines the colored bands that indicate the properties, and picks the one she needs. The resistor is a “black box” as far as the engineer is concerned—she doesn’t much care how it does its work, as long as it conforms to her specifications. She doesn’t need to look inside the box to use it in her design. The property of being a self-contained unit is called encapsulation. With encapsulation, you can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. Similarly, when the engineer uses the resistor, she need not know anything about the internal state of the resistor. All the properties of the resistor are encapsulated in the resistor object; they are not spread out through the circuitry. It is not necessary to understand how the resistor works to use it effectively. Its workings are hidden inside the resistor’s casing.
C++ supports encapsulation through the creation of user-defined types, called classes. The actual inner workings of the class can be hidden. Users of a well-defined class do not need to know how the class works; they just need to know how to use it.

Inheritance and Reuse


When the engineers at Acme Motors want to build a new car, they have two choices: They can start from scratch, or they can modify an existing model called Star. Perhaps their Star model is nearly perfect, but they want to add a turbocharger and a six-speed transmission. The chief engineer prefers not to start from the ground up, but rather to say, “Let’s build another Star, but let’s add these additional capabilities. We’ll call the new model a Quasar.” A Quasar is a kind of Star, but a specialized one with new features.

C++ supports inheritance. With inheritance, you can declare a new type that is an extension of an existing type. This new subclass is said to derive from the existing type and is sometimes called a derived type. If the Quasar is derived from the Star and, thus, inherits all the Star’s qualities, the engineers can add to them or modify those qualities as needed.

Polymorphism


A new Quasar might respond differently than a Star does when you press down on the accelerator. The Quasar might engage fuel injection and a turbocharger, whereas the Star simply lets gasoline into its carburetor. A user, however, does not have to know about these differences. He can just floor it, and the right thing happens, depending on which car he’s driving.

C++ supports the idea that different objects can be treated similarly and still do the right thing through what is called function polymorphism and class polymorphism. Poly means many, and morph means form. Polymorphism refers to the same name taking many forms.

Subscribe Via Email

Enter your email address:

Delivered by FeedBurner