Object-Oriented Programming What then, is object-oriented programming (or OOP, as it is sometimes written)? We define it as follows:
Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of a hierarchy of classes united via inheritance relationships.
There are three important parts to this definition: object-oriented programming
- uses objects, not algorithms, as its fundamental logical building blocks
- each object is an instance of some class; and
- classes are related to one another via inheritance relationships . A program may appear to be object-oriented, but if any of these elements is missing, it is not an object-oriented program. Specifically, programming without inheritance ‘is distinctly not object-oriented; we call it programming with abstract data types.
From a theoretical perspective, one can fake object oriented programming in non-object oriented programming languages like Pascal and even COBOL or assembly language, but it is horribly ungainly to do so.
Cardelli and Wegner thus say
“that a language is object-oriented if and only if it satisfies the following requirements:
• It supports objects that are data abstractions with an interface of named operations and a hidden local state.
• Objects have an associated type [class].
• Types [classes] may inherit attributes from supertypes [superclasses]”
For a language to support inheritance means that it is possible to express “is a” relationships among types, for example, a red rose is a kind of flower, and a flower is a kind of plant. If a language does not provide direct support for inheritance, then it is not object-oriented. Cardelli and Wegner distinguish such languages by calling them object-based rather than object-oriented. Under this definition, Smalltalk, Object Pascal, C++, C#,Eiffel, and CLOS are all object-oriented, and Ada is object-based. However, since objects and classes are elements of both kinds of languages, it is both possible and highly desirable for us to use object-oriented design methods for both object-based and object-oriented programming languages.
Object-Oriented Design The emphasis in programming methods is primarily on the proper and effective use of particular language mechanisms. By contrast, design methods emphasize the proper and effective structuring of a complex system.What then is object-oriented design? We suggest that Object-oriented design is a method of design encompassing the process of object-oriented decomposition and a notation for depicting both logical and physical as well as static and dynamic models of the system under design.
There are two important parts to this definition: object-oriented design
(1) leads to an object oriented decomposition and
(2) uses different notations to express different models of the logical (class and object structure) and physical (module and process architecture) design of a
system, in addition to the static and dynamic aspects of the system. The support: for object-oriented decomposition is what makes object-oriented design quite different from structured design: the former uses class and object abstractions to logically structure systems, and the latter uses algorithmic abstractions. We will use the term object oriented design to refer to any method that leads to an object-oriented decomposition.
Object-Oriented Analysis (or OOA, as it is sometimes called) emphasizes the building of real-world models, using an object-oriented view of the world:
Object-oriented analysis is a method of analysis that examines requirements from the perspective of the classes and objects found in the vocabulary of the problem domain.
How are OOA, OOD, and OOP related? Basically, the products of object oriented analysis serve as the models from which we may start an object-oriented design; the products of object-oriented design can then be used as blueprints for completely implementing a system using object-oriented programming methods.
OBJECT-ORIENTED ANALYSIS AND DESIGN