Object-oriented programming (OOP) is a programming
language model organized around objects rather than "actions" and data rather
than logic. Historically, a program has been viewed as a logical procedure that
takes input data, processes it, and produces output data.
The programming challenge was seen as how to write the
logic, not how to define the data. Object-oriented programming takes the view
that what we really care about are the objects we want to manipulate rather
than the logic required to manipulate them. Examples of objects range from
human beings (described by name, address, and so forth) to buildings and floors
(whose properties can be described and managed) down to the little widgets on a computer desktop (such as buttons and scroll
bars).
The first step in OOP is to identify all the objects the
programmer wants to manipulate and how they relate to each other, an exercise
often known as data modeling. Once an object has been identified, it is
generalized as a class of objects (think of Plato's concept of the
"ideal" chair that stands for all chairs) which defines the kind of
data it contains and any logic sequences that can manipulate it.
Object-Oriented
Programming has the following advantages over conventional approaches:
- OOP provides a clear modular
structure for programs which makes it good for defining abstract datatypes
where implementation details are hidden and the unit has a clearly defined
interface.
- OOP makes it easy to maintain
and modify existing code as new objects can be created with small
differences to existing ones.
- OOP provides a good framework
for code libraries where supplied software components can be easily
adapted and modified by the programmer. This is particularly useful for
developing graphical user interfaces.