Chapter 7 System Models ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models Abstract descriptions of systems whose requirements are being analysed ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 2 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 3 Topics covered Context models Behavioural models Data models Object models CASE workbenches ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 4 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 5 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 6 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 7 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 8 Context models Context models are used to illustrate the boundaries of a system Social and organisational concerns may affect the decision on where to position system boundaries Architectural models show the a system and its relationship with other systems ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 9 The context of an ATM system S ecuri ty s ys tem B ranch accou nt ing s ys tem Acco un t d at ab as e Au to -t ell er s ys tem B ranch cou nt er s ys tem Us ag e d at abas e M ain ten ance s ys tem ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 10 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 11 Equipment procurement process Del iv ery n ot e S p eci fy equ ip m ent requ ir ed Eq ui pm ent s pec. Vali dat e s pecifi cat io n Accep t d el ivery of equ ip m ent Get co st est im at es S p ec. + s up pl ier + est im a t e Eq ui pm ent s pec. S u pp li er d at ab as e C h eck ed s pec. S u pp li er li st F i nd s up pl iers C h oo se s up pl ier Ord er n ot ificat io n Ord er d et ail s + B l an k ord er fo rm P l ace equ ip m ent o rd er C h ecked and s ig ned ord er fo rm Del i very n ot e C h eck d el iv ered i tem s Ins t al lat io n i ns tru ct io ns Ins t al l equ ip m ent Ins t al lat io n accept ance Accep t d el iv ered equ ip m ent Eq ui pm ent d et ail s Eq ui pm en t d at ab as e ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 12 Behavioural models Behavioural models are used to describe the overall behaviour of a system Two types of behavioural model are shown here • • 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 Both of these models are required for a description of the system’s behaviour ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 13 Data-processing models Data flow diagrams are used to model the system’s data processing These show the processing steps as data flows through a system Intrinsic part of many analysis methods Simple and intuitive notation that customers can understand Show end-to-end processing of data ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 14 Order processing DFD S i gned o rd er fo rm C om p let ed o rd er fo rm Or d er d et ail s + bl an k o rd er fo rm C o m pl et e o rd er fo rm Vali da t e o rd er S i gn ed o rd er fo rm S en d t o s up pl ier R ecord o rd er Ord er d et ail s S i gn ed o rd er fo rm C h eck ed and s ig ned ord er + o rd er n ot ificat io n Ad j us t avail abl e bu dg et Ord er am ou nt + acco un t d et ail s Ord ers fil e ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 B u dg et fil e Slide 15 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 16 CASE toolset DFD Inp ut d es ig n Vali d d es ig n Des ig n edi to r R eferenced d es ig ns Des ig n d at ab as e ©Ian Sommerville 2000 Ch eck ed des ig n Des ig n cro ss checker a nd Des ig n analys is Des ig n anal y ser C h eck ed d es ig n Co de s kelet on g en erat or Us er repo rt Repo rt gen erato r Ou t pu t cod e Software Engineering, 6th edition. Chapter 7 Des ig n d at ab as e Slide 17 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 ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 18 Microwave oven model F u ll p ower F u ll pow er d o: set po wer = 6 00 Ti m er Wait in g d o: di sp lay ti m e Hal f p ow er Nu m b er F u ll p ow er d o: get nu m ber exi t: s et t im e Hal f p ow er Do or clo sed Ti m er Do or o pen Hal f p ower d o: set po wer = 3 00 Op erati on d o: op erate o ven S et ti m e C ancel S t art En abl ed Do or clo sed d o: di sp lay 'R eady ' Do or o pen Wait in g d o: di sp lay ti m e Di s ab l ed d o: di sp lay 'Wait in g' ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 19 Microwave oven state description S ta te W a itin g H a lf p o w e r F u ll p o w e r S e t tim e D is a b le d E n a b le d O p e ra tio n ©Ian Sommerville 2000 D e s c rip tio n T h e o v e n is w a itin g f o r in p u t. T h e d is p la y s h o w s th e c u rre n t tim e . T h e o v e n p o w e r is s e t to 3 0 0 w a tts . T h e d is p la y s h o w s ‘H a lf p o w e r’. T h e o v e n p o w e r is s e t to 6 0 0 w a tts . T h e d is p la y s h o w s ‘F u ll p o w e r’. T h e c o o k in g tim e is s e t to th e u s e r’s in p u t v a lu e . T h e d is p la y s h o w s th e c o o k in g tim e s e le c te d a n d is u p d a te d a s th e tim e is s e t. O v e n o p e ra tio n is d is a b le d f o r s a f e ty . In te rio r o v e n lig h t is o n . D is p la y s h o w s ‘N o t re a d y ’. O v e n o p e ra tio n is e n a b le d . In te rio r o v e n lig h t is o f f . D is p la y s h o w s ‘R e a d y to c o o k ’. O v e n in o p e ra tio n . In te rio r o v e n lig h t is o n . D is p la y of c o m p le tio n tim e r c o u n td o w n . O n s h o w s th e c o o k in g , th e b u z z e r is s o u n d e d f o r 5 s e c o n d s . O v e n lig h t is o n . D is p la y s h o w s ‘C o o k in g c o m p le te ’ w h ile b u z z e r is s o u n d in g . Software Engineering, 6th edition. Chapter 7 Slide 20 Microwave oven stimuli S tim u lu s H a lf p o w e r F u ll p o w e r T im e r Number Door open D o o r c lo s e d S ta rt C ancel ©Ian Sommerville 2000 D e s c r ip tio n T h e u s e r h a s p re s s e d T h e u s e r h a s p re s s e d T h e u s e r h a s p re s s e d T h e u s e r h a s p re s s e d T h e o v e n d o o r s w itc h T h e o v e n d o o r s w itc h T h e u s e r h a s p re s s e d T h e u s e r h a s p re s s e d th e h a lf p o w e r b u tto n th e f u ll p o w e r b u tto n o n e o f th e tim e r b u tto n s a n u m e ric k e y is n o t c lo s e d is c lo s e d th e s ta rt b u tto n th e c a n c e l b u tto n Software Engineering, 6th edition. Chapter 7 Slide 21 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 22 Microwave oven operation O p e r ati on C h ec k in g d o: c he c k s ta tu s Tu rn ta b le fa ul t Ti m e C o ok d o: run ge ne ra t or OK Em i tt e r fa ul t Ti m eo ut D o ne A l a rm d o: bu z z e r on for 5 s e c s. d o: di sp la y ev e nt D o or o pe n D i s ab le d ©Ian Sommerville 2000 C a nc e l Wa it in g Software Engineering, 6th edition. Chapter 7 Slide 23 Semantic data models Used to describe the logical structure of data processed by the system 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 24 Software design semantic model Des ig n 1 n am e d es crip ti on C -d at e M -dat e i s-a h as -no des 1 h as -li nk s 1 n n 1 No de h as -li nk s 1 Li nk n n am e t yp e n am e t yp e 2 1 l in ks 1 1 h as -lab els h as -lab els Lab el n ©Ian Sommerville 2000 n am e t ex t i co n n Software Engineering, 6th edition. Chapter 7 Slide 25 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 26 Data dictionary entries Nam e D e sc rip tio n 1 :N re la tio n b e tw e e n e n titie s o f typ e N o d e o r h a s-la b e ls L in k a n d e n titie s o f typ e L a b e l. H o ld s stru ctu re d o r u n stru ctu re d in fo rm a tio n Label a b o u t n o d e s o r lin ks. L a b e ls a re re p re se n te d b y a n ico n (w h ich ca n b e a tra n sp a re n t b o x) a n d a sso cia te d te xt. A 1 :1 re la tio n b e tw e e n d e sig n e n titie s L in k re p re se n te d a s n o d e s. L in ks a re typ e d a n d m a y be nam ed. E a ch la b e l h a s a n a m e w h ich id e n tifie s th e typ e n a m e (la b e l) o f la b e l. T h e n a m e m u st b e u n iq u e w ith in th e se t o f la b e l typ e s u se d in a d e sig n . E a ch n o d e h a s a n a m e w h ich m u st b e u n iq u e n a m e (n o d e ) w ith in a d e sig n . T h e n a m e m a y b e u p to 6 4 ch a ra cte rs lo n g . ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 T yp e D a te R e la tio n 5 .1 0 .1 9 9 8 E n tity 8 .1 2 .1 9 9 8 R e la tio n 8 .1 2 .1 9 9 8 A ttrib u te 8 .1 2 .1 9 9 8 A ttrib u te 1 5 .1 1 .1 9 9 8 Slide 27 Object models Object models describe the system in terms of object classes 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 28 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 29 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 is a difficult process if duplication in different branches is to be avoided ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 30 The Unified Modeling Language Devised by the developers of widely used object-oriented analysis and design methods Has become an effective standard for object-oriented 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 31 Li brary i tem Library class hierarchy C at al og ue n u m ber Acq ui si ti on d at e C o st Ty pe S t at us Nu m b er of co pi es Acq ui re () C atal ogu e () Di s po se () Iss u e () R etu rn () P u bl is hed it em R ecord ed i tem T i tl e M edi um Ti tl e P ub li sh er B o ok Au th or Ed it io n P u bl icat io n d at e IS B N M ag azi ne Year Iss u e F i lm Di recto r Dat e of releas e Di s tri bu to r C o m pu ter p ro g ram Versi on P l at fo rm User class hierarchy Li br ary us er Nam e Ad d ress P h on e R egi st rat io n # R egi st er () De-r egi st er () Reader B o rro wer Item s o n l oan M ax. lo ans Affil iat io n S t aff Dep artm en t Dep artm en t ph on e S t ud ent M ajo r s ub ject Ho m e ad d ress 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 Can lead to semantic conflicts where attributes/services with the same name in different super-classes have different semantics Makes class hierarchy reorganisation more complex ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 34 Multiple inheritance B o ok Vo ice record in g Au th or Ed it io n P u bl icat io n d at e IS B N S p eaker Du rat io n Record in g d at e Talk in g bo ok # Tapes ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 35 Object aggregation Aggregation model shows how classes which are collections are composed of other classes Similar to the part-of relationship in semantic data models ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 36 Object aggregation ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 37 Object behaviour modelling A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a use-case Sequence diagrams (or collaboration diagrams) in the UML are used to model interaction between objects ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 38 Issue of electronic items Ecat : C atal og : Lib rary Item Li b1 : Net S erver : Lib rary Us er Lo ok up Di s pl ay Iss u e Iss u e li cence Accep t li cence C o m press Del iv er ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 39 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 40 An analysis and design workbench Dat a d icti on ary S t ructu red d iag ramm in g t ools R epo rt g en erat io n facil it ies C o de gen erato r C entral i nfo rmat io n repo sito ry Qu ery l an gu ag e facil it ies Fo rm s creati on t oo ls Des ig n, anal y si s and ch ecki ng t ools Im po rt/ ex po rt facil it ies ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 41 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 42 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 2000 Software Engineering, 6th edition. Chapter 7 Slide 43 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 Object models describe the logical system entities and their classification and aggregation CASE workbenches support the development of system models ©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 44