PDA

View Full Version : History of The C++ Programming Language



gregsometimes
01-04-2009, 06:07 AM
I have spent nearly 6 hours on writing the introduction and a second article for my blog today. It is now 3:57am PST, and I am ready to go to bed.

This is for those who need to brush up on the history of C++, or who have a minute or two to read about how it all started. I hope you find my writing style interesting and the information insightful. The target audience for these articles is a beginner programmer, however the purpose of these articles is to educate people of any background or skill level.

http://www.authenticsociety.com/blog/C_plusplus_History

I would really appreciate feedback on this, corrections, suggestions and whether anyone would like to see any more of these tutorials.

laserlight
01-04-2009, 06:13 AM
Moved to General Discussions.

EDIT:

The target audience for these articles is a beginner programmer, however the purpose of these articles is to educate people of any background or skill level.
I think that it would be better to refer a beginner to a full blown OOP tutorial instead of trying to cover its basics with nearly a third of an article that is supposed to be about history. Even the basics that you did try to cover does not include inheritance and polymorphism. Stroustrup himself stated that "C++ is a multi-paradigm programming language", so your essay probably should go beyond the object oriented aspects of C++ when recounting its history.


In C, for example, you may create variables and structures for each part of the car and write functions that modify values of those variables and structures in different situations. But doing this has one big challenge. You would need to come up with your own non-traditional and subjective ways of breaking the problem down into a set of smaller problems. Which would be then easier to organize and think about separately. Using objects you can effectively do just that in a traditional and standardized fashion.
You make it seem as if breaking down a problem in C++ is automatic and follows some prescribed set of rules that have no exceptions. In truth, class design in C++ can be subjective because there may be trade-offs that have to be made.

gregsometimes
01-05-2009, 12:12 AM
Well this depends on interpretation. I am already familiar with what you are saying, but perhaps it would make things a little more clear if I added that this article is part of the introduction to a set of tutorials that will be added to the website as I write them.

The second quote commentary that you made is correct, but I am not talking about that context. I am saying that Using objects you can do the same thing you would be able to do in C, in a well-established manner. There, I am saying that C does not support object-oriented programming techniques, even though it is quite possible to imitate OOP in C.

I write these articles late at night, and they are not perfect.

abachler
01-05-2009, 02:58 AM
Well this depends on interpretation. I am already familiar with what you are saying, but perhaps it would make things a little more clear if I added that this article is part of the introduction to a set of tutorials that will be added to the website as I write them.

The second quote commentary that you made is correct, but I am not talking about that context. I am saying that Using objects you can do the same thing you would be able to do in C, in a well-established manner. There, I am saying that C does not support object-oriented programming techniques, even though it is quite possible to imitate OOP in C.

I write these articles late at night, and they are not perfect.

No its not open to interpretation. Class design in C++ is subjective, the very fact that it can be approached from more than one direction (your statement that it depends on interpretation) inherently requires it to be so. Either you can impliment classes in more than one way, or you cant, it cannot be both ways. The fact is there are many many different ways to impliment classes. If you put 3 programmers in a room and ask them how to impliment a particular class, you will get 5 answers.

laserlight
01-05-2009, 03:35 AM
The second quote commentary that you made is correct, but I am not talking about that context. I am saying that Using objects you can do the same thing you would be able to do in C, in a well-established manner. There, I am saying that C does not support object-oriented programming techniques, even though it is quite possible to imitate OOP in C.
I gather that your main point is that C does not natively support object oriented programming. The thing is, your explanation and example does not support the claim since the notion of OOP at that point is limited to simple object modeling, which is natively supported in C by structures and functions.

Take the car example: anyone with a working knowledge of C can model a car with engine and wheels in C. It is not clear how that is "non-traditional". It is clear that the exact model is subjective, but the same goes for C++. The more "non-traditional" aspects of such object modeling come into play when one wants to simulate inheritance and polymorphism in C, but as these concepts were not mentioned it seems as if C++ provides nothing in the OOP department over C.


No its not open to interpretation.
I think the part about interpretation has to do with interpreting the purpose of the essay, i.e., in response to the first part of my own response.

Elysia
01-05-2009, 04:04 AM
But C++ has a number of other features, as well, that the article failed to mention.
If it only supported OOP, then it would not be multi-paradigm, yes?

gregsometimes
01-06-2009, 02:57 AM
I would agree, that the structure of the sentences in the advertised article is not ideal. In that particular part of the tutorial. The paragraph will need to be fixed. And I appreciate that some of you noticed that not all information fit into the context of the title of my article.

I am not arguing any of what you are saying, I am sure Elysia, with her 11,368 forum posts is an experienced C++ programmer, as well as laserlight from Singapore (some of the best programming minds are in Europe unfortunately).

abachler, it is the text of my poorly written article is open to interpretation. I did not mean to express with that article, what you are arguing. You are right, the usages of classes in C++ is subjective. C++ is a language written to support many different styles of programming, but I think you and I both know that. It was simply bad article writing on my part. laserlight has pointed it out too, she's right.

I finished the article late at night, and I wanted other people to review it. Your input will be taken seriously, and I will update the article given the information you have contributed.

Thanks!

gregsometimes
01-06-2009, 03:12 AM
I noticed something else.

laserlight,
I re-read what you said in your post. Quote:

I gather that your main point is that C does not natively support object oriented programming. The thing is, your explanation and example does not support the claim since the notion of OOP at that point is limited to simple object modeling, which is natively supported in C by structures and functions.

That's is correct - I am saying that C does not "natively" support Object-Oriented programming. C enables it, but it does not support it. C++ does support object-oriented programming. And believing otherwise, or teaching anyone otherwise is making a big mistake. Javascript, too enables object-oriented programming (inheritance, object composition, etc), but it does not support it.

In Bjarne Stroustrup's words:

Object-oriented programming is a technique for programming - a paradigm for writing "good" programs for a set of programs. If the term object-oriented programming language means anything, it must mean a programming language that provides mechanisms that support the object-oriented style of programming well.
There is an important distinction here. A language is said to support a style of programming if it provides facilities that make it convenient (reasonably easy, safe, and efficient) to use that style. A language does not support a technique if it takes exceptional effort or skill to write such programs; it merely enables the technique to be used. For example, you can write structured programs in Fortran77 and object-oriented programs in C, but it is unnecessarily hard to do so because these languages do not directly (or natively, if you will) support those techniques.

-- This is why I consider that criticism invalid.

laserlight
01-06-2009, 07:02 AM
This is why I consider that criticism invalid.
However, Stroustrup has stated on the record (http://www.research.att.com/~bs/bs_faq.html#oop) that "object-oriented programming is a style of programming originating with Simula (about 40 years ago!) relying of encapsulation, inheritance, and polymorphism". A beginner reading your essay would be completely unaware of the importance of inheritance and polymorphism in OOP (and have only a vague notion of encapsulation, but I think that that is fine given the actual topic at hand). This is why I say that the notion of OOP at that point is limited to simple object modeling. C does natively support this subset of OOP.

matsp
01-06-2009, 08:05 AM
I don't think the origin of C++ was "C is a bad language for large programs", as you seem to indicate here:


n the coming two years after C was released, the code written in C began to suffer from a problem. As the programmers harnessed the power of Personal Computer, the software grew more complex, and the C programs have gotten longer and longer. This meant that these programs were also harder to maintain. Some functions needed to communicate with other functions, but there was no standard way of thinking about data organization. In long programs, the code was practically infested with functions in the global scope. One of the few ways to separate data was by using separate C header (.h) and C source (.c) files. Other than that, the language's features that would help organize the code to ensure readability of large programs were simply missing.

There had to be a solution. In 1983, Bjarne Stroustrup developed such a solution, and named it the C++ programming language. He drew inspiration from some of the previous languages that did no suffer the obvious side-effects of C. One of those languages was Simula67. The greatest addition to C's supset, the C++ language, was that C++ introduced programmers to the concept of an object. An object is an abstraction of a problem. Not only does the use of the concept of objects in a programming language reduce the size of the program, it also makes the program much more readable and compact.

The original REASON for C++ as it looks today was, as far as I understand it, that Bjarne had written a fairly large simulation project in Simula-67 [an object oriented language, and as the name indicates, meant for writing simulations in]. When testing this code with small models of the simulation was working just great. When it came to doing the actual simulation of the REAL work, it ran very slow. Some investigation turned up that 80% of the time was spent in the garbage collection, and only 20% of the computing time was actually spent on the simulation. This made the whole project unworkable.

So to solve this problem, Bjarne decided to make a pre-processor to C that would (sort of) take the Simula object structure, and make it into C-code. This pre-processor later became the first C++ compiler, CFront.

Sure, C++ solves some of the problems with large programs (and creates a few new ones, but nothing is ever perfect). And whilst it may be part of why it is popular today, it was certainly not the reason for it being invented in the first place.

--
Mats

Elysia
01-07-2009, 04:16 AM
I believe it should be noted that part of C++'s existence today is due to the lacking functionality in C.
Actually, I like that paragraph since it puts C at a disadvantage and C++ on an advantage :D

CornedBee
01-07-2009, 04:41 AM
But it's not exactly true. The existence of C++ is due to the lack of speed in Simula-67 - Stroustrup then based his own object-oriented language off C because it was fast.
(Of course, if C had had object-oriented features, Stroustrup wouldn't have created C with Classes, but that's not the main causality.)

matsp
01-07-2009, 05:40 AM
But it's not exactly true. The existence of C++ is due to the lack of speed in Simula-67 - Stroustrup then based his own object-oriented language off C because it was fast.
(Of course, if C had had object-oriented features, Stroustrup wouldn't have created C with Classes, but that's not the main causality.)

Yes, one could perhaps say that C++ became POPULAR (and AT&T spent money on Bjarne's development of the language) because C had deficiencies that C++ solved - but certainly it wasn't what instigated the C++ language - it was a direct need for "something that is significantly faster than Simula for large amounts of "live objects" and has classes like Simula".

--
Mats

gregsometimes
01-07-2009, 11:26 PM
Thanks for everyone's insights and thoughts! I have edited the article judging by the feedback I received from everyone in this thread. I made conscious decisions. The following is a list of choices I made about every criticism that I have received.


laserlight: I think that it would be better to refer a beginner to a full blown OOP tutorial instead of trying to cover its basics with nearly a third of an article that is supposed to be about history. Even the basics that you did try to cover does not include inheritance and polymorphism.

Well, I decided to write multiple articles about C++. This article in particular is not designed to educate the reader about all details of object-oriented programming. I decided to explain advanced subjects in the following tutorials and leave this article as an introduction. A "full blown" tutorial will be written in the near future.


laserlight:You make it seem as if breaking down a problem in C++ is automatic and follows some prescribed set of rules that have no exceptions. In truth, class design in C++ can be subjective because there may be trade-offs that have to be made.

I agree the sentence structure and meaning flow may mislead a beginner. I will edit that part and restructure sentences and logic to make it more clear what it is that I am trying to explain.


laserlight: I gather that your main point is that C does not natively support object oriented programming. The thing is, your explanation and example does not support the claim since the notion of OOP at that point is limited to simple object modeling, which is natively supported in C by structures and functions.

I am a little confused about what you mean by the phrase "natively supports". Could you collaborate? The way I learned this from a Stroustrup's book (The C++ Programming Language)... he basically says that if the language makes it easy to implement a feature it can be said that, that language supports that feature, and vice versa. He clearly makes the distinctionthat C does not support OOP, however, it does enable[/] it. I couldn't have said that better myself. Is it possible to write code in C that makes sense OOP-wise? It is, but the language was not written specifically to support OOP techniques, and so, it is more difficult to write OO programs in C than in C++. Is it possible to write Object Oriented code in Javascript? It is, but in the same way Javascript does not support OO programming, it merely enables it.


[i]laserlight: Take the car example: anyone with a working knowledge of C can model a car with engine and wheels in C. It is not clear how that is "non-traditional". It is clear that the exact model is subjective, but the same goes for C++. The more "non-traditional" aspects of such object modeling come into play when one wants to simulate inheritance and polymorphism in C, but as these concepts were not mentioned it seems as if C++ provides nothing in the OOP department over C.

I agree, I don't explain it correctly in that part, wrote it in a hurry at 3AM.


Elysia: But C++ has a number of other features, as well, that the article failed to mention.
If it only supported OOP, then it would not be multi-paradigm, yes?

Well, again, the article is part of an introduction and a brief outline of the capabilities of C++. In my opinion it's not a good idea to overwhelm an absolute beginner with advanced subjects. I just wanted to keep the focus of the article on the fact that C++ makes it easy to build object-oriented programs, and that it is an easier to use tool for OO programming. Thanks for pointing that out though.


laserlight: However, Stroustrup has stated on the record that "object-oriented programming is a style of programming originating with Simula (about 40 years ago!) relying of encapsulation, inheritance, and polymorphism". A beginner reading your essay would be completely unaware of the importance of inheritance and polymorphism in OOP (and have only a vague notion of encapsulation, but I think that that is fine given the actual topic at hand). This is why I say that the notion of OOP at that point is limited to simple object modeling. C does natively support this subset of OOP.

I figured out how to solve this problem. I need to mention that there is much more to OOP, but also say that it will be the subject of the following tutorials, but the concept of an object (or a class) is a good place to start.

--- --- --- --- ---

Elysia, CornedBee, matsp:

Now for the reason C++ was invented, first of all thanks for your insights about this. I will dedicate a paragraph or two that explains the reasons C++ was created. So far, from my research and this discussion, it can be said that:

1.) Bjarne devised back in 1979, because he faced a software engineering problem at the time where all currently available tools seemed inappropriate. This highly real world oriented design attitude was kept throughout the evolution of C++ - Bjarne specifically didn't want to produce an 'academic' language. [Source: comment on amazon, on the book The Design and Evolution of C++(C++ Design Evolution, by Bjarne Stroustrup (http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FDesign-Evolution-C-Bjarne-Stroustrup%2Fdp%2F0201543303&tag=chatcake-20&linkCode=ur2&camp=1789&creative=9325))]

2.) Bjarne stresses the point that C++ was designed from the beginning to be a 'multiple paradigm' language. [Source: same reference as 1.)]

3.) Object oriented programming was never meant to be, and is not, the only valid - holy grail - style of programming, that many make it out to be. [Source: same reference as 1.)]

4.) As quoted from the book, one of the design goals: 'C++ is a general-purpose language designed to make programming more enjoyable for the serious programmer' [Source: same reference as 1.)]

I will edit the text of that article according to this information. Thanks all!

laserlight
01-08-2009, 12:03 AM
I am a little confused about what you mean by the phrase "natively supports".
You already understand it correctly, as shown by your post #8.


The way I learned this from a Stroustrup's book (The C++ Programming Language)... he basically says that if the language makes it easy to implement a feature it can be said that, that language supports that feature, and vice versa. He clearly makes the distinctionthat C does not support OOP, however, it does [i]enable[/] it.
The crux of my argument has less to do with C not supporting OOP but with C supporting the subset of OOP described in your essay. Once you make it clear that there is more to OOP that what you mentioned, a beginner to C++ and OOP who has dabbled in C would understand more clearly that C++ does offer something extra with respect to OOP.


Now for the reason C++ was invented, first of all thanks for your insights about this. I will dedicate a paragraph or two that explains the reasons C++ was created. So far, from my research and this discussion, it can be said that:
Incidentally, Stroustrup's answer to the FAQ: When was C++ invented? (http://www.research.att.com/~bs/bs_faq.html#invention) includes a link to a PDF version of his essay A History of C++: 1979-1991. That material might be useful for cross referencing.

matsp
01-08-2009, 04:27 AM
There is a paragraph which reflects EXACTLY what I stated as one of the main reasons for Simula to be replaced was, not uniquely, but heavily influenced by the "80% overhead, 20% actual work" effects.

Actual PDF:
http://www.research.att.com/~bs/hopl2.pdf

--
Mats

gregsometimes
01-09-2009, 01:00 AM
Yeah, having your observations acknowledged is a good feeling.

whiteflags
01-10-2009, 10:13 PM
I'm certain that Bjarne's History predates matsp's comments in terms of publication time, so I'm not sure whose observations you mean.

gregsometimes
01-16-2009, 03:26 PM
matsp,
What does what I said have to do with Bjarne Stroustrup?

Perhaps I should give you a context. Having your observations or, for the lack of a better word, opinions, confirmed by what is true is a good feeling. Whether the subject is C++ or what the woman you date really thought of you.

matsp
01-16-2009, 04:19 PM
What I meant by my post was to point out that my statement that "one of the reasons to create the original predecessor to C++ was Simula67's poor performance for a large simulation", and the linked article clearly states that. So it is not just a rumour/my own understanding that the poor performance of Simula was part of the origin of C++ - Bjaren Stroustrup himself states that as part of the reason.

Sure there were OTHER things that helped C++ become popular (for example, lots of people liked to write code in C, but found that there are drawbacks to LARGE systems produced in C that C++ can improve on - but I still think that stating that C++ was CREATED because C was bad at those things is incorrect).

--
Mats

gregsometimes
01-22-2009, 12:50 AM
Well, the purpose of my post was to see what other people think and know about these subjects so I could edit my C++ article. It doesn't make any strong points, and the tone is conversational. I have no intention of arguing with you about what your opinion might be. To make statements such as the ones you are making, without research can be a dangerous thing, because people easily believe the ones who have the determination to say those things, whether they are true or not. I respectfully consider all statements made by everyone who contributed to this thread, but I have no interest in arguing with your or anyone else's beliefs on what is actually the truth. If you don't believe that everything is open to interpretation, then perhaps the feeling of being right is for you, but it is not for me.