Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 System modeling Chapter 5 – System Modeling Lecture 2 1.

Similar presentations


Presentation on theme: "Chapter 5 System modeling Chapter 5 – System Modeling Lecture 2 1."— Presentation transcript:

1 Chapter 5 System modeling Chapter 5 – System Modeling Lecture 2 1

2 Chapter 5 System modeling 3. Structural Models  Structural models of software display the organization of a system in terms of the components and their relationships.  Structural models may be static models, which show the structure of the system design, or dynamic models, which show the organization of the system when it is executing.  Structural models are created when discussing and designing the system architecture. 2

3 Chapter 5 System modeling Class Diagrams  Class diagrams are used when developing an object-oriented system model to show the classes in a system and the associations between these classes.  An association is a link between classes that indicates that there is some relationship between these classes.  When you are developing models during the early stages of the software engineering process, objects represent something in the real world, such as a patient, a prescription, doctor, a device, etc.  We have spoken in terms of 'nouns' or 'things.' 3

4 Chapter 5 System modeling UML classes and association 4 Here we are also showing multiplicity: one object of type Patient is related to one object of type Patient Record

5 Chapter 5 System modeling Classes and Associations in the MHC-PMS 5 Notice that this is s Static Model Notice the associations are labeled Notice the multiplicity.

6 Chapter 5 System modeling The Consultation Class (There are all kinds of classes: domain / entity classes; software classes, and many 'levels' of these! 6 This is a high level class – perhaps a first or second cut at class definition. Notice much is missing, such as parameters, returns, etc. from the methods. These are ‘software classes’ because they contain methods (that is, how the attributes will be used / manipulated.) Finer levels of granularity are needed to address the shortcomings of this class. But this is a very good way to start your analysis and class definition, especially when trying to develop classes from use cases, where nouns (Consultation) and verbs (new, prescribe….) will be found in the use case itself.

7 Chapter 5 System modeling Generalization  Generalization is an everyday technique that we use to  Rather than learn the detailed characteristics of every entity that we experience, we place these entities in more general classes (animals, cars, houses, etc.) and learn the characteristics of these classes.  This allows us to infer that different members of these classes have some common characteristics e.g. squirrels and rats are rodents.  In programming, we refer to this as 'inheritance.'  Base class and derived classes, or super class and derived class.... parent and child.... many terms for capturing these important relationships. 7

8 Chapter 5 System modeling Generalization  In modeling systems, it is often useful to examine the classes in a system to see if there is scope for generalization.  In object-oriented languages, such as Java, generalization is implemented using the class inheritance mechanisms built into the language.  In a generalization, the attributes and operations associated with higher-level classes are also associated with (inherited by) the lower-level classes.  The lower-level classes are subclasses inherit the attributes and operations from their superclasses. These lower-level classes then add more specific attributes and operations. 8

9 Relationships: Generalization A relationship among classes where one class shares the structure and/or behavior of one or more classes Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses Single inheritance Multiple inheritance Generalization is an “is-a-kind of” relationship, or simply, “is_a” relationship.

10 Account balance name number Withdraw() CreateStatement() Checking Withdraw() Savings GetInterest() Withdraw() Superclass (parent) Subclasses Generalization Relationship Subclasses inherit both attributes and methods from base (parent) class. Descendents Example: Single Inheritance One class inherits from another

11 AirplaneHelicopterWolfHorse FlyingThingAnimal Bird multiple inheritance Use multiple inheritance only when needed, and always with caution ! Example: Multiple Inheritance A class can inherit from several other classes

12 Inheritance leverages the similarities among classes What Gets Inherited? A subclass inherits its parent’s attributes, operations, and relationships A subclass may: Add additional attributes, operations, relationships Redefine inherited operations (use caution!) Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy

13 Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) Person 0..* Trailer 1 Superclass (parent) Subclass generalization size Example: What Gets Inherited

14 Chapter 5 System modeling Object class aggregation models  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. 14

15 Relationships Association Aggregation Composition Dependency Generalization Realization

16 Professor University Works for Class Association Association Name ProfessorUniversity EmployerEmployee Role Names Relationships: Association Models a semantic connection among classes

17 StudentSchedule Whole Aggregation This is sometimes called a ‘has_a’ relationship Part Relationships: Aggregation A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts

18 StudentSchedule Whole Aggregation Part Relationships: Composition A form of aggregation with strong ownership and coincident lifetimes The parts cannot survive the whole/aggregate

19 Association: Multiplicity and Navigation Multiplicity defines how many objects participate in a relationships The number of instances (that is, ‘objects’) of one class related to ONE instance of another class Specified for each end of the association Associations and aggregations are bi-directional by default, but it is often desirable to restrict navigation to one direction If navigation is restricted, an arrowhead is added to indicate the direction of the navigation

20 Association: Multiplicity 2..4 0..1 1..* 0..* 1 * Unspecified Exactly one Zero or more (many, unlimited) One or more Zero or one Specified range Multiple, disjoint ranges 2, 4..6

21 Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) Person 0..* Trailer 1 Superclass (parent) Subclass generalization size Example: What Gets Inherited

22 Chapter 5 System modeling Key points  Structural models show the organization and architecture of a system. Class diagrams are used to define the static structure of classes in a system and their associations. 22

23 Chapter 5 System modeling 4. Behavioral Models  Behavioral models are models of the dynamic behavior of a system as it is executing. They show what happens or what is supposed to happen when a system responds to a stimulus from its environment.  You can think of these stimuli as being of two types:  A. Data Some data arrives that has to be processed by the system.  B. Events Some event happens that triggers system processing. Events may have associated data, although this is not always the case. 23

24 Chapter 5 System modeling A. Data-driven Modeling  Many business systems are data-processing systems that are primarily driven by data.  They are controlled by the data input to the system, with relatively little external event processing.  Data-driven models show the sequence of actions involved in processing input data and generating an associated output.  They are particularly useful during the analysis of requirements as they can be used to show end-to-end processing in a system. 24

25 Chapter 5 System modeling An Activity Model of the insulin pump’s operation 25 These are used a lot! They are not flowcharts or flowgraphs; merely ‘activities’ that need to or must take place. (This is an example (later) of a Pipe-Filter Architectural Model)

26 Chapter 5 System modeling Order Processing – Sequence Diagram - behavorial 26 Shows the Sequence of events over time as messages are issued from one object to another. Terms: life of the object; lifelines, actors, unnamed objects, recursion, and more. Very Important to show the scenarios in motion. Dynamic!

27 Chapter 5 System modeling B. Event-Driven Modeling  Real-time systems are often event-driven, with minimal data processing.  For example, a landline phone switching system responds to events such as ‘receiver off hook’ by generating a dial tone.  Event-driven modeling shows how a system responds to external and internal events.  It is based on the assumption that a system has a finite number of states and that events (stimuli) may cause a transition from one state to another. 27

28 Chapter 5 System modeling 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 modeling 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. 28

29 Chapter 5 System modeling State Diagram of a Mocrowave oven 29

30 Chapter 5 System modeling States and stimuli for the microwave oven (a) StateDescription WaitingThe oven is waiting for input. The display shows the current time. Half powerThe oven power is set to 300 watts. The display shows ‘Half power’. Full powerThe oven power is set to 600 watts. The display shows ‘Full power’. Set timeThe cooking time is set to the user’s input value. The display shows the cooking time selected and is updated as the time is set. DisabledOven operation is disabled for safety. Interior oven light is on. Display shows ‘Not ready’. EnabledOven operation is enabled. Interior oven light is off. Display shows ‘Ready to cook’. OperationOven in operation. Interior oven light is on. Display shows the timer countdown. On completion of cooking, the buzzer is sounded for five seconds. Oven light is on. Display shows ‘Cooking complete’ while buzzer is sounding. 30

31 Chapter 5 System modeling States and stimuli for the microwave oven (b) StimulusDescription Half powerThe user has pressed the half-power button. Full powerThe user has pressed the full-power button. TimerThe user has pressed one of the timer buttons. NumberThe user has pressed a numeric key. Door openThe oven door switch is not closed. Door closedThe oven door switch is closed. StartThe user has pressed the Start button. CancelThe user has pressed the Cancel button. 31

32 Chapter 5 System modeling Microwave Oven Operation 32

33 Chapter 5 System modeling 5. Model-Driven Engineering  Model-driven engineering (MDE) is an approach to software development where models rather than programs are the principal outputs of the development process.  Programs execute on a hardware/software platform are generated automatically from the models.  Proponents of MDE argue that this raises the level of abstraction in software engineering so that engineers no longer have to be concerned with programming language details or the specifics of execution platforms. 33

34 Chapter 5 System modeling Usage of Model-Driven Engineering  Model-driven engineering is still at an early stage of development, and it is unclear whether or not it will have a significant effect on software engineering practice.  Pros  Allows systems to be considered at higher levels of abstraction  Generating code automatically means that it is cheaper to adapt systems to new platforms.  Cons  Models for abstraction and not necessarily right for implementation.  Savings from generating code may be outweighed by the costs of developing translators for new platforms. 34

35 Chapter 5 System modeling Model driven architecture  Model-driven architecture (MDA) was the precursor of more general model-driven engineering  MDA is a model-focused approach to software design and implementation that uses a subset of UML models to describe a system.  Models at different levels of abstraction are created. From a high-level, platform independent model, it is possible, in principle, to generate a working program without manual intervention. 35

36 Chapter 5 System modeling Examples  IEF Information Engineering Facility  Rational Rose  Others… 36

37 Chapter 5 System modeling Key points  Behavioral models are used to describe the dynamic behavior of an executing system. This behavior can be modeled from the perspective of the data processed by the system, or by the events that stimulate responses from a system.  Activity diagrams may be used to model the processing of data, where each activity represents one process step.  State diagrams are used to model a system’s behavior in response to internal or external events.  Model-driven engineering is an approach to software development in which a system is represented as a set of models that can be automatically transformed to executable code. 37

38 Chapter 5 System modeling On Your Own  Good Stuff.  Be sure to read through this casually… 38

39 Chapter 5 System modeling Types of model  A computation independent model (CIM)  These model the important domain abstractions used in a system. CIMs are sometimes called domain models.  A platform independent model (PIM)  These model the operation of the system without reference to its implementation. The PIM is usually described using UML models that show the static system structure and how it responds to external and internal events.  Platform specific models (PSM)  These are transformations of the platform-independent model with a separate PSM for each application platform. In principle, there may be layers of PSM, with each layer adding some platform-specific detail. 39

40 Chapter 5 System modeling MDA transformations 40

41 Chapter 5 System modeling Multiple platform-specific models 41

42 Chapter 5 System modeling Agile methods and MDA  The developers of MDA claim that it is intended to support an iterative approach to development and so can be used within agile methods.  The notion of extensive up-front modeling contradicts the fundamental ideas in the agile manifesto and I suspect that few agile developers feel comfortable with model- driven engineering.  If transformations can be completely automated and a complete program generated from a PIM, then, in principle, MDA could be used in an agile development process as no separate coding would be required. 42

43 Chapter 5 System modeling Executable UML  The fundamental notion behind model-driven engineering is that completely automated transformation of models to code should be possible.  This is possible using a subset of UML 2, called Executable UML or xUML. 43

44 Chapter 5 System modeling Features of executable UML  To create an executable subset of UML, the number of model types has therefore been dramatically reduced to these 3 key types:  Domain models that identify the principal concerns in a system. They are defined using UML class diagrams and include objects, attributes and associations.  Class models in which classes are defined, along with their attributes and operations.  State models in which a state diagram is associated with each class and is used to describe the life cycle of the class.  The dynamic behavior of the system may be specified declaratively using the object constraint language (OCL), or may be expressed using UML’s action language. 44

45 Chapter 5 System modeling Key points  Behavioral models are used to describe the dynamic behavior of an executing system. This behavior can be modeled from the perspective of the data processed by the system, or by the events that stimulate responses from a system.  Activity diagrams may be used to model the processing of data, where each activity represents one process step.  State diagrams are used to model a system’s behavior in response to internal or external events.  Model-driven engineering is an approach to software development in which a system is represented as a set of models that can be automatically transformed to executable code. 45


Download ppt "Chapter 5 System modeling Chapter 5 – System Modeling Lecture 2 1."

Similar presentations


Ads by Google