Please enable JavaScript.
Coggle requires JavaScript to display documents.
Object-Oriented Paradigm - Coggle Diagram
Object-Oriented Paradigm
Overview
The output of OO analysis is a model of the requirements
OO design transforms this model into an architecture object design
OO programming produces code by using OO programming languages or tools
OO software engineering is a much broader concept than OO programming
refers to the whole process of analysis, design, and programming following the object-oriented paradigm
three main OO principles
Inheritance
Polymorphism
Encapsulation
The object-oriented paradigm is a very important methodology in soft- ware development
OO Software Engineering
Programming
Design
Analysis
Introducing the Object-Oriented Paradigm
Classes and Objects
class
groups together related data and their operations
defines the attributes and behaviors shared by all of its objects
three elements
class name
list of attributes
list of operations
object
is an instance of a class
Relationships
The dynamic (behavioral) specification describes the relationships among objects
At the static (logical) level, the relationships among classes are described
static relationships
composition
represents the whole/part relationship between classes -> composition
restrictions
the parts cannot be involved in another composition
the parts of a class have the same lifespan as their owner
restriction usually is enforced by the constructor and destructor operations of a class
aggregation
A similar but more relaxed compositional relationship
hollow diamond arrowhead in UML
Parts involved in an aggregation relationship
may be involved in more than one aggregation relationship
do not have to share the same lifespan as the owner
attributes of an object may be reused by other objects
association
represents the logical relationship among classes.
in UML
a solid line
parts
name of the association
end type at each end of the association link
multiplicity at each end
inheritance
To prevent repeatedly writing the same code for similar classes
One special case of the inheritance association is polymorphism
UML
a line with a closed arrowhead
line is dashed -> a realization relationship
In a realization relationship, the base class is an abstract class
Composition vs. Inheritance
general principles
Composition (or aggregation) can be used to model the "has-a" relationship among classes
Inheritance could possibly weaken the encapsulation of an OO design
Use the inheritance relationship only when the derived class "is a" base class
one weakness of inheritance
changes to the design of a base class may lead to cascading changes to derived classes and the users of derived classes
solved by using a delegation mechanism provided by the aggregation approach
OO Analysis
Step 1: Design of a UML Use Case Diagram
A use case diagram consists of multiple actors and use cases
Step 2: Develop an Analysis Class Diagram via Noun Extraction
describes the key classes of a system and their interrelationships but is not the design of the system
describes the functionality of the system in terms of abstractions (classes) of the concepts found in the problem and the domain
captures the functionalities and logical relationships among the different elements of the system
a model of the system, abstracting design details so that people can better understand the system's overall architecture
three stages of OO development process
analysis
design
implementation
OO Design
Step 2: Construct an Interaction Diagram
reconstruct the flow of events
communication diagrams
sequence diagrams - Mostly used
read URL spec for more details
Step 3: Build a State Machine Diagram
two types of basic elements
transition
state
two cases
a class is involved in multiple use cases
a class is responsible for a single use case
Describe the life-cycle of an object
Many times directly translated into implementation; sometimes not
Conveys the spec between designer and programmer
Step 4: Class Specification
Determine the set of
operations
attributes
Nail down the interface of each class
Outcome: class diagram
Step 1: Identify Classes—CRC Card
An analysis class diagram presents an abstract logical structure of the system
use the CRC modeling approach to identify classes and assign them responsibilities
develop the structural architecture of a system
a system is decomposed into logical components called classes
two stages
high-level (conceptual) design
low-level (detailed) design
Design Principles
Principle of Decoupling
Tight coupling is usually bad
Hard to maintain
Hard to extend
Longer project compiling time
Ensuring Cohesion
a class only performs closely related operations
Logically good! Easy to maintain
Open-Closed Principle
Open to Extension
Close to Modification
use Inheritance and polymorphism