, Research Paper
History of C++: Origins and Examples
Essay written by DaMonMayers
Origins of C++
What are C++ and OOP?
C++ is an advanced, high-level programming language (“Computer languages”) that is used to develop powerful applications for Microsoft? Windows?, many Linux environments, and other well-known and widely used operating systems. C++ is quickly becoming the standard language for commercial software development (Oualline).
OOP, an abbreviation for object-oriented programming is simply code that “attempts to place a new layer of abstraction between the programmer and the data he is working with … this layer will help the programmer develop better code more quickly than he could do before.” (McHale). OOP languages must include four fundamental concepts before it may reasonably be defined as object-oriented (O-O): encapsulation, polymorphism, inheritance and the ability to be dynamic (McHale).
Where did C++ come from?
C++ was designed and implemented by Bjarne Stroustrup who works for AT&T Bell Labs as head of the Large-Scale Program Research department where he is heavily involved with the evolution of his product (Duffy, 98). His development, originally called “C with classes” was a marriage between a language called Simula67 with object-orientated features and C, which was powerful and efficient in its design.
Fortran
John Backus at IBM developed Fortran in 1956. Fortran, an abbreviation and acronym for FORmula TRANslation system, is generally considered to be the first high-level programming language. Fortran is, even today, a language of choice among programmers, its latest release, Fortran 90, in 1990. Early versions of this language would be largely criticized today [there were a few problems like the program layout, which had to obey certain criteria like an 80 character maximum line (the length “of a punch card on which the programs were often written”) (Parsons) and the first six columns were reserved for labels and comments, denoted by the keyword C]; however, this language influenced every language used today in the programming community in some way. A sample Fortran program would look like this (the digits 1, 2, and 3 in this program are labels and .GT. signifies a comparison checking to see if the variable, H, is Greater Than 5):
C EXAMPLE FORTRAN CODE
DIMENSION A(5), B(5,2)
INTEGER H
DO 1 I = 1,5
1 A(I) = 6 – I
H = 1
3 IF (H.GT.5) GO TO 2
B(H,1) = 1
B(H,2) = 5 + 3 * (H – A(H) )
H = H + 1
GO TO 3
2 STOP
END
(Parsons)
ALGOL
Algol, short for ALGOrithmic Language, is perhaps the most influential programming language ever created. The first implementation arose in 1958 and quickly became the standard for expressing algorithms. Algol was most widely used in the academic community, which thusly led to its widespread usage.
P: begin
integer h, i;
real array A[1:5], B[1:5, 1:2];
for i := 1 step 1 until 5 do
A[I] := 6 – i;
h := 1
Loop: if h *= 5 then
begin
B[h,1] := 1;
B[h,2] := 5 + 3 * (h – A[h]);
h := h + 1;
go to Loop
end
end P
(Parsons)
The similarity between such modern languages as Pascal and Modula-2 and Algol proves it influential to the programming community, even today. Algol also introduced the concept of “free-format,” a concept that allows programmers to arrange the code any way they want (assuming the syntax is correct) (Parsons). This concept proves itself useful today in making source code easier to read and eliminating the problem of “spaghetti code” (code written in an unreadable fashion, or strung together as spaghetti is).
Simula67
Simula67 was developed by the Norwegian armed forces (Kristen Nygaard and Ole-Johan Dahl at the Norwegian Computer Center) and was the first of its kind to use classes (as class is defined by “a program unit containing both data and associated functions”) (Overland, 3). Its development was initiated between 1961 and 1967. SIMULA I, appearing first in 1964, was designed as a system simulation and modeling language. It would consider each part of a system as a separate entity and allowed for interaction between separate entities. This language was based upon Algol and shares Algol’s “free-format” syntax (Parsons). Stroustrup considered Simula67 “the first real object-oriented programming language” but felt that it was “too slow” (Duffy, 98). Simula67’s source looks similar to that of C, a sample program looks like:
system Airport Departure := arrivals, counter, fee collector, control, lobby;
customer passenger (fee paid) [500];
Boolean fee paid;
:
:
station counter;
begin accept (passenger) select;
(first) if none: (exit);
hold (normal (2, 0.2));
route (passenger) to:
(if fee paid then control else fee controller)
end
:
:
(Parsons)
C
C, a language developed by Bell Labs to write operating systems (Stroustrup), was not designed to be object-oriented (McHale). Though it is possible to add object-oriented design to C programs, the implementation is hard and C was originally intended to be a “flexible language” that would be “adaptable to a wide range of systems” (McHale). C was chosen as the base language for C++ because it is “versatile, terse, and relatively low-level; is adequate for most systems programming tasks; runs everywhere on everything; and fits into the UNIX programming environment” (Stroustrup, 15).
Stroustrup began C++ in 1978 as a project writing a “simulator for described computer systems” for his Ph.D. at the Computing Laboratory at Cambridge. He believed that Simula67’s use of classes was a “perfect description” of networked machines. His only problem with Simula67 was that it was too slow for the large-scale systems programming with which he was involved. Hence, C++ was born: “a C language with classes and … Simula67’s stronger sense of data types.” His language, though still quite similar to his original idea, has been through quite a few changes before being standardized (Overland, 3) by the International Standards Organization (ISO), American National Standards Institute (ANSI), the British Standards Institute (BSI), and the Deutsches Institut f?r Normung (DIN, or the German national standards organization) (Stroustrup).
Other Influences
Ada and Clu were major inspirations for C++ templates; its exception handling mechanisms were also profoundly influenced by Ada and Clu as well as the programming language, ML.
Ada was a project started in 1975 by the US DoD (United Stated Department of Defense) and was used for implementing systems ordered by the DoD. The language was formalized officially near the end of 1980 and is currently used by NATO and the US DoD for implementation projects for implementation projects. The latest implementation, Ada95 (released in 1995) supports object orientation. Ada was named for Ada, Countess of Lovelace, who was the first programmer – she programmed Babbage’s Difference Engine.
Barbara Liskov et al at the Massachusetts Institute of Technology developed Clu in 1974 – 1975. It is an object-oriented language in the Pascal family that is designed to support “data abstraction” (Johnson) – similar to the language Alphard. Clu, short for CLUster, introduced the concept of the index, or iterator in a “for” loop (a loop is a procedure that performs a set of tasks while a test returns true) (Johnson).
The standardized language of ML is a functional programming language meaning that “the full power of mathematical functions is present.” ML is an acronym for Meta Language and is significant in that the term “meta language” is used to describe a language in which others are “discussed or analyzed” (“The Standard ML Programming Language”). The language was originally implemented to find and perform proofs and is prominent in the “computer-assisted reasoning” programming fields (“The Standard ML Programming Language”).
Early C++
“C with Classes,” released in 1980, lacked many common modern C++ features such as operator overloading [“overloading” means reusing a name, “Operator overloading … allows you to create types that look like true extensions to the C++ language” (Overland, 13)], references [an operator indicating that one variable is to be used “in reference” or as an alias for another variable (Overland, 142)], virtual functions [a virtual function is a function who’s address is not fixed until run-time (Overland, 536). This means that it does not take memory until it is needed, this is useful for things like “pop-up” messages in Windows?, for example (Overland, 537)], templates [“a C++ technique for generating type and function code” - this essentially means you only have to write declarations for link-listed code one time (Overland, 507)], exceptions (errors in the program), and many other details. Many revisions and additions were added – specifically the ones abovementioned before C++ was made commercial – before it was standardized. C++ was first used commercially sometime in July of 1983 (Stroustrup, 10).
Why was C++ written?
C++ was written to be a simple programming language keeping compatibility with C. Stroustrup’s primary reasons being
So that my friends and I would not have to program in assembler, C, or various modern high-level languages … Its main purpose was to make writing good programs easier and more pleasant for the individual programmer … It was originally invented because I wanted to write some event driven simulations for which Simula67 would have been ideal, except for efficiency considerations. (10 – 11)
Why is it called C++?
Rick Mascitti coined the name C++ in the summer of 1983. This name is in reference to the “evolutionary nature of the changes from C.” The “++” is an operator in both C and C++; it is the increment operator (Stroustrup, 10) (i.e. if you have an integer i and you wanted to add 1 to its value, you could say “i++;”). The name is not “C+” as it is both a syntax error in the language of C and is the name of a completely unrelated language [there were at last count around 4000 different languages (Parsons)]. The “++” operator can also be used before the integer (“++i;”) – this increments i before any testing is done – “Connoisseurs of C semantics find C++ inferior to ++C” (Stroustrup, 10). The language is not called D because “it is an extension of C, and it does not attempt to remedy problems by removing features” (Stroustrup, 10).
How did the language become so popular among programmers?
Explosive growth in the academic and business communities led to the need of a standardization of C++. AT&T Bell Laboratories allowed Stroustrup to “share drafts” of revised versions of his language’s reference manual with implementers of the language’s compilers and the users of his language. There have been a few standardizations of C++ the most recent update to a standardization was by the ISO in 1998.
How is C++ used today?
Compilers and Powerful Applications
Compilers are tools that translate the source code of a programming language, such as C++, into machine language – a language readable and interpreted by the computer. When this interpretation takes place, individual words (segments of 4 bytes – like the number 0F03 in the hexadecimal, or base-16 counting system) are read by the computer and are executed (“Computer languages”), producing, well, what you see when you “double click” on an icon in Windows?, for example.
There are many different compilers available for every major operating system. For Windows? machines, there are Microsoft? Visual C++? 6.0, Borland? C++ Builder? 5.0, Metrowerks? Code Warrior?. Linux has several compilers, the most frequently used being the freely distributed GNU CC (CC being another way to express C++) and the C compiler, GNU C.
More and more systems programmers (and programmers at large) are switching to C++ and Visual C++ to develop powerful applications for the common user. Its flexibility and power allow for such amazing applications as developed by Adobe?, who specialize in graphic and video manipulation (as well as their Adobe? Acrobat? PDF format which most federal, form-based, and professional documents are in) and Id? Software, responsible for such games as Wolfenstein 3D?, Doom?, and the Quake? Trilogy. The character sprites used in these games were most likely drawn in a program written in C++. Newer versions of the Linux operating systems are written in C++; Windows?, especially its user interface coding, is written in C++; and there is not a single “800” phone call (a call paid for by the called party) that isn’t routed by a C++ program. Banking, trading, insurance, telecommunications, and military applications all use C++ as their development language of choice (Stroustrup, 12).
The “Best Language”
C++ is arguably the best current language for development on a wide range of systems, networks, and large corporate infrastructures – as well as applications on personal computers. However, there are always dissenting opinions. The question, “What is the best language?” is “ … the eternal debate of programming” (Parsons). The fact remains that people pick and choose favorites, and, by limiting their knowledge specifically to one language and its mastery, tend to forget that other languages do some things better than others. For instance, manipulation of strings (an array of alphanumeric characters) in the computer language Basic is arguably easier than the manipulation thereof in C++. On the other hand, it is impossible to design, implement and code powerful network applications with Basic.
“What language should I learn?” is a common question among novices in the programming community seeking to find a “general-purpose” language. Unfortunately, there is no such language (Parsons) – all languages are designed to handle specific tasks in a specific matter and make certain aspects of programming easier. In Parson’s words, “You would not, for instance, try to implement a database in Fortran, any more than you would perform a series of matrix calculations in Cobol …” Why not? Fortran is designed to aid in the scientific and numerical calculation analysis field and is more suitable for something like matrix calculations. On the other hand, Cobol [a quite verbose and arduous language - there are some 17 lines of Cobol for every human being on the planet (Parsons)] is a more suitable language for implementing a business database.
Programming in C++
What makes C++ a good language?
In order for a language to be considered a “good” language, it must be powerful and relatively easy to learn. It is contended by some that C++ is a difficult language to master. This is true in some cases – C++ can be relatively difficult due to its ability to handle complex programming techniques, yet, while some of these techniques are difficult to master, the basic language is relatively easy to learn and once it is learned, can be built on rather quickly.
A sample C++ program:
#include
void main() {
cout **“Hello, World!” **ENDL;
}
As you type this program, notice several things. First, capitalization counts in C++, in contrast to many languages such as FORTRAN and Basic, in which you can randomly type every other character as uppercase if you want to. When you enter keywords and identifiers (for example, a variable or function name) C++ expects you to match uppercase and lowercase letters precisely, and it gets badly confused if you don’t. Another thing to watch for is the punctuation: the semicolon (;) and the braces ({}). You must enter these characters exactly where indicated in the example. (Overland, 18)
While the code may look complex, the idea behind it is rather simple. The line “#include ” tells the compiler, at compile time, “Hey! Look for this file and put the contents of it at the top of my file!” Why use iostream? The use of iostream in this program is solely for the purpose of streaming text to the screen – iostream contains code to aid in the process of streaming text to the screen. In fact, without this file, the command “cout **‘Hello World!’ **ENDL;” program.”…“
This program, written in C, looks quite similar to its successor, C++. Stroustrup when implementing C++, kept the syntax of C by the large and expanded its horizons by adding the O-O abilities of Simula67 and Smalltalk 80. In C, the same program is written:
#include
int main(void) {
printf(“Hello World!\n”);
return(0);
}
The only differences between this code and the C++, are the command used to output the string “Hello World!” and the syntax of declaring the main function. The “\n” functions in the same manner that “**ENDL;” the next.
The compiler changes the code of C or C++ to machine language – a language that is interpretable by the computer’s processor. The beginning machine code of the “Hello World!” program written in C looks like this:
457F 464C 0101 0001 0000 0000 0000 0000
0002 0003 0001 0000 03D0 0800 0034 0000
(Parsons)
This is only 1/120th of the whole program and, as you can see, machine language programming can be rather tedious. Languages like Simula67 were created to allow programmers easier ways to program the machines and to increase the number of programmers in the field by making the process easier. Imagine writing Windows? in machine language – it would be quite difficult.
C++ is a powerful and versatile language that has a quite long and interesting background. Without the development of past languages or the further implementation thereof, Bjarne would not have had a reason to create this language – and we would not have platforms like Windows and its programs or developmental operating systems such as Linux. C++ has been vital to the evolution of computers in the modern era.
“Computer languages.” Grolier Multimedia Encyclopedia Online. Online. Grolier Multimedia Encyclopedia. Internet. 2000. Available http://gme.Grolier.com/cgi-bin/gme_bp?artbaseid=0069240
Duffy, Tom. “C++ Success Story; Competitors have predicted its demise, but use of C++ continues to grow.” Computerworld September 13, 1999: 98
Johnson, Paul R. “CLU.” Online. Department of Information Technology at Brighton University. Internet. December 16, 1994. Available http://www.it.bton.ac.uk/burks/burks/foldoc/58/19.htm
McHale, William. “Object-Oriented C? A Case Study of C++ and Objective-C as Object-Oriented Extensions of C.” Online. University of Maryland, Baltimore County. Internet. 28 Apr. 1996. Available http://www.gl.umbc.edu/~schmitt/331S96/wmchal1/testdraft.html
Oualline, Steve. Practical C++ Programming. O’Reilly & Associates, September 1995.
Overland, Brian. C++ in Plain English. MIS:Press, 1996
Parsns, Peter. “A Brief History of Programming.” Online. University of Hull Department of Computer Sciences. Internet. 1997. Available http://web.dcs.hull.ac.uk/people/pjp/Teaching/08208-9697/Notes/Languages/node2.html
Stroustrup, Bjarne. The C++ Programming Language. Addison-Wesley Publication Company, February 4th, 2000.
Stroustrup, Bjarne. “Stroustrup: Bjarne’s Homepage.” Online. AT&T Bell Labs. Internet. 2000. Available http://www.research.att.com/~bs/C++.html
“The Standard ML Programming Language.” Online. Hughes College of Engineering at the University of Nevada at Las Vegas. Internet. 1999. Available http://www.egr.unlv.edu/stock_answers/languages/sml/
! |
Как писать рефераты Практические рекомендации по написанию студенческих рефератов. |
! | План реферата Краткий список разделов, отражающий структура и порядок работы над будующим рефератом. |
! | Введение реферата Вводная часть работы, в которой отражается цель и обозначается список задач. |
! | Заключение реферата В заключении подводятся итоги, описывается была ли достигнута поставленная цель, каковы результаты. |
! | Оформление рефератов Методические рекомендации по грамотному оформлению работы по ГОСТ. |
→ | Виды рефератов Какими бывают рефераты по своему назначению и структуре. |