Why
has object-oriented programming had such a sweeping impact on the software
development community?
Object-oriented
programming appeals at multiple levels. For managers, it promises faster and
cheaper development and maintenance. For analysts and designers, the modeling
process becomes simpler and produces a clear, manageable design. For
programmers, the elegance and clarity of the object model and the power of
object-oriented tools and libraries makes programming a much more pleasant
task, and programmers experience an increase in productivity. Everybody wins,
it would seem.
If
there’s a downside, it is the expense of the learning curve. Thinking in
objects is a dramatic departure from thinking procedurally, and the process of designing
objects is much more challenging than procedural design, especially if
you’re trying to create reusable objects.
In
the past, a novice practitioner of object-oriented programming was faced with a
choice between two daunting tasks:
Choose
a language such as Smalltalk
in which you had to learn a large library before becoming productive.
Choose
C++
with virtually no libraries at all,
[1]
and struggle through the depths of the language in order to write your own
libraries of objects
.
It
is, in fact, difficult to design objects well – for that matter,
it’s hard to design
anything
well. But the intent is that a relatively few experts design the best objects
for others to consume. Successful OOP languages incorporate not just language
syntax and a compiler, but an entire development environment
including
a significant library of well-designed, easy to use objects. Thus, the primary
job of most programmers is to use existing objects to solve their application
problems. The goal of this chapter is to show you what object-oriented
programming is and how simple it can be.
This
chapter will introduce many of the ideas of Java and object-oriented
programming on a conceptual level, but keep in mind that you’re not
expected to be able to write full-fledged Java programs after reading this
chapter. All the detailed descriptions and examples will follow throughout the
course of this book.
[1]
Fortunately, this has change significantly with the advent of third-party
libraries and the Standard C++ library.