360 likes | 623 Views
面向对象分析与设计. Use of starUML. By Wang Meihong. Outline. Managing Project Creating a new element Modeling with UseCase Diagram Modeling with Sequence Diagram Modeling with other Diagram Generating Codes and Documents. Managing Project.
E N D
面向对象分析与设计 Use of starUML By Wang Meihong
Outline • Managing Project • Creating a new element • Modeling with UseCase Diagram • Modeling with Sequence Diagram • Modeling with other Diagram • Generating Codes and Documents
Managing Project • In order to work on a new software development, a new project must be created. You may start with a completely empty project or with a new project that has been initialized according to a specific approach.
Procedure for Creating New Project • New Project: • Select the [File] -> [New Project] menu. • Select New Project Dialog Box : • Select the [File]-> [Select New Project…] menu. • In the dialog box, you can set the default approach. • Approach is applied in the beginning of the project to determine the initial model structure.
Approach For Rational Software • Rational Rose is organised around the following views of a software project: • Use Case • Logical • Component • Deployment
Approach For Rational Software——Use case view • The use-case view helps you to understand and use the system. • This view looks at how actors and use cases interact. • The diagrams in this view are: • Use-case diagrams • Sequence diagrams • Collaboration diagrams • Activity diagrams • This view contains a Main diagram by default.Additional diagrams can be added throughout the analysis and design process.
Approach For Rational Software——Logical view • The logical view looks at classes and their relationships. • The diagrams in this view are: • Class diagrams • Statechart diagrams.
Approach For Rational Software——Component view • The component view addresses the software organisation of the system. • This view contains only component diagrams.
Approach For Rational Software——Deployment view • The deployment view shows the mapping of processes to hardware. This type of diagram is most useful in a distributed architecture environment where you might have applications and servers at different locations. • This view contains only the deployment diagram.
Other procedures for project management (1) • Opening Project • Select the [File] -> [Open] menu. • Saving Project • Select the [File] -> [Save] menu. (××.uml) • Closing Project • Select the [File] -> [Close] menu
Other procedures for project management(2) • Importing a Framework • In order to use a framework in a project, the framework must be loaded. Once a framework is loaded, all the elements contained in the framework can be used. • Procedure for Importing Framework: • Select the [File] -> [Import] -> [Framework…] menu. • At the Import Framework dialog box, select a framework to import and click the [OK] button. • The Select Element dialog box appears, to determine which element will contain the framework to import. Select an element (package, model, subsystem, or project) to contain the framework and click the [OK] button. • The framework is added to the selected element.
How to manage a project separately by each developers • Procedure for Creating New Unit: • Only Package, Model and Subsystem elements can be saved as units. • Select an element (package, model or subsystem) to make into a unit, then use the menu.
Procedure for Merging Unit • If the elements in a unit no longer need to be managed as a separate unit, the unit file can be merged with the project. • Select from the model explorer an element (project, model, package or subsystem) that will contain the unit to import. • Right-click and select the [Unit] -> [Uncontrol Unit…] menu. • The unit is merged with the selected project or parent unit. • Note Merging a unit does not automatically delete the unit file (.UNT). Please delete it manually if no longer required.
Procedure for Saving/Saving as Unit Select the unit to save from the model.
Creating a new element(1) create a new element in the diagram from the pallet. • Select an element type to create from the pallet. • Click a location in the diagram area to create the element. (Drag the mouse to select an area to specify the size of the new element. If creating an element that connects two elements together, ensure that the connection is made accurately.) Note: • Click one element twice to create multiple elements. • Click the the item in the pallet when creating elements is complete
Creating a new element(2) • Besides creating a new element in the diagram from the pallet, view elements can also be created for existing model elements. • Select from the model explorer a model to be represented by the new view element. • Drag the model element and drop it in the diagram area to create a view element (In this case, the connections to all the related elements are automatically displayed).
Enter or double click Enter or Click the other place Creating a new element(3) • Elements can also be created by using the shortcut Generation Syntax. • Select from the diagram area the view. • Run Quick Dialog as selecting [Enter]. • Enter a syntax that is element in the quick dialog. • (see <Creating Element by using ShortCut Generation Syntax> in help file.)
Organizing Model Structure • Creating Model Element • Select from the model explorer an element to contain the new model element. • Right-click and select the [Add] menu and select an element type from the menu. Or, select the [Model] -> [Add] menu from the main menu. • The new model element will be created under the selected model. • Deleting Model Element • Moving Model Element(drag) • Modify Model Element Order • Model Alignment
Modeling with UseCase Diagram(1) • Can change element's view style: • select [Format] -> [Stereotype Display] menu. • select [Decoration] item in [ ] combo button on toolbar
Modeling with UseCase Diagram(2) Use the properties view to edit the properties of an element Right click an element and click [collection editor] menu
Modeling with Sequence Diagram(1) • Object: • If the class has been existed, create object from class: • Drag the class icon in the model explorer into the sequence diagram; • If you want existing class to be assigned to object, click button in object's classifier property, and select class to be assigned to object at the [Select a model element] dialog. • If the class does not exist until now: Add class The class will be added, and it can be seen in the model explorer.
Modeling with Sequence Diagram(2) • Stimulus To create operation of class as stimulus's receiver from object and assign it to stimulus To assign existed operation to stimulus Enter the stimulus name at the quick dialog and press [Enter] key testMessage not added to the class
The [ActionKind] property of stimulus should be assigned to one of five sort as following. To change [ActionKind] property, select stimulus and select the [ActionKind] property on the properties window.
Modeling with Sequence Diagram(3) • Combined Fragment Change interaction operator in the properties
Modeling with Sequence Diagram(4) • Diagram
Modeling with Sequence Diagram(5) • Convert sequence diagram to collaboration diagram • Convert collaboration diagram to sequence diagram
Modeling with other Diagram • Modeling with Class Diagram • Modeling with Statechart Diagram • Modeling with Collaboration Diagram • Modeling with Activity Diagram • Modeling with Component Diagram • Modeling with Deployment Diagram • Modeling with Composite Structure Diagram Note the properties of each element.
Generating Codes and Documents(1) • Generating Artifacts • Select [Tools]->[StarUML Generator...] Menu • In the [Select templates for generation] Page, Check templates to generate in the ListBox and Click [Next] Button. …… If you want to generate a set of artifacts at once, you can make a batch that used to generate a set of artifacts and can run the batch without selecting a set of templates. Create a new batch containing selected templates: In the [Select templates for generation] Page, check templates, to make as a batch, in [List of templates] tab, and click [Register to Batch] button.
Generating Codes and Documents(2) • Installing and Uninstalling Templates • Templates are installed under the folder "<STARUML_INSTALL_PATH>\modules\staruml-generator\templates" • Batches are under the folder "<STARUML_INSTALL_PATH>\modules\staruml-generator\batches". • In general, one template matches one folder and the folder contains all files associated to the template. A template includes at least two files. The first is template description file (.tdf) and the second is the template document (.cot, .doc, .xls, .ppt, ...). Batch includes one file that is batch file (.btf). • Installing templates: Simply copy the template folder to the folder 1 • Uninstalling templates:Delete the template folder under the folder 2
Generating Codes and Documents(3) • Generating code Be sure the profiles you needed has been included in.