LINUX System (English

Download Report

Transcript LINUX System (English

Class Diagrams
Bong-Soo Sohn
Assistant Professor
School of Computer Science and Engineering
Chung-Ang University
CLASS in UML
Class Name
Attribute1
Attribute2
…
Operation1
Operation2
…
responsibility
CLASS in UML
 Class name
WashingMachine
 First letter is upper-case
 No empty space in a class name.
 with package name?
package_name::class_name
Ex) HouseholdAppliances::WashingMashine
CLASS in UML
 Attribute
WashingMachine
brandName
modeName
serialNumber
capacity
 Attribute Names
 Additional information (attribute vale) can be
specified.
Ex) capacity:Integer = 8
• Instance of WashingMachine
myWasher:WashingMachine
brandName = “TROMM”
modeName = “WD-R121XH”
serialNumber = “LG57774”
capacity = 12
CLASS in UML
 Operation
WashingMachine
brandName
modeName
serialNumber
capacity
addClothes()
removeClothes()
addDetergent()
turnOn()
 class methods
 first letter is lower-case
 Additional information (e.g. signature) can be specified.
Ex) addClothes( C:String )
Additional information (signature) in operations
WashingMachine
brandName
modelName
serialNumber
capacity
addClothes( C:String )
removeClothes( C:String )
addDetergent( D:Integer)
turnOn( ):Boolean
- Parameter name and type
- Return type
Stereotype
WashingMachine
WashingMachine
brandName
...
addClothes()
...
WashingMachine
<<id info>>
brandName
modelName
serialNumber
<<machine info>>
capacity
<<clothes-related>>
 If the lists of class attributes and operations are long,
stereotype can be used to separate the list for better
understanding.
 stereotype
 one or extensibility machanisms in UML
 allow designers to extend the vocabulary of UML in order
to create new model elements
Notation :<<stereotype_name>>
addClothes()
removeClothes()
addDetergent()
<<machine-related>>
turnOn()
Responsibility and Constraints
WashingMachine
<<id info>>
brandName
modelName
serialNumber
<<machine info>>
capacity
• Constraints
Use when inserting constraints a class has
to follow.
Notation : text in ‘{ }’
{capacity =5 or 8 or 10 Kg}
<<clothes-related>>
addClothes()
removeClothes()
addDetergent()
<<machine-related>>
turnOn()
Responsibility :
Take dirty clothes as input
and produce clean clothes
as output
Explain what class has to do
Note
WashingMachine
<<id info>>
Refer to Government
Standard EV5-2241 on
generating serial
numbers
brandName
modelName
serialNumber
<<machine info>>
capacity
<<clothes-related>>
addClothes()
removeClothes()
addDetergent()
<<machine-related>>
• Note
Use when inserting
additional
information.
turnOn()
Responsibility :
Take dirty clothes as input
and produce clean clothes
as output
{capacity =5 or 8 or 10 Kg}
Class Modeling
Nouns during conversation with clients
Class name
attribute1
attribute2
…
operation1
operation2
…
responsibility
Nouns during conversation with clients
, which are related to class name.
Verbs during conversation with clients의뢰
Example : modeling basketball game
Example : modeling basketball game
Basketball Game
Conversation
with coach
noun
ball, basket, team, players, guards, forwards, cener, shot, shot clock,
three-point line, free throw, foul, free-throw line, court, game clock
verb
Shoot, advance, dribble, pass, foul, rebound
Initial Class Diagram
Initial class diagram
Ball
Player
diameter
volume
name
height
weight
dribble()
shoot()
pass()
advance()
ShotClock
dribbleBall()
passBall()
shootBall()
rebound()
foulOpponent()
{pro = 24 sec
Forward
Guard
Team
does most of the
intermediate
range shooting
and rebounding
does most of the
dribbling and passing
center
Shot
college = 35sec
Basket
Foul
Int’l = 30 sec}
GameClock
{pro = 4 12-minute
quarters
stays near basket,
shoots from
close range
Court
ThreePointLine
college and Int’l=2
20-minute halves}
FreeThrow
Duration
{pro = 48minutes
college and Int’l =
40 minutes
FreeThrowLine
Association

When classes are connected together conceptually,
that connection is called association
Association
Constraints on Association
Association Classes

Association can have attributes and
operations, just like a class.
Link

An association may have instances, just as
an object is an instance of a class
Multiplicity

The number of objects from one class that relate with a single
object in an associated class.
 One – to –
 One – to –
 One – to –
 1..*
 One – to –
 One – to –
one
many(*)
one or more(*)
zero or one
a bounded interval
 ex. one – to – 5 through(..) 10
 One – to exactly n
 ex. One – to – 10
 One – to – a set of choices
 ex. One – to – 5 or(,) 10
Multiplicity
Possible multiplicities
and how to represent
them in UML
Reflexive Association

Association with itself
Inheritance and Generalization





Is a kind of
inheritance,
Generalization
subclass , superclass
root class, leaf class
abstract class

Class that does
not have an instance

italic font
Dependencies

one class may use another.
 The most common usage of dependency is
to show that the signature of one class’s
operation uses another class
More about class diagrams

집합연관(Aggregation)
 복합연관(Composition)
 문맥(Contexts)
 인터페이스(Interface)
 실체화(Realization)
 가시성(Visibility)
Aggregations

A class consists of a number of component classes
Constraints on Aggregations
• Constraint to show that one component or another is part of whole
Composite

A strong type of aggregation

Each component in a composite can
belong to just one whole
composite structure diagram

Show class’s internal structure
Show components of a class
Interface and Realization

One entity (interface) defines a set of functionalities as
a contract, and the other (class) realizes the contract
by implementing the functionality defined in the
contract.
Visibility
+ : public
# : protected
- : private