System models ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 1 Objectives To explain why the context of a system should be modelled as part of the RE process To describe behavioural modelling, data modelling and object modelling To introduce some of the notations used in the Unified Modeling Language (UML) To show how CASE workbenches support system modelling ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 2 Topics covered Context models Behavioural models Data models Object models CASE workbenches ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 3 System modelling System modelling helps the analyst to understand the functionality of the system and models are used to communicate with customers. Different models present the system from different perspectives • • • External perspective showing the system’s context or environment; Behavioural perspective showing the behaviour of the system; Structural perspective showing the system or data architecture. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 4 Model types Data processing model showing how the data is processed at different stages. Composition model showing how entities are composed of other entities. Architectural model showing principal sub-systems. Classification model showing how entities have common characteristics. Stimulus/response model showing the system’s reaction to events. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 5 Context models Context models are used to illustrate the operational context of a system - they show what lies outside the system boundaries. Social and organisational concerns may affect the decision on where to position system boundaries. Architectural models show the system and its relationship with other systems. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 6 The context of an ATM system Securit y system Br anch Account account ing system da t abase Aut o- te lle r system Br anch Usa ge dat abase counte r system Maint enance system ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 7 Process models Process models show the overall process and the processes that are supported by the system. Data flow models may be used to show the processes and the flow of information from one process to another. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 8 Equipment procurement process ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 9 Behavioural models Behavioural models are used to describe the overall behaviour of a system. Two types of behavioural model are: • • Data processing models that show how data is processed as it moves through the system; State machine models that show the systems response to events. These models show different perspectives so both of them are required to describe the system’s behaviour. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 10 Data-processing models Data flow diagrams (DFDs) may be used to model the system’s data processing. These show the processing steps as data flows through a system. DFDs are an intrinsic part of many analysis methods. Simple and intuitive notation that customers can understand. Show end-to-end processing of data. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 11 Order processing DFD ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 12 Data flow diagrams DFDs model the system from a functional perspective. Tracking and documenting how the data associated with a process is helpful to develop an overall understanding of the system. Data flow diagrams may also be used in showing the data exchange between a system and other systems in its environment. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 13 Insulin pump DFD ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 14 State machine models These model the behaviour of the system in response to external and internal events. They show the system’s responses to stimuli so are often used for modelling real-time systems. State machine models show system states as nodes and events as arcs between these nodes. When an event occurs, the system moves from one state to another. Statecharts are an integral part of the UML and are used to represent state machine models. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 15 Statecharts Allow the decomposition of a model into submodels (see following slide). A brief description of the actions is included following the ‘do’ in each state. Can be complemented by tables describing the states and the stimuli. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 16 Microwave oven model ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 17 Microwave oven state description S tat e D escr iption W ai tin g T h e o v en i s wa iting for in pu t. The di sp la y sh ows th e c urre nt t im e . H al f p ow er T h e o v en p ow er is s et t o 3 00 w at ts. T h e d is play s ho w s ÔHal f p ow erÕ. F ull p ow er T h e o v en p ow er is s et t o 6 00 w at ts. T h e d is play s ho w s ÔFull p ow erÕ. S et time T h e co ok in g tim e is s et to th e us erÕs inp ut v al u e. T h e d isp la y shows th e co ok in g tim e select e d an d is u pd at e d as th e t im e is s et . D isab le d O ve n o pe rat ion is dis ab led fo r saf e ty . Inter ior o ve n lig h t is o n. D is play sh ows ÔNot rea d yÕ. E n ab led O ve n o pe rat ion i s en a bled. In te ri or ov en l igh t is off . D isp la y s how s ÔR ea d y to co o kÕ. O pe ratio n O ve n in o pe ratio n. In te rio r ov en li g ht is on . D isp la y shows th e tim er co un td ow n. O n com ple tio n of co ok in g, th e b uzz e r is so un de d for 5 s ec o nds . O ve n lig h t is o n. D is play shows ÔC oo king com pl e te Õ while b uz ze r i s so un ding . ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 18 Microwave oven stimuli S tim u lus D escr iption H al f p ow er T h e u se r ha s pr essed th e h alf pow er bu tto n F ull p ow er T h e u se r ha s pr essed th e full p ow er b u tton Ti me r T h e u se r ha s pr essed on e o f the tim er bu tto ns N umb er T h e u se r ha s pr essed a n um eric ke y D oo r op en T h e o v en d o or sw itch is n ot clos ed D oo r cl os ed T h e o v en d o or sw itch is closed S tart T h e u se r ha s pr essed th e sta rt bu tton C a nce l T h e u se r ha s pr essed th e ca n ce l b u tton ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 19 Microwave oven operation ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 20 Semantic data models Used to describe the logical structure of data processed by the system. An entity-relation-attribute model sets out the entities in the system, the relationships between these entities and the entity attributes Widely used in database design. Can readily be implemented using relational databases. No specific notation provided in the UML but objects and associations can be used. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 21 Library semantic model ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 22 Data dictionaries Data dictionaries are lists of all of the names used in the system models. Descriptions of the entities, relationships and attributes are also included. Advantages • • Support name management and avoid duplication; Store of organisational knowledge linking analysis, design and implementation; Many CASE workbenches support data dictionaries. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 23 Data dictionary entries N ame D escr iption T yp e D ate A rtic le D eta ils of th e p ub li sh ed artic le tha t m ay b e ord ered b y p eo p le usin g LI B SYS . E n tity 3 0. 1 2.20 02 au th ors T h e nam es of the au tho rs of th e a rtic le w ho m ay be du e a sh are o f th e f ee. A ttrib ute 3 0. 1 2.20 02 B u ye r T h e pe rso n or org an is at ion th at orde rs a co p y of the article . E n tity 3 0. 1 2.20 02 A 1:1 re lat ions hip b et w ee n A rtic le an d th e C o pyr ig h t A ge n cy w h o s ho ul d b e p ai d th e c op yrig ht fe e. R e la tio n 2 9. 1 2.20 02 T h e ad dress o f th e bu ye r. Th is is used to an y pa p er b il lin g inform at ion t ha t is r eq uire d. A ttrib ute 3 1. 1 2.20 02 fee p aya b le -t o A dd re ss (B u ye r) ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 24 Object models Object models describe the system in terms of object classes and their associations. An object class is an abstraction over a set of objects with common attributes and the services (operations) provided by each object. Various object models may be produced • • • Inheritance models; Aggregation models; Interaction models. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 25 Object models Natural ways of reflecting the real-world entities manipulated by the system More abstract entities are more difficult to model using this approach Object class identification is recognised as a difficult process requiring a deep understanding of the application domain Object classes reflecting domain entities are reusable across systems ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 26 Inheritance models Organise the domain object classes into a hierarchy. Classes at the top of the hierarchy reflect the common features of all classes. Object classes inherit their attributes and services from one or more super-classes. these may then be specialised as necessary. Class hierarchy design can be a difficult process if duplication in different branches is to be avoided. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 27 Object models and the UML The UML is a standard representation devised by the developers of widely used object-oriented analysis and design methods. It has become an effective standard for objectoriented modelling. Notation • • • Object classes are rectangles with the name at the top, attributes in the middle section and operations in the bottom section; Relationships between object classes (known as associations) are shown as lines linking objects; Inheritance is referred to as generalisation and is shown ‘upwards’ rather than ‘downwards’ in a hierarchy. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 28 Library class hierarchy Libr ar y it em Ca t alo gue n um ber Acquisition da t e Cost Type St a t us Num ber of copie s Acquir e ( ) Ca t alo gue ( ) Dispose () I ssue () Ret urn ( ) Pub lished it em Recor ded it em Title Medium Title Pub lisher Book Aut hor Edit ion Pub lica t ion da t e Ma gazine Year I ssue Film Com puter pr o gr am Dir ect or Da t e of r elease Dist rib ut or Ver sion Pla t for m ISB N ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 29 User class hierarchy Libr ar y user Nam e Addr ess Ph o n e Reg ist r a t io n # Reg ist er ( ) De- r eg ist er ( ) Reade r Bo r r o w er I tem s o n loa n Max . lo an s Aff ilia t io n St af f Dep ar t men t Dep ar t men t ph o n e ©Ian Sommerville 2004 St uden t Majo r subjec t Ho me ad dr ess Software Engineering, 7th edition. Chapter 8 Slide 30 Multiple inheritance Rather than inheriting the attributes and services from a single parent class, a system which supports multiple inheritance allows object classes to inherit from several super-classes. This can lead to semantic conflicts where attributes/services with the same name in different super-classes have different semantics. Multiple inheritance makes class hierarchy reorganisation more complex. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 31 Multiple inheritance Book Voice r ecording Aut hor Edit ion Pub lica t ion da t e I SB N Speak er Dur a t ion Recor ding da t e Talking book # Ta pes ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 32 Object aggregation An aggregation model shows how classes that are collections are composed of other classes. Aggregation models are similar to the part-of relationship in semantic data models. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 33 Object aggregation ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 34 Object behaviour modelling A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a usecase. Sequence diagrams (or collaboration diagrams) in the UML are used to model interaction between objects. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 35 Issue of electronic items ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 36 Structured methods Structured methods incorporate system modelling as an inherent part of the method. Methods define a set of models, a process for deriving these models and rules and guidelines that should apply to the models. CASE tools support system modelling as part of a structured method. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 37 Method weaknesses They do not model non-functional system requirements. They do not usually include information about whether a method is appropriate for a given problem. The may produce too much documentation. The system models are sometimes too detailed and difficult for users to understand. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 38 CASE workbenches A coherent set of tools that is designed to support related software process activities such as analysis, design or testing. Analysis and design workbenches support system modelling during both requirements engineering and system design. These workbenches may support a specific design method or may provide support for a creating several different types of system model. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 39 An analysis and design workbench Da t a dict ionar y Code gener ator Fo r m s cr ea tion t ools ©Ian Sommerville 2004 St ruc tur ed Repor t dia g ram m ing gener a t ion t ools f acilities Ce nt r al Quer y info r m a t ion langua ge r eposit or y f acilities Design, anal ysis and checking t ools I mpor t /e xpor t f acilities Software Engineering, 7th edition. Chapter 8 Slide 40 Analysis workbench components Diagram editors Model analysis and checking tools Repository and associated query language Data dictionary Report definition and generation tools Forms definition tools Import/export translators Code generation tools ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 41 Key points A model is an abstract system view. Complementary types of model provide different system information. Context models show the position of a system in its environment with other systems and processes. Data flow models may be used to model the data processing in a system. State machine models model the system’s behaviour in response to internal or external events ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 42 Key points Semantic data models describe the logical structure of data which is imported to or exported by the systems. Object models describe logical system entities, their classification and aggregation. Sequence models show the interactions between actors and the system objects that they use. Structured methods provide a framework for developing system models. ©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 8 Slide 43