IC-Modeling with UML.ppt

上传人:本田雅阁 文档编号:3028379 上传时间:2019-06-27 格式:PPT 页数:65 大小:480.01KB
返回 下载 相关 举报
IC-Modeling with UML.ppt_第1页
第1页 / 共65页
IC-Modeling with UML.ppt_第2页
第2页 / 共65页
IC-Modeling with UML.ppt_第3页
第3页 / 共65页
IC-Modeling with UML.ppt_第4页
第4页 / 共65页
IC-Modeling with UML.ppt_第5页
第5页 / 共65页
点击查看更多>>
资源描述

《IC-Modeling with UML.ppt》由会员分享,可在线阅读,更多相关《IC-Modeling with UML.ppt(65页珍藏版)》请在三一文库上搜索。

1、1,Modeling with UML,2,Overview,What is modeling? What is UML? Use case diagrams Class diagrams Sequence diagrams Activity diagrams Summary,3,Systems, Models, and Views,A model is an abstraction describing system or a subset of a system A view depicts selected aspects of a model A notation is a set o

2、f graphical or textual rules for representing views Views and models of a single system may overlap each other,4,Systems, Models, and Views,Airplane,Flightsimulator,Scale Model,Blueprints,Electrical Wiring,5,Why Model Software?,Software is already an abstraction: why model software? Software is gett

3、ing larger, not smaller NT 5.0 40 million lines of code A single programmer cannot manage this amount of code in its entirety. Code is often not directly understandable by developers who did not participate in the development We need simpler representations for complex systems Modeling is a mean for

4、 dealing with complexity,6,Concepts & Phenomena,Phenomenon: An object in the world of a domain as you perceive it, for example: The lecture you are attending My black watch Concept: Describes the properties of phenomena that are common, for example: Lectures on software engineering Black watches A c

5、oncept is a 3-tuple: Its Name distinguishes it from other concepts. Its Purpose are the properties that determine if a phenomenon is a member of a concept. Its Members are the phenomena which are part of the concept.,7,A Concept Is a 3-tuple,Name Purpose Members,8,Concepts In Software,The type of a

6、variable represents all possible instances the variable can take. The relationship between type & instance is similar to that of concept & phenomenon. Abstract data type (ADT) Special type whose implementation is hidden from the rest of the system.,9,Class,A class is an abstraction in the context of

7、 object-oriented languages Like an abstract data type, a class encapsulates both state (variables) and behavior (methods) Unlike abstract data types, classes can be defined in terms of other classes using inheritance,10,Two Classes,Watch,time,date,CalculatorWatch,SetDate(d),calculatorState,11,Object

8、-Oriented Modeling,UML Package,12,Application & Solution Domain,Application Domain Requirements & analysis The environment in which the system is operating Solution Domain System design & object Design The available technologies to build the system,13,Unified Modeling Language,An emerging standard f

9、or modeling object-oriented software. Resulted from the convergence of notations from three leading object-oriented methods: OMT (James Rumbaugh) OOSE (Ivar Jacobson) Booch (Grady Booch),14,UML Diagrams,Use case diagrams Describe the functional behavior of the system as seen by the user. Class diagr

10、ams Describe the static structure of the system: Objects, Attributes, and Associations. Sequence diagrams Describe the dynamic behavior between actors and the system and between objects of the system. Statechart diagrams Describe the dynamic behavior of an individual object as a finite state machine

11、. Activity diagrams Model the dynamic behavior of a system, in particular the workflow, i.e. a flowchart.,15,Use Case Diagram,WatchUser,WatchRepairPerson,ReadTime,SetTime,ChangeBattery,Actor,Use case,Package,SimpleWatch,Use case diagrams represent the functionality of the system from users point of

12、view,16,Class Diagram,Battery load(),1,2,Time now(),PushButton state push() release(),1,1,1,1,1,2,blinkIdx blinkSeconds() blinkMinutes() blinkHours() stopBlinking() referesh(),LCDDisplay,SimpleWatch,Class,Association,Multiplicity,Attributes,Operations,Class diagrams represent the structure of the sy

13、stem,17,Sequence Diagram,Object,Message,Activation,Sequence diagrams represent the behavior as interactions,18,button1&2Pressed,Statechart Diagram,State,Initial state,Final state,Transition,Event,19,Other UML Notations,Implementation diagrams Component diagrams Deployment diagrams Introduced in lect

14、ure on System Design Object Constraint Language (OCL) Introduced in lecture on Object Design,20,UML Core Conventions,Rectangles are classes or instances Ovals are functions or use cases Instances are denoted with an underlined names myWatch:SimpleWatch Joe:Firefighter,21,UML Core Conventions,Types a

15、re denoted with nonunderlined names SimpleWatch Firefighter Diagrams are graphs Nodes are entities Arcs are relationships between entities,22,Use Case Diagram,Used during requirements elicitation to represent external behavior Actors represent roles, that is, a type of user of the system Use cases r

16、epresent a sequence of interaction for a type of functionality The use case model is the set of all use cases. It is a complete description of the functionality of the system & its environment,23,A Use Case Diagram,24,Actor,An actor models an external entity which communicates with the system: User

17、External system Physical environment An actor has a unique name and an optional description. Examples: Passenger: A person in the train GPS satellite: Provides the system with GPS coordinates,25,An Actor,26,Use Case,A use case represents a class of functionality provided by the system as an event fl

18、ow. A use case consists of: Unique name Participating actors Entry conditions Flow of events Exit conditions Special requirements,27,A Use Case,28,Use Case Example,Name: Purchase Ticket Participating actor: Passenger Entry condition: Passenger standing in front of ticket distributor. Passenger has s

19、ufficient money to purchase ticket. Exit condition: Passenger has ticket.,Event flow: 1. Passenger selects the number of zones to be traveled. 2. Distributor displays the amount due. 3. Passenger inserts money, of at least the amount due. 4. Distributor returns change. 5. Distributor issues ticket.,

20、29,The Relationship, relationships represent exceptional or seldom invoked cases. The exceptional event flows are factored out of the main event flow for clarity. Use cases representing exceptional flows can extend more than one use case. The direction of a relationship is to the extended use case,3

21、0, Relationships,31,The Relationship,An relationship represents behavior that is factored out of the use case. An represents behavior that is factored out for reuse, not because it is an exception. The direction of a relationship is to the using use case (unlike relationships).,32, Relationships,33,

22、Class Diagram,Class diagrams represent the structure of the system. Class diagrams are used during requirements analysis to model problem domain concepts during system design to model subsystems and interfaces during object design to model classes.,34,A Class Diagram,Enumeration getZones() Price get

23、Price(Zone),TariffSchedule,*,*,Trip,zone:Zone price:Price,35,Class,A class represent a concept. A class encapsulates state (attributes) & behavior (operations). Each attribute has a type. Each operation has a signature. The class name is the only mandatory information.,36,A Class,Name,Attributes,Ope

24、rations,Signature,37,Instance,An instance represents a phenomenon. The name of an instance is underlined and can contain the class of the instance. The attributes are represented with their values.,38,An Instance,zone2price = 1, .20, 2, .40, 3, .60,tariff_1974:TarifSchedule,39,Actor, Class, & Instan

25、ce,Actor: An entity outside the system to be modeled, interacting with the system (“Pilot”) Class: An abstraction modeling an entity in the problem domain, inside the system to be modeled (“Cockpit”) Object: A specific instance of a class (“Joe, the inspector”).,40,Association,Associations denote re

26、lationships between classes. The multiplicity of an association end denotes how many objects the source object can legitimately reference.,41,An Association,Enumeration getZones() Price getPrice(Zone),TarifSchedule,*,*,42,Associations,1-to-1 association,1-to-many association,43,Aggregation,An aggreg

27、ation is a special case of association denoting a “consists of” hierarchy. The aggregate is the parent class, the components are the children class.,44,Aggregations,1,02,45,Composition,A solid diamond denote composition, A strong form of aggregation Components cannot exist without the aggregate.,46,

28、Composition,47,Generalization,Generalization relationships denote inheritance between classes. The children classes inherit the attributes and operations of the parent class. Generalization simplifies the model by eliminating redundancy.,48,Generalization,49,From Problem Statement to Code,Problem St

29、atement,A stock exchange lists many companies. Each company is identified by a ticker symbol,50,From Problem Statement to Code,Problem Statement: A stock exchange lists many companies. Each company is identified by a ticker symbol,51,From Problem Statement to Code,Class Diagram,Java Code,public clas

30、s StockExchange public Vector m_Company = new Vector(); ; public class Company public int m_tickerSymbol; public Vector m_StockExchange = new Vector(); ;,lists,52,UML Sequence Diagram,Used during requirements analysis To refine use case descriptions to find additional objects (“participating objects

31、”) Used during system design to refine subsystem interfaces Classes are represented by columns Messages are represented by arrows Activations are represented by narrow rectangles Lifelines are represented by dashed lines,53,A UML Sequence Diagram,54,UML Sequence Diagram with Nested Messages,The sour

32、ce of an arrow indicates the activation which sent the message An activation is as long as all nested activations,55,A UML Sequence Diagram with Nested Messages,56,Sequence Diagram Observations,UML sequence diagram represent behavior in terms of interactions. Complement the class diagrams which repr

33、esent structure. Useful to find participating objects. Time consuming to build but worth the investment.,57,Activity Diagram,An activity diagram shows flow control within a system An activity diagram is a special case of a state chart diagram in which states are activities (“functions”) Two types of

34、 states: Action state: Cannot be decomposed any further Happens “instantaneously” with respect to the level of abstraction used in the model Activity state: Can be decomposed further The activity is modeled by another activity diagram,58,An Activity Diagram,59,Activity Diagram: Modeling Decisions,60

35、,Activity Diagram: Modeling Concurrency,Synchronization of multiple activities Splitting the flow of control into multiple threads,61,Activity Diagram: Modeling Concurrency,Synchronization,Splitting,62,Activity Diagrams: Swimlanes,Actions may be grouped into swimlanes Denote the object or subsystem

36、that implements the actions.,63,Activity Diagrams: Swimlanes,64,Summary,UML provides a wide variety of notations for representing many aspects of software development Powerful, but complex language Can be misused to generate unreadable models Can be misunderstood when using too many exotic features

37、We concentrate only on a few notations: Functional model: use case diagram Object model: class diagram Dynamic model: sequence diagrams, statechart and activity diagrams,65,References,M. Fowler, UML Distilled, 2nd edition, Addison Wesley, 2000. G. Booch, J. Rumbaugh, and I. Jacobson, The Unified Modeling Language User Guide, Addison Wesley, 1999. B. Bruegge and A. Dutoit, Object-Oriented Software Engineering Using UML, Patterns, and Java, 2nd edition, Prentice Hall, 2004,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1