object-oriented software engineering
DESCRIPTION
Object-Oriented Software Engineering. CS288. Lecture 1 - Object-Orientation & UML. Contents Overview Classifiers Dynamic Behaviour Static Modelling Summing Up. Unified Modelling Language. First introduced in 1999 (about) Still evolving, and extremely popular language - PowerPoint PPT PresentationTRANSCRIPT
22UniSUniS
Lecture 1 - Object-Orientation & UML
Contents Overview Classifiers Dynamic Behaviour Static Modelling Summing Up
33UniSUniS
Unified Modelling Language
First introduced in 1999 (about)First introduced in 1999 (about)
Still evolving, and extremely popular languageStill evolving, and extremely popular language
Current version 2.0 ratified August 2003Current version 2.0 ratified August 2003
We use UML 1.4, which is the current standard We use UML 1.4, which is the current standard
widely adopted in industrywidely adopted in industry
44UniSUniS
Unified Modelling Language
Java allows us to closely tie the concepts from the UML model directly to the implementation.
• Easier to verify• Easier to modify• Easier to reuse
Think before you code.
UML allows us to build a conceptualmodel that we can examine andunderstand before we write a singleline of code.
55UniSUniS
Unified Modelling Language
Visual modelling language Specify Visualise Construct Document
UML can be used to capture information about: Static structure Dynamic behaviour Environmental aspects Organisational aspects
66UniSUniS
Overview
CreditCardCharges
ItemSeller
ManagerInterface
ItemDB
SalesServer
CustomerInterface
Client
ServiceInterface
SalesTerminal
1
*
1
*
Deployment ViewDeployment View
88UniSUniS
Overview
public class Person {
public double height; public double age;
}
class Male_Person extends Person {// Now add stuff here to change // attributes and behaviour
}
class Female_Person extends Person {// Now add stuff here to change // attributes and behaviour
}
99UniSUniS
Overview
LockedAvailable Sold
timed out
lock
unlock
buy
Behavioural View: Single ObjectBehavioural View: Single Object
1010UniSUniS
Overview
customer credit servicevendor
request item
show availability
select item
demand payment
insert card
charge card
Dynamic behaviour: communication patternsDynamic behaviour: communication patterns
1111UniSUniS
Classifiers
Classifier Function Notation
actor An outside user of the system
class A concept from the modelled system
component A physical piece of the system
data type A descriptor of a set of primitive values that lack identity
Name
node A computational resource
subsystem A package that is treated as a unit with a specification, implementation and identity
use case A specification of the behaviour of an entity in its interaction with outside agents
Name
<<subsystem>>
1212UniSUniS
Dynamic Behaviour: Use Cases
ATMCustomer
ValidatePIN
<<include>>
<<include>>
<<include>>
WithdrawCash
QueryAccount
OrderStatement
Operator
Add Cash
Startup
Shutdown
1313UniSUniS
Dynamic Behaviour: Sequence Chart
ATMCustomer
ATM Card ATM ControlCustomerInterface
BankServer
Card Inserted
Get Pin
PIN Prompt
PIN Input
Card Request
Card Data
PIN Entered
Validate PIN
1414UniSUniS
Dynamic Behaviour: State
A condition or situation during the life of an object during which it satisfies some condition, performs some action, or waits for some event. The Unified Modelling Reference Manual
I.E. State captures all the relevant information about an object at one specific moment with respect to the purpose of the object.
1515UniSUniS
Representation of a State
Activate Phone
entry/ register on network
exit / disconnect from network
1616UniSUniS
Events trigger Transitions
Closed Down Idlestartup
closedown
Top-level Statechart for ATM Control
1717UniSUniS
Full Label for a Transition
StateA StateBe1 [cond] / action1;action2
event name
guardcondition actions
1818UniSUniS
More ATM Control
Closed Down
Idle
Entry / displayWelcome
startup closedown
ProcessingCustomer
Input
card inserted / get pin
validation received [invalid card] / confiscate TerminatingTransaction
ProcessingTransaction
withdrawal selected [valid card] / display wait
2020UniSUniS
Phone Composite State Example
Off
On
Power On
Power Off
Idle
Active
unlock
incoming-call
end
2121UniSUniS
Phone Composite State Example
Off
On
Power On
Power Off
Idle
ActiveDialling
end
0-9
Connecting
Ringing
Talking
unlock
incoming-call
connect-key
connect-fail
call-accepted
connect-key
2222UniSUniS
Static Modelling: Class
Tuner class name
ChannelFrequency attributes
Get_FrequencySet_Frequency
operations
2424UniSUniS
Static Modelling: Association
Tuner
Surf List1
1
Binary relation between classes
Can be implemented in different ways
1 Surf List to 1 Tuner
2525UniSUniS
Static Modelling: Aggregation
Surf List
Surf List Size
Add Surf ChannelDelete Surf ChannelSet Surf Channel
Source ID
Preset NumberPreset Name
Edit Preset NumberEdit Preset Name
0..*
• Specifies that an aggregate classis made up from components.
• Here: A Surf List has 0 or more Source ID
2626UniSUniS
Static Modelling: Aggregation
University
0..*
School
Department
Lecturer Students
1..*
1..*
1
1..*
1
1 1..*
Nested Aggregates
2727UniSUniS
Static Modelling: Putting it all together
A/V Source
Front End External Source
Surf List
Source ID
0..*
11
Tuner
1..*
is tuned to