Java Basics  «Prev  Next»

Lesson 2OOA - Reading Concepts
ObjectiveObject-oriented analysis builds a model of a system that is composed of objects.

OOA -Reading Concepts

The behaviour of the system is achieved through collaboration between these objects, and the state of the system is the combined state of all the objects in it. Collaboration between objects involves them sending messages to each other.

OOA Concepts

Key aspects of an object-oriented analysis model are basically the same as in object-oriented programming, but an analysis model is not limited to software systems. Any system can be modelled as a system of collaborating objects.
Analysis aims to model an ideal world in the platonic sense and merely describes the kinds of concepts and ideas that are being modelled (how to think).

Analysis Model

An analysis model will not take into account implementation constraints, such as concurrency, distribution and persistence.
The implementation constraints are decided by a process of object-oriented design, and many design patterns have been defined to solve these generic problems.

Need to inherit classes

Imagine the positions Programmer and Manager within an organization. Both of these positions have a common set of properties, including name, address, and phone number. These positions also have different properties. A Programmer may be concerned about a project's programming languages, whereas a Manager may be concerned with project status reports. Let us assume you are supposed to store details of all Programmers and Managers in your office. Figure 1.2 shows the properties and behavior that you may have identified for a Programmer and a Manager, together with their representations as classes. Did you notice that the classes Programmer and Manager have common properties, namely, name, address, phoneNumber, and experience?
The next step is to pull out these common properties into a new position and name it something like Employee.

Figure 1.2: Properties and behavior of a Programmer and a Manager, together with their representations as classes
All living beings inherit the characteristics and behaviors of their parents. The offspring of a bear looks and behaves like a bear. But despite being similar to their parents, all offspring are also different and unique in their own ways. Additionally, a single action may have different meanings for different beings. For example, the action eat has different meanings for a deer and a bear.
The concept of inheriting characteristics and behaviors from parents can be compared to classes inheriting variables and methods from a parent class. Being different and unique in one's own way is similar to how a class can both inherit from a parent and also define additional variables and methods. Single actions having different meanings can be compared to polymorphism in Java. OOA requires that you implement inheritance and polymorphism and understand how to use classes and interfaces.