J.E.D.I
Four basic principles that are generally associated with object-orientation are abstraction, encapsulation, modularity and hierarchy. This concepts are interrelated and supports
one another.
2.1.1 Abstraction
Abstraction is defined as the essential characteristics of an entity that distinguishes it from all other kinds of entities
1
. It is a kind of representation that includes only the things that are important or interesting from a particular point of view. It is domain and
perspective dependent, i.e., what is important in one context may not necessarily be important in another. It allows us to manage the complexity of the system by
concentrating only on those characteristics that are essential or important in the system, and ignoring or de-emphasizing the characteristics that are not. Objects are represented
by those features that are deemed relevant to the current purpose, and hides those features that are not.
Examples of abstraction within the case study are:
1 Object-oriented Analysis and Design using the UML, Students Manual
, Cupertino, CA: Rational software Corporation, 2000, p. 2-15
Software Engineering 37
Figure 2.1 Club Membership Application Object Examples submitApplication
updateSquad AthleteID:3556
Name: Joel Santos Status: NEW
Squad: None submitApplication
updateSquad AthleteID:3557
Name: Arjay Solamo Status: NEW
Squad: None
assignToSquad
updateSport CoachID:9786
Name: JP Petines Sport: Basketball
updateSquadTraining
ATTRIBUTES
MESSAGE METHODS
J.E.D.I
• An applicant submits a club membership application to the club staff. • A club staff schedules an applicant for a mock try-outs.
• A coach assigns an athlete to a squad. • A squad can be a training squad or a competing squad.
• Teams are formed from a squad.
2.1.2 Encapsulation
Encapsulation is also known as information hiding. It localizes features of an entity into a single blackbox abstraction, and hides the implementation of these features behind
an interface. It allows other objects to interact with one another is such a way that they dont need to know how the implementation fulfills the interface. This is achieved
through the objects message interface. This interface is a set of pre-defined operations used so that other objects can communicate with it. It ensures that data
within the attributes of the object are accessible through an objects operation. No other object can directly access these attributes, and change their values.
Consider the interaction among objects in Figure 2.1 where a coach JP assigns an athlete Joel to a squad. updateSquad is the message interface that changes the
value of the squad attribute of the athlete Joel. Notice, that the change will only occur when the coach JP executes assignToSquad which triggers a request to updateSquad
Training of the squad attribute Joels. The coach JP does not need to know how the athlete Joel updates the squad but is assured that the method is executed.
Encapsulation reduces the ripple effect of changes on codes, where a change in one objects implementation will cause another change in another objects implementation
and so on. With encapsulation, one can change the implementation without changing the other objects implementation as long as the interface is unchanged. Thus,
encapsulation offers two kinds of protection to objects: protection against corruption of internal state and protection against code change when another objects implementation
changes.
2.1.3 Modularity