Anda di halaman 1dari 5

23/11/2010 A skeptic's history of C++ | Programmin…

TechRepublic : A ZDNet Tech Community

A skeptic's history of C++


Date: November 19th, 2010
Author: Chad Perrin
Category: C/C++, Go, Mac OSX, Objective Caml, Objective-C, Programming Languages
Tags: C, Apple Inc., C++, Language, Bjarne Stroustrup, Objective-C, C/C++, Programming
Languages, Software Development, Software/Web Development

The C++ programming language was designed by Bjarne Stroustrup as an improvement over the
C programming language, incorporating a number of enhancements. Probably the most important
is built-in facilities for object oriented program design, as hinted by a term used as a working title
for the project early in its development: “C with Classes.”

It is heavily used for software development where performance matters, particularly in the realm
of very complex application development where a little bit of OOP goes a long way toward making
that kind of complexity manageable. Unfortunately, C++ itself is an incredibly complex beast of a
language.

Originally, it promised to be a superset of the C language with facilities for object oriented
programming. Another language, developed around the same time (arriving a mere three years
later) with the same goals, was Objective-C. To a significant degree, the differences between the
languages can be attributed to two things:

Influences on their design


How well they achieved those early goals

C++ is listed on Wikipedia as having been influenced by a slew of languages, including C (of course),
Ada 83, ALGOL 68, CLU, ML, and Simula. Most of its casual users would likely have a difficult
time coming up with that list off the tops of their heads, and for the parts of the list that might
occur to them, it is likely that any random pair of casual C++ programmers would not come up
with the same short list. To some extent, the influences on C++ are obscured by how they were
bent to fit the new language, and some might suggest absinthe is another important influence.

Objective-C, by contrast, has two influences that would come immediately to mind for even the
most casual Objective-C programmer (possibly excluding people who are not aware the language is
older than MacOS X): C and Smalltalk. The Wikipedia article about Objective-C offers those two,
and only those two, influences on the language’s design, reinforcing the obviousness of those
influences.

As for achieving the early goals of providing an object oriented superset of C, Objective-C appears
to have succeeded in all essential details, while C++ looks in some respects more like the result of
giving up on those goals in mid-effort to pursue something shiny instead.

Much as the influences on Objective-C are much simpler than those on C++, so is the design of the
language much simpler. The reason Apple (and NeXT before it) chose Objective-C as its primary
object oriented application and system development language seems obvious, in that it offers
simplicity and elegance of design — at least as compared with the design of C++. Outside of its
…com.com/programming-and-develop… 1/5
23/11/2010 A skeptic's history of C++ | Programmin…
eventual rise to prominence as the language of choice on Apple platforms like MacOS X and
Apple’s iOS, however, C++ is the clear winner in terms of popularity and mindshare. Even now, so
many years after its creation and without any major resurgence like Objective-C has enjoyed, C++
is in heavy use. For instance, it is the core implementation language of all the most popular major
Web browsers for non-Apple platforms; Chromium, Firefox, Internet Explorer, and Opera are all
substantially built using C++. Even Apple’s Safari browser is written primarily in C++, though
other browsers for MacOS X have used Objective-C instead.

Perhaps it was the fact that C++ was “first to market” by about three years that accounts for the
massive success of the language, and the relative popularity failure of Objective-C. We can finally
find books about programming in Objective-C on the shelves of every major book store, but they
focus on development for MacOS X and Apple’s iOS. General-purpose, platform-agnostic use of
the language is apparently not a popular enough area of interest for anyone to peddle books about
the subject.

Criticisms of C++ appear to substantially outnumber its praises. Meanwhile, the only people
talking about Objective-C (for the most part) are developers for Apple platforms. Those who
develop only for Apple platforms are generally regarded as untrusthworthy in their pro-Apple
biases by many other programmers, so the fact they primarily sing its praises carries little weight
amongst developers who avoid Apple platforms.

What are probably the best criticisms of C++ have both been attributed to Stroustrup himself. The
first is his statement that C makes it easy to shoot yourself in the foot, and C++ makes it harder —
but when you shoot yourself in the foot with C++, you typically blow off your whole leg. The second
is an interview for IEEE Computer Magazine that was supposedly shelved because it was decided
it could not be published, in which he “admits” that C++ was all a joke from the very beginning,
and he goes on to humorously extoll its vices. Stroustrup has disclaimed the article, saying it was a
hoax, and said that he thinks it would have been funnier if he had written it himself.

By the time one is done reading that fictional interview, one might be forgiven for questioning for a
moment whether C++ really was all a joke from the beginning. If so, the joke seems to have been
made at the expense of Objective-C, which lingered in obscurity for almost a generation — an eon
in the terms of computer technologies — before finally finding its niche in the Apple ghetto. The
fact of the matter is that, without Objective-C and Cocoa, Apple would almost certainly be in real
trouble in its search for developers to support its platforms; the joy many find in developing with
those tools helps developers who are the target of systematic mistreatment by Apple’s legal and
marketing teams overcome some of their misgivings.

One might think C++’s days are numbered, now. Alternatives that seem significantly better suited
to the same jobs litter the landscape, and the obvious direct competitor — Objective-C — is in
some ways the least of them. Objective Caml is regularly held up as an example of a high
performance language, frequently outperforming C++ by a significant margin in benchmark tests,
offering more succinct and well-organized source code, and providing developers with far cleaner
and more interesting development models, and it is not even derived from the same family of
programming languages. D aims to compete in the same space, though its proprietary roots may
hinder its widespread adoption. Google’s Go language presents controversial trade-offs, but there
is no doubt that its design offers huge advantages for certain types of software development,
including concurrency.

Judging by the lessons of history, however, I am inclined to believe that C++ will have a long,
stable tenure in its niche for some time to come. It has even been sneaking into operating system
…com.com/programming-and-develop… 2/5
23/11/2010 A skeptic's history of C++ | Programmin…
kernel development for years, as horrifying a thought as that might be for people who care about
things like OS reliability. There is no doubt that it offers some advantages over C for certain types
of performance-critical programming, and that its library support is extensive — even legendary.
Despite this, at least some of the strength of its hold on developers seems to be based on ignorance
of the alternatives, and that is not a characteristic that will easily be pushed aside by a would-be
competitor.

Get IT tips, news, and reviews delivered directly to your inbox by subscribing to TechRepublic's
free newsletters.

Chad Perrin is an IT consultant, developer, and freelance professional writer. He


holds both Microsoft and CompTIA certifications and is a graduate of two IT industry
trade schools. Read his full bio and profile.

People who read this, also read...


programming
Get a handle on C++ templates with this book
The current state and future of C++
The evolution of C++ gives application developers an edge
Help with hello world, I keep getting error!!

Print/View all posts


Comments on this blog
An interesting viewpoint... Sterling "Chip" Camden | 11/19/10

Technical Merit Please? deanberris | 11/21/10

Don't think Mr Perrin Tony Hopkinson | 11/21/10

I agree Mike Page | 11/22/10

I loathe NEW Tony Hopkinson | 11/22/10

I loathe interfaces NEW Sterling "Chip" Camden | 11/22/10

Oh definitely NEW Tony Hopkinson | 11/22/10

Clearing up OO confusion NEW Mike Page | 11/23/10

No they are protecting me from you NEW Tony Hopkinson | 11/23/10

C(plus plus) may well be one of the worst things... Justin James | 11/19/10
…com.com/programming-and-develop… 3/5
23/11/2010 A skeptic's history of C++ | Programmin…

Learning C-plus-plus Mark Miller | 11/19/10

I've lost count of the number of times C based Tony Hopkinson | 11/20/10

Microsot makes C-plus-plus worse than it is Sterling "Chip" Camden | 11/20/10

Why C-plus-plus succeeded over Objective-C Mark Miller | 11/19/10

Open specification is the reason... jkameleon@... | 11/20/10

Will survive for about 60 years and then... NEW PhilippeV | 11/23/10

Nah by that time it will all have changed NEW Tony Hopkinson | 11/23/10

I've pottered around with it on occasion Tony Hopkinson | 11/20/10

If you want performance and intelligent syntax Sterling "Chip" Camden | 11/20/10

I know there are pointers in delphi Tony Hopkinson | 11/20/10

I do some .NET C-plus-plus NEW Sterling "Chip" Camden | 11/22/10

I know it's there NEW Tony Hopkinson | 11/22/10

RE: A skeptic's history of C Marc Thibault | 11/21/10

Objective-C and C Mark Miller | 11/22/10

Objective-C and C Marc Thibault | 11/22/10

Not always a benefit that NEW Tony Hopkinson | 11/22/10

It's also not entirely true NEW Sterling "Chip" Camden | 11/22/10

Multi-paradigm NEW Sterling "Chip" Camden | 11/22/10

RE: A skeptic's history of C aleborn | 11/22/10

Do you have any idea what you are talking about? NEW mbyamukama | 11/22/10

…com.com/programming-and-develop… 4/5
23/11/2010 A skeptic's history of C++ | Programmin…

Not true NEW Justin James | 11/22/10

More than you do apparently NEW Tony Hopkinson | 11/22/10

RE: A skeptic's history of C NEW tweetypie | 11/23/10

RE: A skeptic's history of C NEW Elmonk | 11/23/10

I've abandonned C since long NEW PhilippeV | 11/23/10

I bet you drive a smart car... NEW Robert Lerner | 11/23/10

Why Not Multiple Inheritance NEW Craig Dedo | 11/23/10

As is delphi and C# NEW Tony Hopkinson | 11/23/10

Unrivaled performance NEW oldbaritone | 11/23/10

Unsupported and unsupportable assertions NEW verelse | 11/23/10

A newby ? NEW Tony Hopkinson | 11/23/10

Deleted NEW Justin James | 11/23/10

Was it rude? NEW Tony Hopkinson | 11/23/10

Nope... NEW Justin James | 11/23/10

My Updates
My Contacts

Popular on CBS sites: US Open | PGA Championship | iPad | Video Game Reviews | Cell Phones

About CBS Interactive | Jobs | Advertise | Mobile | Site Map

© 2010 CBS Interactive Inc. All rights reserved. | Privacy Policy (updated) | Terms of Use

…com.com/programming-and-develop… 5/5