FAQs in section [6]:
[6.1] Is C++ a practical language?
Yes.
C++ is a practical tool. It's not perfect, but
it's useful.
In the world of industrial software, C++ is viewed as a solid, mature,
mainstream tool. It has widespread industry support which makes it "good" from
an overall business perspective.
[ Top | Bottom | Previous section | Next section ]
[6.2] Is C++ a perfect language?
Nope.
C++ wasn't designed to demonstrate what a perfect OO language looks like. It
was designed to be a practical tool for solving real world problems. It has a
few warts, but the only place where it's appropriate to keep fiddling with
something until it's perfect is in a pure academic setting. That wasn't C++'s
goal.
[ Top | Bottom | Previous section | Next section ]
[6.3] What's the big deal with OO?
Object-oriented techniques are the best way we know of to develop large,
complex software applications and systems.
OO hype: the software industry is "failing" to meet demands for large, complex
software systems. But this "failure" is actually due to our successes:
our successes have propelled users to ask for more. Unfortunately we created a
market hunger that the "structured" analysis, design and programming techniques
couldn't satisfy. This required us to create a better paradigm.
C++ is an OO programming language. C++ can also be used as a traditional
programming language (as "as a better C"). However if you use it "as a better
C," don't expect to get the benefits of object-oriented programming.
[ Top | Bottom | Previous section | Next section ]
[6.4] Is C++ better than Ada? (or Visual Basic, C, FORTRAN,
Pascal, Smalltalk, or any other language?)
This question generates much much more heat than light. Please read
the following before posting some variant of this question.
In 99% of the cases, programming language selection is dominated by business
considerations, not by technical considerations. Things that
really end up mattering are things like availability of a programming
environment for the development machine, availability of runtime environment(s)
for the deployment machine(s), licensing/legal issues of the runtime and/or
development environments, availability of trained developers, availability of
consulting services, and corporate culture/politics. These business
considerations generally play a much greater role than compile time
performance, runtime performance, static vs. dynamic typing, static vs. dynamic
binding, etc.
Anyone who argues in favor of one language over another in a purely technical
manner (i.e., who ignores the dominant business issues) exposes themself as a
techie weenie, and deserves not to be heard.
[ Top | Bottom | Previous section | Next section ]
[6.5] Who uses C++? 
[Recently rewrote (on 7/00). Click here to go to the next FAQ in the "chain" of recent changes.]
Lots and lots of companies and government sites. Lots.
The large number of developers (and therefore the large amount of available
support infrastructure including vendors, tools, training, etc.) is one of
several critical features of C++.
[ Top | Bottom | Previous section | Next section ]
[6.6] How long does it take to learn OO/C++?
Companies successfully teach standard industry "short courses," where a
university semester course is compressed into one 40 hour work week. But
regardless of where you get your training, make sure the courses have a
hands-on element, since most people learn best when they have projects to help
the concepts "gel." But even if they have the best training, they're
not ready yet.
It takes 6-12 months to become proficient in OO/C++. Less if the developers
have easy access to a "local" body of experts, more if there isn't a "good"
general purpose C++ class library available. To become one of these experts
who can mentor others takes around 3 years.
Some people never make it. You don't have a chance unless you are teachable
and have personal drive. As a bare minimum on "teachability," you have to be
able to admit when you've been wrong. As a bare minimum on "drive," you must be
willing to put in some extra hours (it's a lot easier to learn some new
facts than it is to change your paradigm [i.e., to change the way you
think; to change your notion of goodness; to change your mental model of the
world of technology]).
Two things you should do:
Two things you should not do:
[ Top | Bottom | Previous section | Next section ]
[6.7] What are some features of C++ from a business perspective?
Here are a few features of OO/C++ from a business perspective:
- C++ has a huge installed base, which means
you'll have multi-vendor support for tools,
environments, consulting services, etc., plus you'll have a very valuable
line-item on your resume
- C++ lets developers provide simplified
interfaces to software chunks, which improves the
defect-rate when those chunks are (re)used
- C++ lets you exploit developer's intuition through
operator overloading, which reduces the learning
curve for (re)users
- C++ localizes access to a software chunk,
which reduces the cost of changes.
- C++ reduces the safety-vs.-usability tradeoff, which improves the cost of
(re)using a chunk of software.
- C++ reduces the safety-vs.-speed
tradeoff, which improves defect rates without degrading
performance.
- C++ gives you inheritance and dynamic
binding which let old code call new
code, making it possible to quickly
extend/adapt your software to hit narrow market windows.
[ Top | Bottom | Previous section | Next section ]
[6.8] Are virtual functions (dynamic binding) central to
OO/C++? 
[Recently inserted "the" before "difference" thanks to Stan Brown and reworded references to STL (on 7/00). Click here to go to the next FAQ in the "chain" of recent changes.]
Yes!
Without virtual functions, C++ wouldn't be
object-oriented. Operator overloading and
non-virtual member functions are great, but they are, after all, just
syntactic sugar for the more typical C notion of passing a pointer to a
struct to a function. The standard library contains numerous
templates that illustrate "generic programming" techniques, which are also
great, but virtual functions are still at the heart of object-oriented
programming using C++.
From a business perspective, there is very little reason to switch from
straight C to C++ without virtual functions (we'll ignore generic
programming and the standard library in this FAQ). Technical
people often think that there is a large difference between C and non-OO C++,
but without OO, the difference usually isn't enough to justify the cost of
training developers, new tools, etc. In other words, if I were to advise a
manager regarding whether to switch from C to non-OO C++ (i.e., to switch
languages but not paradigms), I'd probably discourage him or her unless there
were compelling tool-oriented reasons. From a business perspective, OO can
help make systems extensible and adaptable, but just the syntax of C++ classes
without OO may not even reduce the maintenance cost, and it surely adds to the
training cost significantly.
Bottom line: C++ without virtual is not OO. Programming with classes but
without dynamic binding is called "object based," but not "object oriented."
Throwing out virtual functions is the same as throwing out OO. All you have
left is object-based programming, similar to the original Ada language (the new
Ada language, by the way, supports true OO rather than just object-based
programming).
[ Top | Bottom | Previous section | Next section ]
[6.9] I'm from Missouri. Can you give me a simple
reason why virtual functions (dynamic binding) make a big difference?
Overview: Dynamic binding can improve reuse by letting old code call
new code.
Before OO came along, reuse was accomplished by having new code call old code.
For example, a programmer might write some code that called some reusable code
such as printf().
With OO, reuse can also be accomplished by having old code call
new code. For example, a programmer might write some code that is
called by a framework that was written by their great, great grandfather.
There's no need to change great-great-grandpa's code. In fact, it doesn't even
need to be recompiled. Even if all you have left is the object file and the
source code that great-great-grandpa wrote was lost 25 years ago, that ancient
object file will call the new extension without anything falling apart.
That is extensibility, and that is OO.
[ Top | Bottom | Previous section | Next section ]
[6.10] Is C++ backward compatible with ANSI/ISO C?
Almost.
C++ is as close as possible to compatible with C, but no closer. In practice,
the major difference is that C++ requires prototypes, and that f() declares a
function that takes no parameters (in C, f() is the same as f(...)).
There are some very subtle differences as well, like sizeof('x') is equal to
sizeof(char) in C++ but is equal to sizeof(int) in C. Also, C++ puts
structure "tags" in the same namespace as other names, whereas C requires an
explicit struct (e.g., the typedef struct Fred Fred; technique still
works, but is redundant in C++).
[ Top | Bottom | Previous section | Next section ]
[6.11] Is C++ standardized? 
[Recently changed "has been finalized" to "was finalized" thanks to Stan Brown (on 7/00). Click here to go to the next FAQ in the "chain" of recent changes.]
Yes.
The C++ standard was finalized and adopted by ISO (International Organization
for Standardization) as well as several national standards organizations such
as ANSI (The American National Standards Institute), BSI (The British Standards
Institute), DIN (The German National Standards Organization). The ISO standard
was finalized and adopted by unanimous vote November 14, 1997.
The ANSI C++ committee is called "X3J16". The ISO C++ standards group is
called "WG21". The major players in the ANSI/ISO C++ standards process
include just about everyone: representatives from Australia, Canada, Denmark,
France, Germany, Ireland, Japan, the Netherlands, New Zealand, Sweden, the UK,
and the USA, along with representatives from about a hundred companies and many
interested individuals. Major players include AT&T, Ericsson, Digital,
Borland, Hewlett Packard, IBM, Mentor Graphics, Microsoft, Silicon Graphics,
Sun Microsystems, and Siemens. After about 8 years of work, this standard is
now complete. On November 14, 1997, the standard was approved by a unanimous
vote of the countries that had representatives present in Morristown.
[ Top | Bottom | Previous section | Next section ]
[6.12] Where can I get a copy of the ANSI/ISO C++ standard? 
[Recently changed the URL for the electronic copy of the Standard thanks to Wolfgang Haefelinger (on 3/00) and added URLs to free copies of CD2 (on 7/00). Click here to go to the next FAQ in the "chain" of recent changes.]
You can get a paper copy of the standard from the National Committee for
Information Technology Standards (NCITS, pronounced "insights"; this is the new
name of the organization that used to be called "X3"). The contact person is
Monica Vega, 202-626-5739 or 202-626-5738. Ask for document FDC 14882, and be
prepared to pay some money the document is not free. Documents from NCITS
are typically shipped 2-day FedEx within the continental US.
You can also get a paper copy via the web (cost (US dollars): $175): go to
www.ansi.org, choose Catalogs/Standards Information, then
choose "ANSI-ISO-IEC Online Catalog". Search for "14882". The document you're
looking for is designated "ISO/IEC 14882-1998," with title "Information
Technology - Programming Languages - C++."
You can also download an electronic copy via the web (it's a 2.5MB PDF file;
cost (US dollars): $18): go to
webstore.ansi.org/product.asp?sku=ISO%2FIEC+14882%2D1998. To
read the document, download the Adobe Acrobat reader.
Finally, you can read the ISO committee's press release
here. This
press release is readable by non-programmers.
(If you're willing to work with a document that's non-authorative, out-of-date,
and partially incorrect, you can get "committee draft #2" for free from
here and
here.)
[ Top | Bottom | Previous section | Next section ]
E-mail the author
[ C++ FAQ Lite
| Table of contents
| Subject index
| About the author
| ©
| Download your own copy ]
Revised Jul 10, 2000
|