Solution
The purpose of this Item was to provoke thought
about major (and even missing) features in C++, and to provide a
healthy dose of reality. Specifically, I hope that your thinking
about this Item has generated ideas and examples that illustrate
three main things.
-
Not everyone agrees about what OO means.
"Well, what is object orientation,
anyway?" Even at this late date, if you ask 10 people, you're
likely to get 15 different answers. (Not much better than asking 10
lawyers for legal opinions.)
Just about everyone would agree that inheritance
and polymorphism are OO concepts. Most people would include
encapsulation. A few might include exception handling, and perhaps
no one would include templates. The point is that there are
differing opinions on whether any given feature is OO, and each
viewpoint has its passionate defenders.
-
C++ is a multiparadigm language. C++ is not
just an OO language. It supports many OO features, but it doesn't
force programmers to use them. You can write completely non-OO
programs in C++, and many people do.
The C++ standardization effort's most important
contribution to C++ is stronger support for powerful abstraction to reduce software
complexity (Martin95).
C++ is not solely an object-oriented language. It supports several
programming styles, including both object-oriented programming and
generic programming. These styles are fundamentally important
because each provides flexible ways to organize code through
abstraction. Object-oriented programming lets us bundle an object's
state together with the functions that manipulate it, and
encapsulation and inheritance let us manage interdependencies and
make reuse cleaner and easier. Generic programming is a more recent
style that lets us write functions and classes that operate on
other functions and objects of unspecified, unrelated, and unknown
types, providing a unique way to reduce coupling and
interdependencies within a program. A few other languages currently
provide support for genericity, but none yet support it as strongly
as C++. Indeed, modern generic programming was made possible by the
unique C++ formulation of templates.
Today, C++ provides many powerful ways to
express abstraction, and the resulting flexibility is the most
important result of C++ standardization.
-
No language is the be-all and end-all. Today,
I'm using C++ as my primary programming language; tomorrow, I'll
use whatever best suits what I'm doing then. C++ does not have a
module system (complete or otherwise); it lacks other major
features, such as garbage collection; and it has static typing, but
not necessarily "strong" typing. All languages have advantages and
drawbacks. Just pick the right tool for the job, and avoid the
temptation to become a nearsighted language zealot.
|