Object-Oriented Software Engineering CS288
UniS 2 Lecture 1 - Object-Orientation & UML Contents Overview Classifiers Dynamic Behaviour Static Modelling Summing Up
UniS 3 Unified Modelling Language First introduced in 1999 (about) Still evolving, and extremely popular language Current version 2.0 ratified August 2003 We use UML 1.4, which is the current standard widely adopted in industry
UniS 4 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 conceptual model that we can examine and understand before we write a single line of code.
UniS 5 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
UniS 6 Overview CreditCardCharges ItemSeller ManagerInterface ItemDB SalesServer CustomerInterface Client ServiceInterface SalesTerminal 1 * 1 * Deployment View
UniS 7 Overview height: Real age: Real Person Male_PersonFemale_Person Static View
UniS 8 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 }
UniS 9 Overview Locked Available Sold timed out lock unlock buy Behavioural View: Single Object
UniS 10 Overview customercredit servicevendor request item show availability select item demand payment insert card charge card Dynamic behaviour: communication patterns
UniS 11 Classifiers ClassifierFunctionNotation actorAn outside user of the system classA concept from the modelled system componentA physical piece of the system data typeA descriptor of a set of primitive values that lack identity Name nodeA computational resource subsystemA package that is treated as a unit with a specification, implementation and identity use caseA specification of the behaviour of an entity in its interaction with outside agents Name >
UniS 12 Dynamic Behaviour: Use Cases ATM Customer Validate PIN > Withdraw Cash Query Account Order Statement Operator Add Cash Startup Shutdown
UniS 13 Dynamic Behaviour: Sequence Chart ATM Customer ATM CardATM Control Customer Interface Bank Server Card Inserted Get Pin PIN Prompt PIN Input Card Request Card Data PIN Entered Validate PIN
UniS 14 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.
UniS 15 Representation of a State Activate Phone entry/ register on network exit / disconnect from network
UniS 16 Events trigger Transitions Closed DownIdle startup closedown Top-level Statechart for ATM Control
UniS 17 Full Label for a Transition StateAStateB e1 [cond] / action1;action2 event name guard condition actions
UniS 18 More ATM Control Closed Down Idle Entry / display Welcome startupclosedown Processing Customer Input card inserted / get pin validation received [invalid card] / confiscate Terminating Transaction Processing Transaction withdrawal selected [valid card] / display wait
UniS 19 Phone Composite State Example Off On Power On Power Off
UniS 20 Phone Composite State Example Off On Power On Power Off Idle Active unlock incoming-call end
UniS 21 Phone Composite State Example Off On Power On Power Off Idle Active Dialling end 0-9 Connecting Ringing Talking unlock incoming-call connect-key connect-fail call-accepted connect-key
UniS 22 Static Modelling: Class Tuner class name Channel Frequency attributes Get_Frequency Set_Frequency operations
UniS 23 Static Modelling: Inheritance Hierarchy Tuner A/V TunerFM Tuner
UniS 24 Static Modelling: Association Tuner Surf List 1 1 Binary relation between classes Can be implemented in different ways 1 Surf List to 1 Tuner
UniS 25 Static Modelling: Aggregation Surf List Surf List Size Add Surf Channel Delete Surf Channel Set Surf Channel Source ID Preset Number Preset Name Edit Preset Number Edit Preset Name 0..* Specifies that an aggregate class is made up from components. Here: A Surf List has 0 or more Source ID
UniS 26 Static Modelling: Aggregation University 0..* School Department LecturerStudents 1..* Nested Aggregates
UniS 27 Static Modelling: Putting it all together A/V Source Front EndExternal Source Surf List Source ID 0..* 1 1 Tuner 1..* is tuned to
UniS 28 Summing Up UML is a visual modelling language that covers a range of aspects of systems analysis and design We have seen examples of modelling static structure and dynamic behaviour Environmental and Organisational aspects can be covered too ______________ Use it!