August, 1996
Over the past decade, C++ has evolved from its humble roots as a
research project at AT&T Bell Labs to become the most widely used
object-oriented programming language. During this period, many other
programming languages (such as Ada, Eiffel, Modula 3, Oberon, and
Objective-C) also made their debut. Some of these languages gained
strong followings in certain domains (such as military applications
and user interfaces). However, it's fair to say no other OO
programming language has affected commercial software development
during the past decade as significantly as C++.
During the past 10 years, I've written hundreds of thousands of lines
of C++ code while building language processing tools, distributed
telecommunications management systems, and concurrent object-oriented
networking software for electronic medical imaging systems on a
variety of OS platforms. I've also had the good fortune to interact
closely with many programmers, vendors, and end-users who have
successfully integrated C++ into their software development process.
A frequent topic of discussion is how C++ managed to succeed and
thrive in such a competitive marketplace of ideas and tools. This
article presents my perspective on why C++ has succeeded and outlines
what we can look forward to down the road ahead.
Impediments to success
In retrospect, it's remarkable that C++ became so popular. From the
beginning, C++ faced several major impediments to success including:
- Fierce competition from rival languages -- the success of a
programming language is measured largely by the number of developers
who make their living using the language. This is particularly true
for languages like Eiffel, Objective-C, or Java that were created by a
company in order to generate revenue from licensing the language and
selling language processing tools. Over the years, many competitors
have criticized C++ vigorously and promoted their own tools and
products as the "true OO language" alternative. Fortunately, the
pragmatic benefits of C++ (such as its support for real world
programming concerns like efficiency, respect for the C installed
base, and respect for programmer competence) have shone through the
haze of misinformation and the often vicious ad homenim attacks on C++
and its programming community.
- Minimal support from AT&T -- in contrast to languages like Ada,
which were sponsored by the Department of Defense and large defense
contractors, C++ received minimal support from AT&T. Although some
people attribute the success of C++ to the strong-armed marketing
tactics of Ma Bell, knowledge of the language's history simply does
not support this analysis. For many years, the bulk of the C++
development team at Bell Labs consisted of a handful of developers,
including Bjarne Stroustrup, Andy Koenig, Stan Lippman, and Rob
Murray. In addition to enhancing and maintaining the original C++
translator -- cfront -- these stalwarts somehow found time to edit and
write best selling books, technical conference papers, as well as
articles and columns for the C++ Report magazine.
- Lack of stable development tools -- due to a chronic shortage of
programmers and resources, the original C++ tools that shipped with
cfront were a far cry from the sleek, GUI-based development
environment available today. In the early days of C++, the lack of
advanced tools made it hard to build and debug large-scale programs.
I have many "fond" memories of memorizing cfront's name mangling
scheme in order to debug the generated C output using dbx...
Fortunately, the new generation of C++ compilers are much more robust,
particularly for important language features like templates and
exception handling.
- Lack of recognition in academia -- at its inception, C++ was
disparaged by many academics as a hodge-podge of language features
bolted atop C -- reminiscent of Sid's mutant toys from this season's
blockbuster movie Toy Story. Since many academics consider the use of
C anathema to modern software engineering principles, their negative
reaction to C++ was not surprising. Ironically, as universities face
increasing pressure to teach their students relevant job skills, C++
has become widely used at both the undergraduate and graduate level.
At Washington University, we teach C++ starting with the second
semester of freshman year, and use it extensively in all our
subsequent courses. We've found that the key to successfully teaching
C++ is to stress solid software design principles, patterns, and
idioms, which guiding students away from the dark corners of the
language.
Overcoming the Impediments
So why has C++ succeeded despite the impediments described above? I
believe the following are among the key reasons:
- Support for real world problems -- from its inception, C++ has been
a very pragmatic language. Its focus has always been on solving real
problems faced by programmers building real systems, rather than
providing a "proof of concept" to support a new design method or
programming paradigm.
The emphasis on real world programming in C++ is evident in language
features such as inline functions and templates. These features make
it possible to write highly flexible programs whose run-time
performance is equivalent to those coded by hand using straight C.
This has made it possible to use C++ in a wide spectrum of
applications, ranging from resource-constrained embedded control
systems to massive telecommunication software systems.
- Respect for the installed base -- C++ was designed to be compatible
with both the C language and C programmers. C++ maintains its C
heritage at several levels:
- Source code level -- e.g., the ANSI C programs in the second
edition of K&R are valid C++ programs;
- Object code level -- e.g., C++ structures are "binary-compatible"
with equivalent C structures;
- The tool level -- e.g., C++ works with standard tools like
Make;
- "Programming priorities" level -- e.g., run-time efficiency and
access to low-level computer resources are high priorities.
However, while remaining close to its C heritage, C++ also eliminates
much of the burden of low-level C programming through data
abstraction, inheritance, and dynamic binding.
In retrospect, it's clear that respect for the installed base of C
libraries and C programmers was a major factor in giving C++ an edge
over its early competitors. Other object-oriented languages
begrudgingly interoperate with C via "pragmas" and other non-portable
mechanisms. In contrast, C++ provides explicit language support for C
compatibility via the extern "C" feature, which allows C++ programs to
call existing C library functions portably. This makes it easy for
developers to leverage the considerable effort invested in toolkits
like X windows, Motif, UNIX, and Windows. It also makes it possible
for C++ to get a foothold into organizations that are wary of new,
unproven technology.
- Respect for programmer competence -- I've noticed a disturbing
trend in industry and and academia recently. Too often, advanced
programming skills are devalued by pundits who worship at the altar of
process and methodology. These pundits claim that ritualizing a set
of vaguely articulated rules for developing systems is the silver
bullet that will slay the daemons of software complexity.
Unfortunately, developers of real systems understand all too well that
organizations ignore the contribution of skilled programmers at their
own peril.
Bjarne Stroustrup, the creator of C++, has long emphasized the need to
recognize and reward skilled programmers. I have often heard him
caution against seeking magic elixirs and panaceas at the expense of
substance. Bjarne's pragmatism has helped shape many C++ features and
design decisions. One of the most important decisions was to
incorporate the Standard Template Library (STL) into the draft C++
standard. STL provides C++ programmers with powerful collections and
generic algorithms for creating and reusing highly efficient
plug-compatible components. This power does not come for free,
however, and STL requires programmers to invest significant time to
master the generic programming paradigm. The underlying faith in the
skills and competence of C++ programmers makes the addition of STL to
the C++ worth the risk.
- Impact of the Internet, USENET, the WWW -- C++ is clearly not the
world's simplest programming language. Much of its complexity
reflects the wide spectrum of domains where it can be applied
successfully. In particular, features like functions, classes,
inheritance, dynamic binding, and templates span multiple programming
paradigms. While this makes C++ widely applicable, it increases the
effort required to understand and learn how to use C++ features and
library components effectively.
With proper role models, however, most programmers can navigate
through traps and pitfalls to master C++. Good role models are
important -- they help developers internalize idiomatic programming
strategies and tactics that were traditionally learned only through
painful trial and error. I firmly believe C++'s success is due in
large measure to the rise of the Internet, its associated information
channels (such as USENET and the World Wide Web). These online
facilities have made is easier to share information on how to use C++
effectively. More importantly, a community of regular contributors
(such as Robert Martin, Steve Clamage, and James Kanze) to USENET
newsgroups have served as excellent role models for each new
generation of C++ programmers.
- Dedication of key people -- One of the key reasons for C++'s
success is no secret at all to readers of the C++ Report. For the
past seven years columnists, authors, and editors like Bjarne, Andy
Koenig, Stan Lippman, Rob Murray, Scott Meyers, Peggy Ellis, Martin
Caroll, and Jim Coplien have spent countless hours helping others
succeed with C++ through postings on USENET, tutorials at conferences,
and articles for the C++ Report.
What's remarkable to me is the level of integrity and focus on
technical issues within the C++ community. It is rare to hear C++
programmers make snide remarks about other languages and other
language communities. I believe that programmers recognize and
appreciate this integrity and commitment to substance over rhetoric
and pedantry. I believe it also helps explain why C++ has managed to
withstand the slings and arrows of outrageous polemics hurled at it
over the years.
The Road Ahead
The C++ programming language is now firmly in the mainstream of
commercial software practices. Although this illustrates the success
of C++, it also means that we're no longer the new kids on the block.
If you look closely, you can see the changes that accompany this
transition from adolescence into adulthood. For example, as the C++
standard stablizes, C++ has become less of a vehicle for programming
language research. This is evidenced by the shift in focus of the
USENIX C++ conference to the broader "Conference on Object-Oriented
Technologies and Systems." In addition, many notable C++ experts
(such as Doug Lea, Jim Waldo, Tom Cargill, and Stan Lippman) who were
deeply involved with C++ over the past decade are now focusing on
other topics (such as Java and Mickey Mouse ;-)). Fortunately, a new
generation of C++ experts (such as Don Box, Graham Glass, and Josee
Lajoie) have picked up the baton and continued the race.
As I look down the road, I see the following trends unfolding on the
horizon for C++:
- Stablizing the language definition and its
implementations -- the
ANSI/ISO C++ standards committee has done a remarkable job creating a
document that captures and articulates the essence of C++. The next
step is for vendors to focus on providing high quality and high
performance compilers and environments. In many ways, the continued
success of C++ hinges on how well features (like exceptions,
templates, and RTTI) and library components (such as STL) are
implemented. I'm optimistic that the next generation of C++ compilers
and development environments will be a substantial improvement over
the environments we've worked with in the past.
- Greater focus on design patterns and idioms -- Coping with the
complexity of modern software systems goes beyond programming language
features and library components. It must be addressed by educating
C++ programmers in key software engineering principles. I'm
optimistic that the growing focus on design patterns and idioms will
help C++ programmers benefit from proven techniques used by expert C++
programmers, as well as to leverage useful strategies and tactics from
other language communities. In turn, this will increase the
flexibility and extensibility of C++ programs, without having to
switch languages.
- Integrating with new domains and new languages -- the world of
programming has changed significantly since I first used cfront 1.2 in
the mid-80's. Personal computers and workstations have largely
displaced mini-computers and mainframes, graphical user interfaces
have largely replaced textual interfaces, the Internet and WWW are
increasingly interconnecting our social worlds, and object-oriented
techniques and C++ are now firmly in the mainstream.
In today's competitive marketplace, mastery of C++ is just one of many
skills that developers must have to succeed. They must be highly
proficient with cross-platform development environments,
multi-threading, object-oriented databases, GUI frameworks,
distributed object computing, and the World Wide Web, to name just a
few of today's hot topics. I'm optimistic that the C++ Report will
continue to provide C++ programmers with timely information about the
strategies, tactics, and tools they need to succeed with C++.
Back to
C++ Report Editorials home page.
Last modified 11:34:37 CDT 28 September 2006