Java Reference
In-Depth Information
The following are the most important claims of the object-oriented ap-
proach:
1. The OO model can be understood by clients and software users with no
technical knowledge of programming or computers. For this reason, pro-
gram analysis and design methods based on object-orientation facilitate
communications with clients.
2. Real-world problems can be modeled in object-oriented terms. Structured
programming does not address the problem set.
3. Object-oriented programming languages promote and facilitate code re-
use. Reusing code increases programmer productivity.
4. Object-oriented programs are more resilient to change. This makes OO sys-
tems more able to accommodate the natural volatility of the problem-do-
main.
Learning about Classes and Objects
Object-oriented programming is based on modeling the problem set using
classes and objects. However, you must be careful not to equate an object in
an OO language with an object in the real world. In OO terms, an object is an
abstraction. It is not identical to an object in the physical sense. It is a con-
ceptual entity related to the problem domain. You can think of an object, in
object-oriented programming, as a hybrid that shares some characteristics
of common objects with features of a computer construct. The best way to
understand objects is to observe their properties:
1. An object belongs to a class. An object cannot exist without a class that de-
fines it. You can visualize the class as a cookie cutter and the object as the
cookie. More formally, an object is said to be an instance of a class.
2. A class is an encapsulation that includes data and its related processing op-
erations.
3. Objects have attributes that serve to store and preserve the object's state.
The attributes, which are the data element of the class, determine what is
remembered about an object.
4. An object's methods are the only way of accessing its data or modifying its
state. This is accomplished by sending a message to the object.
The fundamental principles
Encapsulation and inheritance are the cornerstones of object orientation.
Data abstraction, message passing, polymorphism, and dynamic binding
are OO mechanisms based on encapsulation and inheritance. You must
Search WWH ::




Custom Search