軟件需求分析課件:Chap 2-Intro to UML_第1頁
軟件需求分析課件:Chap 2-Intro to UML_第2頁
軟件需求分析課件:Chap 2-Intro to UML_第3頁
軟件需求分析課件:Chap 2-Intro to UML_第4頁
軟件需求分析課件:Chap 2-Intro to UML_第5頁
已閱讀5頁,還剩69頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Chapter 2 UML Overview What is UML A Brief History of UML A Conceptual Model of the UML Ways to Apply UML1What Is the UML?UML = Unified Modeling LanguageThe UML is a language forVisualizingSpecifyingConstructingDocumentingthe artifacts of a software-intensive system.2The UML combines the best of the

2、 best from:Data Modeling concepts (ER)Business Modeling (work flow)Object ModelingComponent ModelingIt can be uses with all processes ,throughout the development life cycle, and across different implementation technologies3Contributions to the UML4History of the UMLWeb - June 1996 OOPSLA 95PublicFee

3、dbackOMG Acceptance, Nov 1997Final submission to OMG, Sept 1997First submission to OMG, Jan 1997UML 1.0UML partnersUML 1.1UML 1.4UML 2.0Planned minor revision (2000)Planned major revision (2001)UML 1.3Current minor revision 19995UML 0.9UML 0.82005A Conceptual Model of the UMLBuilding Blocks of the U

4、ML 1) Things in the UML2) Relationships in the UML3) Diagrams in the UMLCommon Mechanisms in the UML1) Specifications2) Adornments3) Common divisions4) Extensibility mechanismsUML = Building Blocks+ Common Mechanisms6Building Blocks of the UMLThe vocabulary of the UML encompasses three kinds of buil

5、ding blocksThings the abstractions that are first-class citizens in a model; Relationships relationships tie these things together;Diagramsdiagrams group interesting collections of thingsBuilding Blocks = Things + Relationships + Diagrams71) Things in the UMLThere are four kinds of things in the UML

6、:Structural things Behavioral thingsGrouping thingsAnnotational things These things are the basic object-oriented building blocks of the UML.8Structural thingsthe nouns of UML models.the mostly static parts of a model, either conceptual or physicalCollectively, the structural things are called class

7、ifiers Eight kinds: Logic view: class, interface, collaboration, Requirement view: use caseProcess view: active classImplementation view: component, artifact,node 9Structural things -ClassA Class is a description of a set of objects that share the same attributes, operations, relationships, and sema

8、ntics.A class implements one or more interfaces10A class is represented using a compartmented rectangleObjectsProfessor SmithProfessor JonesProfessor MellonAttributesOperations11Structural things - InterfaceAn interface defines a collection of operations that specify a service of a class or componen

9、t.Interfaces support “plug-and-play” architecturesoperation specifications , but never a set of operation implementations.Shapedraw()move()scale()rotate()TubePyramidCubeRealization relationship12Interface RepresentationsElided/Iconic Representation(“lollipop”)Canonical (Class/Stereotype) Representat

10、ionShapeTubePyramidCube(stay tuned for realization relationships)Shapedraw()move()scale()rotate()TubePyramidCube13Structural things - CollaborationA collaboration is a society of classes, interfaces, and other elements that work together to provide some cooperative behavior thats bigger than the sum

11、 of all its parts.You use collaborations to specify the realization of use cases and operations, and to model the architecturally significant mechanisms of your system.Graphically, a collaboration is rendered as an ellipse with dashed lines.14Structural things Use Casea use case is a description of

12、set of sequence of actions that a system performs that yields an observable result of value to a particular actor. A use case is realized by a collaboration. Graphically, a use case is rendered as an ellipse with solid lines, usually including only its name.LoginLogin15Structural things Active Class

13、an active class is a class whose objects own one or more processes or threads and therefore can initiate control activity. An active class is just like a class except that its objects represent elements whose behavior is concurrent with other elements. Graphically, an active class is rendered as a c

14、lass with double lines on the left and right; it usually includes its name, attributes, and operations.EventManagersuspend()flush()16Structural things ComponentA component is a modular part of the system design that hides its implementation behind a set of external interfaces.The implementation of a

15、 component can be expressed by wiring together parts and connectors. Graphically, a component is rendered like a class with a special icon in the upper right corner.17Structural things ArtifactAn artifact is a physical and replaceable part of a system that contains physical information (bits).An art

16、ifact typically represents the physical packaging of source or run-time information.Graphically, an artifact is rendered as a rectangle with the keyword artifact above the name.Login.dll18Structural things Nodea node is a physical element that exists at run time and represents a computational resour

17、ce, generally having at least some memory and, often, processing capability. A set of components may reside on a node and may also migrate from node to node. Graphically, a node is rendered as a cube, usually including only its name.Node #119Behavioral thingsthe verbs of UML models.the mostly dynami

18、c parts of a modelthree primary kinds: Among a set of objects: interactionFor an object: state machineThe sequence of steps: activity20Behavioral things - Interactionan interaction is a behavior that comprises a set of messages exchanged among a set of objects within a particular context to accompli

19、sh a specific purpose.An interaction involves a number of other elements, including messages, action sequences (the behavior invoked by a message), and links (the connection between objects).Graphically, a message is rendered as a directed line, almost always including the name of its operation.disp

20、lay()21Behavioral things - State machineA state machine is a behavior that specifies the sequences of states an object or an interaction goes through during its lifetime in response to events, together with its responses to those events. A state machine involves a number of other elements, including

21、 states, transitions, events, and activities. Graphically, a state is rendered as a rounded rectangle, usually including its name and its substates, if any.waiting22Behavioral things - ActivityAn activity is a behavior that specifies the sequence of steps a computational process performs In an activ

22、ity, the focus is on the flows among steps without regard to which object performs each step. A step of an activity is called an action.Graphically, an action is rendered as a rounded rectangle with a name indicating its purpose. States and actions are distinguished by their different contexts. wait

23、ing23Grouping thingsGrouping things are the organizational parts of UML models.Packages are the basic grouping things with which you may organize a UML model. There are also variations, such as frameworks, models, and subsystems (kinds of packages)A package is purely conceptual (meaning that it exis

24、ts only at development time). Graphically, a package is rendered as a tabbed folder.24Annotational things - NoteAnnotational things are the explanatory parts of UML models. A note is simply a symbol for rendering constraints and comments attached to an element or a collection of elements. Graphicall

25、y, a note is rendered as a rectangle with a dog-eared corner, together with a textual or graphical comment.One of these is executed: 252) Relationships in the UMLThere are four kinds of relationships in the UML:Association (has a)Dependency (use)Generalization (is a)Realization (realize)26Relationsh

26、ips - AssociationAssociation is a semantic relationship between two or more classes that specifies connections among their instances A structural relationship that describes a set of links. A link specifies a path along which one object can dispatch a message to another (or the same)object.Professor

27、UniversityEmployerEmployeeRole NamesWorks forAssociationAssociation Name27Aggregation is a special form of association that models a whole-part relationship between an aggregate (the whole) and its parts28Composition is a form of aggregation with strong ownership and coincident lifetimes. The parts

28、cannot survive the whole/aggregate 29Relationships- DependencyA relationship between two model elements where a change in one may cause a change in the otherNon-structural, “using” relationshipClientSupplierPackageClientPackageSupplierPackageClientSupplierClassDependency relationshipDependency relat

29、ionshipComponent30ProfessorCourseclass Professor public void teach(Course c) . .class Professor public void teach() Course c = new Course(); . .31Relationships - GeneralizationA relationship among classes where one class shares the structure and/or behavior of one or more classesDefines a hierarchy

30、of abstractions in which a subclass inherits from one or more superclassesclass Employee .class Manager extends Employee .class Engineer extends Employee 32Relationships - RealizationOne classifier serves as the contract that the other classifier agrees to carry out33CircleShapeinterface Shape publi

31、c void draw() ; class Circle implements Shape public void draw() . 34Relationships - Example353) Diagrams in the UMLA diagram is the graphical presentation of a set of elementsA diagram is a view into a modelA model is a complete description of a systemfrom a particular perspective36Nine Diagrams in

32、 the UML 1.xDeploymentDiagramsuse-caseDiagramsScenarioDiagramsScenarioDiagramsSequenceDiagramsStateDiagramsStateDiagramsStateDiagramsComponentDiagramsComponentDiagramsComponentDiagramsModelsStateDiagramsStateDiagramsObjectDiagramsScenarioDiagramsScenarioDiagramsCollaborationDiagramsActivityDiagramsS

33、tateDiagramsStateDiagramsClassDiagrams37Diagrams in the UML 2.0Class diagram Object diagramsComponent diagramsComposite structure diagramState diagramDeployment diagramInteraction diagrams communication and sequence diagramsActivity diagramPackage diagramTiming diagramInteraction overview diagram38C

34、hapter 13Chapter 28Chapter 16Chapter 29Chapter 10Chapter 5Chapter 15Chapter 3839Diagram for Structural ModelingClass DiagramObject DiagramComponent DiagramDeployment Diagram40Diagrams - Class DiagramClass diagram shows a set of classes, interfaces, and collaborations and their relationshipsCaptures

35、the vocabulary of a systemPurposeName and model concepts in the systemSpecify collaborationsSpecify logical database schemas4142Diagrams - Component DiagramA component diagram shows the organizations and dependencies among software components, including source code components, binary code components

36、, and executable components.Captures the physical structure of the implementationPurposeOrganize source codeConstruct an executable releaseSpecify a physical database4344Diagrams - Deployment DiagramA deployment diagram is a diagram that shows the configuration of run time processing nodes and the c

37、omponents that live on them.Captures the topology of a systems hardwarePurposeSpecify the distribution of componentsIdentify performance bottlenecks4546Diagram for behavioral ModelingUse Case Diagram Interaction Diagramsequence diagrams communication diagramsStateChart DiagramActivity Diagram47Diagr

38、ams - Use Case diagramA use case diagram is a diagram that shows a set of use cases and actors and their relationships.Use case diagrams can model the the behavior of a system-the outwardly visible services that the system provides in the context of its environment.Purposemodel the context of a syst

39、emmodel the requirements of a system4849Diagrams Interaction diagramAn interaction diagram shows an interaction, consisting of a set of objects and their relationships, including the messages that may be dispatched among them.It models the dynamic aspects of a system.PurposeModeling flows of control

40、 by time orderingModeling flows of control by organizationSequence DiagramsCommunication Diagrams50Diagrams - Sequence DiagramA sequence diagram is an interaction diagram that emphasizes the time ordering of messages.The diagram showsThe objects participating in the interaction.The sequence of messa

41、ges exchanged.51Diagrams Communication DiagramA Communication Diagram emphasizes the organization of the objects that participate in an interaction.The Communication diagram showsThe objects participating in the interaction.Links between the objects.Messages passed between the objects.52Diagrams - S

42、tatechart diagramA statechart diagram shows a state machine, consisting of states, transitions, events, and activities.Statechart diagrams emphasize the event-ordered behavior of an object, which is especially useful in modeling reactive systems.53Diagrams - Activity DiagramAn activity diagram shows

43、 the flow from activity to activity.Purposemodel a workflowfocus on activities as viewed by the actors that collaborate with the systemmodel an operationuse activity diagrams as flowcharts, to model the details of a computation54Several elementsAction statesTransitionsDecisionsguard conditionssynchr

44、onization bar55Diagram - Composite structure diagramHierarchically decompose a class into an internal structureTake a complex object and break it down into parts56Diagrams - Package DiagramsA package is a grouping construct that allows you to take any construct in the UML and group its elements toge

45、ther into higher-level unitsA package diagram shows packages and their dependenciesIn a medium to large system, package diagramcan be used to control the large-scale structure of the system57Diagram - Interaction overview diagramInteraction overview diagrams are a graftingtogether of activity diagra

46、ms and sequence diagrams58Diagram - Timing DiagramTiming diagrams are useful for showing timing constraints between state changes on different objects in real,embedded systems59Common Mechanisms in the UMLUML is made simpler by the presence of four common mechanisms that apply consistently throughou

47、t the language1) Specifications2) Adornments3) Common divisions4) Extensibility mechanisms601) SpecificationsThe UML is more than just a graphical language. Rather, behind every part of its graphical notation there is a specification that provides a textual statement of the syntax and semantics of t

48、hat building block.Use the UMLs graphical notation to visualize a system; Use the UMLs specification to state the systems details.612) AdornmentsEvery element in the UMLs notation starts with a basic symbol, to which can be added a variety of adornments specific to that symbol.623) Common divisionsI

49、n modeling object-oriented systems, the world often gets divided in at least a couple of waysThe division of class and objectA class is an abstraction; an object is one concrete manifestation of that abstractionThe separation of interface and implementationAn interface declares a contract, and an im

50、plementation represents one concrete realization of that contract, responsible for faithfully carrying out the interfaces complete semanticsUse case and CollaborationOperation and Method634) Extension mechanismThe UML is opened-ended, making it possible for you to extend the language in controlled w

51、ays Stereotype Tagged value Constraint64Extension mechanism - StereotypesA stereotype is an extension of the vocabulary of the UML, allowing you to create new kinds of building blocks similar to existing ones but specific to your problem.Stereotypes must be based on certain existing types or classes

52、 in the metamodel. Certain stereotypes are predefined in the UML, others may be user defined.65Extension mechanism - Tagged ValuesA tagged value is an extension of the properties of a UML element, allowing you to create new information in that elements specification. A tagged value is a keyword-valu

53、e pair that may be attached to any kind of model element The keyword is called a tag. Common examples of tagged values are:Author = (Dave,Ron)Version Number = 3Location = d:javaumlexamplesLocation = Node: Middle TierMyClassVersion = 1.0266Extension mechanism - ConstraintA constraint is an extension

54、of the semantics of a UML elements, allowing you to add new rules or to modify existing ones. Constraints may be written as free-form text or use the UMLs Objec Constraint Language(OCL).67Common Modeling Techniques1) Modeling Comments - use notes 2) Modeling New Building Blocks - use stereotype.3) Modeling New Prop

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論