Part 1: Introduction to OOAD

Source: Internet
Author: User
Tags mathematical functions
Part 1: Introduction to OOAD
2
Objectives
What we will learn:
Introduce oo concepts.
Compare and contrast analysis and design.
Define object-oriented analysis and design
(OOA/d ).
Revoke strate a brief example.
3
What is object technology?
A set of principles
(Billing action,
Encapsulation,
Polymorphism) Guiding
Software Construction,
Together
Ages, databases,
And other tools that
Support those
Principles. (Object
Technology-
Manager's guide,
Taylor, 1997 .)
4
The strengths of Object Technology
Reflects a single paradigm
Facilitates invalid tural and code reuse
Reflects real world models more closely
Encourages Stability
Is adaptive to change
5
Major object technology milestones
Simula
1967
C ++
Late 1980 s
Smalltalk
1972
Java
1991
The UML
1996
UML 2
2004
The history of Object Technology
6
Where is object technology used?
Client/Server systems
And web development
Object Technology
Allows companies
Encapsulate business
Information in objects
And helps to distribute
Processing processing ss
Internet or a network.
7
Where is object technology used? (Continued)
Real-Time Systems
Object Technology
Enables Real-Time
Systems to be
Developed with higher
Quality and flexibility.
4
8
Differences between Oo and structured design
Object-orientation (OO)
Melds the data and data flow process together
Early in the lifecycle
Has a high level of encapsulation
Promotes reuse of Code differently
Permits more software extensibility
9
10
Concepts of object orientation
11
Objectives
Describe login action, encapsulation,
Modularity, and hierarchy.
Describe the physical structure of a class.
Describe the relationship between a class
And an object.
Define polymorphism and generalization.
12
Where are we?
What is an object?
Four principles of OO
What is a class?
Polymorphism and
Generalization
Organizing Model Elements
13
Informally, an object represents an entity,
Either physical, conceptual, or software.
Physical Entity
Conceptual entity
Software entity
Truck
Chemical Process
Linked List
What is an object?
14
A more formal definition
An object is an entity
With a well-defined
Boundary and identity
That encapsulates state
And behavior.
State is represented
Attributes and
Relationships.
Behavior is represented
By operations, methods,
And state machines. Object
Operations
Attributes
15
An object has identity
Each object has a unique identity, even if
State is identical to that of another object.
Using sor "M Zheng"
Teaches Java
Using sor "M Zheng"
Teaches Java
16
Where are we?
What is an object?
Four principles of OO
What is a class?
Polymorphism and
Generalization
Organizing Model Elements
17
Basic Principles of object orientation
Invalid action
Hierarchy
Object orientation
Encapsulation
Modularity
18
What is your action?
The Essential Characteristics
Of an entity that distinguishes
It from all other kinds
Entities.
Defines a boundary relative
The perspective of the viewer.
Is not a concrete
Manifestation, denotes
Ideal essence of something.
19
Example: Invalid action
Student login sor
Course Offering (a.m .,
Monday-Wednesday-Friday)
Course (e.g. Algebra)
20
What is encapsulation?
Improves resiliency
Hides implementation from clients.
Clients depend on interface.
21
Encapsulation extends strated
Worker sor Clark
Needs to be able
To teach four
Classes in
Next semester.
Submitfinalgrades ()
Acceptcourseoffering ()
Takesabbatical ()
Worker sor Clark
Setmaxload ()
Name: Michael Zheng
Employee ID: 567138
Hiredate: 07/25/1991
Status: tenured
Discipline: Finance
Maxload: 4 setmaxload (4)
22
What is modularity?
Breaks up something Complex
Into manageable pieces.
Helps people understand
Complex Systems.
23
Example: modularity
For example, break
Complex systems
Smaller modules. Billing
System
Course Registration
System
Course
Catalog
System
Student
Management
System
24
What is hierarchy?
Decreasing
Invalid action
Increasing
Invalid action
Asset
Realestate
Savings
Bankaccount
Checking stock
Security
Bond
Elements at the same level of the hierarchy
Shocould be at the same level of each action.
25
Where are we?
What is an object?
Four principles of OO
What is a class?
Polymorphism and
Generalization
Organizing Model Elements
26
What is a class?
A class is a description of a set of Objects
That share the same attributes, operations,
Relationships, and semantics.
An object is an instance of a class.
A class is an internal action in that it
Emphasizes relevant characteristics.
Suppresses other characteristics.
27
A sample class
Class
Course
Properties
Name
Location
Days offered
Credit hours
Start Time
End Time
Behavior
Add a student
Delete a student
Get course roster
Determine if it is full
28
Representing classes in the UML
A class is represented using a rectangle
With three compartments:
The class name
The structure (attributes)
The behavior (Operations)
Worker sor
-Name
-Employeeid: uniqueid
-Hiredate
-Status
-Discipline
-Maxload
+ Submitfinalgrade ()
+ Acceptcourseoffering ()
+ Setmaxload ()
+ Takesabbatical ()
+ Teachclass ()
29
What is an attribute?
An attribute is a named property of a class
That describes the range of values that
Instances of the property may hold.
A class may have any number of attributes or no
Attributes at all.
Attributes
Student
-Name
-Address
-Studentid
-Dateofbirth
30
Attributes in classes and objects
Class
Objects
Student
-Name
-Address
-Studentid
-Dateofbirth
: Student
-Name = "Lei Wang"
-Address = "123 Main St ."
-Studentid = 9
-Dateofbirth = "03/10/1987"
: Student
-Name = "Ning Li"
-Address = "456 people st ."
-Studentid = 2
-Dateofbirth = "12/11/1989"
31
Object-oriented basics: Class
E. g. a chair is a member of (instance of) a set of similar
Objects (class) that we call furniture.
Class: Furniture
Cost
Dimensions
Weight
Location
Color
Buy
Bytes
Weweigh
Move
Object:
Thechair
Cost
Dimensions
Weight
Location
Color
Buy
Bytes
Weweigh
Move
32
What is an operation?
A service that can be requested from
Object To effect behavior. An operation has
A signature, which may restrict the actual
Parameters that are possible.
A class may have any number of operations
Or none at all.
Operations
Student
+ Get tuition ()
+ Add schedule ()
+ Get schedule ()
+ Delete schedule ()
+ Has prerequisites ()
33
Object-oriented basics: messages
Messages are the mechanisms by which objects
(Classes) interact.
Object: Cycler
Object: sender
Attributes:
Attributes:
OPERATIONS:
OPERATIONS:
Message: [Cycler,
Operation, parameters]
Message: [sender,
Return value (s)]
34
Where are we?
What is an object?
Four principles of OO
What is a class?
Polymorphism and
Generalization
Organizing Model Elements
35
What is polymorphism?
The ability to hide implements different
Implementations behind a single interface.
Manufacturer
Manufacturer B manufacturer C
OO principle:
Encapsulation
Remote Control
36
Example: Polymorphism
Stock bond mutual fund
Getcurrentvalue ()
Financialinstrument. getcurrentvalue ()
Getcurrentvalue ()
Getcurrentvalue ()
37
What is generalization?
A relationship among classes where one
Class shares the structure and/or behavior
Of one or more classes.
Defines a hierarchy of registractions in which
A subclass inherits from one or more
Superclasses.
Single inheritance.
Multiple inheritance.
Is an "is a kind of" relationship.
38
Example: single inheritance
One class inherits from another.
Savings checking
Superclass
(Parent)
Subclasses
(Children)
Generalization
Relationship
Ancestor
Account
-Balance
-Name
-Number
+ Withdraw ()
+ Createstatement ()
Descendents
39
Object-oriented basics: Inheritance
Objects inherit from
The class all attributes
And operations.
Class: Furniture
Cost
Dimensions
Weight
Location
Color
Buy
Bytes
Weweigh
Move
Object:
Thetable
Cost
Dimensions
Weight
Location
Color
Buy
Bytes
Weweigh
Move
Object:
Thechair
Cost
Dimensions
Weight
Location
Color
Buy
Bytes
Weweigh
Move
40
Example: multiple inheritance
A class can inherit from several other
Classes.
Use multiple inheritance only when needed and
Always with caution!
Flyingthing animal
Airplane helicopter bird wolf horse
Multiple inheritance
41
What is inherited?
Inheritance leverages the similarities among classes.
A subclass inherits parent's attributes,
Operations, and relationships.
A subclass may:
Add additional attributes, operations,
Relationships.
Redefine inherited operations. (use caution !)
Common attributes, operations, and/or
Relationships are shown at the highest
Applicable level in the hierarchy.
42
Where are we?
What is an object?
Four principles of OO
What is a class?
Polymorphism and
Generalization
Organizing Model Elements
43
A general purpose mechanic
Organizing elements into groups.
A model element that can contain in other
Model Elements.
A package can be used:
To organize the model under development.
As a unit of configuration management.
What is a package?
University
Artifacts
44
A package can contain in Classes
The package, university artifacts, contains
One package and five classes.
University
Artifacts
Courseoffering
Schedule
Worker sor
Course
Student
Student
Artifacts
45
Dimo-depiction
<Heading>
<Contents area>
Each dimo-has a frame, a heading
Compartment in the upper left corner, and
Contents area.
If the frame provides no additional value, it may
Be omitted and the border of the dimo-area
Provided by the tool will be the implied frame.
46
Review
What is an object?
What are the four principles of Object
Orientation? Describe each.
What is a class? How are classes
And Objects related?
What is an attribute? An operation?
Define polymorphism. Provide
Example of polymorphism.
What is generalization?
Why use packages?
47
Applying UML and patterns in OOA/d
Skills in object-oriented analysis and design (OOA/d) are
Essential for the creation of well-designed, robust, and
Maintainable software using object technologies and
Languages such as Java, C ++
What these skills are:
Design Patterns-named problem-solution formulas that
Codify exemplary design principles.
They are best-practice principles to help us answer Design
Questions:
Class Design-how to assign responsibilities to classes?
How shocould classes interact? What classes shocould do what?
UML-the UML is not OOA/D or a method, it is simply
Notation.
48
Assign responsibilities
Fundamental ability in OOA/D is to skillfully assign
Responsibilities to software components-classes
Nine fundamental principles in Object Design and
Responsibility Assignment will be introduced later.
OK, wait until we see them...
49
What is analysis and design?
Analysis
Emphasizes an investigation of
Problem
And requirements
Itresunqm
, Rather than
Solution
"Analysis" is a broad term, best qualified, as in
Requirements Analysis
R EQ u I r em en t s an Al Ysi s
(An investigation of
Requirements) or object analysis
O B j ect an Al Ysi s
(An investigation
Of the domain objects ).
Design
Emphasizes a conceptual solution
Iltacsnou that
Fulfills
The Requirements
Itreshu, rather than its
Implementation.
50
Object-oriented processes: Analysis
Define all classes (and relationships and Behavior
Associated with them) that are relevant to
Problem to be solved.
Tasks:
Communicate basic user requirements to Swe
Identify classes (attributes & methods defined)
Specify class hierarchy
Represent object-to-Object Relationships
Model object behavior
51
Object-oriented processes: analysis approaches
Booch
Coad & Yourdon
Jacob
Rumbaugh
Wirfs-Brock
Formal Methods uunniiffiieedd mmeetthhoodd
Ffuussiioonn
52
Object-oriented processes: Design
Transform the analysis model (created using OOA)
Into a design model that serves as a blueprint
Software Construction.
Phases:
High-level-(sub) system design phase
Low-level-Object Design Phase
53
Object-oriented processes: design goals
Describe characteristics of the subsystems
Required to implement customer requirements and
The needed support environment.
Ood enables a software engineer
Indicate the objects that are derived from each
Class
How these objects interrelate with one another
Ood depicts how
Relationships among objects are achieved
Behavior is to be implemented
Communication among objects is to be
Implemented
54
Review: What is OOA/d
Object-oriented analysis
Is about finding and describing
The objects-or concepts-in the problem domain
Object-oriented design
Is about defining Software
Objects and how they collaborate to fulfill
Requirements.
B o k
T I t l e
Public class Book
{
Private String title;
Public chapter getchapter (I n t)
{...}
}
Domain concept
Visualization
Of Domain
Concept
Representation in
Object-oriented
Programming Language
55
Procedural vs object-oriented
Instead of programming the computer to do
Calculation (in mathematical functions), oo
Programming attempts to model interacting
Components
To build a solution.
In similar ways, traditional structured isad also
Differs from OOAD.
56
Structured isad vs OOAD
• Structured isad
-Functional decomposition
• OOAD
-Object decomposition: Discover
Objects, and assign proper responsibilities
Ircsntspi
...
57
An Simple Example
We will design a simple program by going through
The basic OOAD steps to demonstrate how
OOAD in short.
Example-design a small program to simulate
"Dice game" in which a player rolls two die. If
Total is seven, they win; otherwise, they lose.
58
Define Use Cases
Requirements analysis may include a description of related
Domain processes, these can be written as use cases.
Use Cases are a popular tool in requirements analysis
Capture the functional aspects of requirements
Use Cases are not an object-oriented
There are different ways to write use cases. Here, we use
A narrative statement method-simply written stories. More
Methods will be introduced later.
Use Case: play a dice game
A player picks up and rolls the dice. If the dice face
Value total seven, they win; otherwise, they lose.
59
Define a domain (analysis) Model
Object-oriented analysis
Is concerned with creating
Description of the domain from the perspective
Classification by objects-expressed as a domain model.
Domain Model
Defining a domain model involves identifying:
Concepts,
Attributes,
Associations
. Player
NAM E
Dicegame
D IE
Facevalue
R o lls
P la YS
Includes
2
2
1
1
1
1
60
Define interaction Diagrams
Object-oriented design is concerned with defining Software
Objects and their collaborations.
A common notation to revoke strate these collaborations is
Interaction digoal.
It shows the flow of messages between software objects, and thus
The invocation of methods.
Icegame
Play ()
Die1: D IE
Fv1: = getfacevalue ()
Die2: D IE
Roll ()
Roll ()
Fv2: = getfacevalue ()
61
Define design class diagrams
Interaction Diagrams
Gives a dynamic
D y n a m I c
View
Of
Collaborating objects
It is useful to create a static
S t a t I c
View
Of the class definitions
With a design class dimo-i
N addition to interaction
Diagrams
2
D IE
Facevalue: int
Getfacevalue (): int
Roll ()
Dicegame
Die1: Die
Die2: Die
Play ()
1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.