Modeling Your Application, Data or Service Creating Your UML Model
Outline caCORE SDK Process and boot camp workflow UML Model Basics (Optional) UML Modeling for SDK Model Naming Conventions Adding Classes and Attributes Exercise Objectives Discuss the SDK Process and boot camp workflow Identify the packages in which to create different portions of your model Discuss the naming conventions appropriate for a UML Model that will be run through the caCORE SDK process Add a new Class to your UML Model Add Attributes to your UML Model Session 1: Creating Your UML Model Session Overview
Modeling Your Application, Data or Service Metadata Reuse Semantically Annotating Your UML Model Transforming Your UML Model into caDSR Metadata SDK Code Generation Compatibility Review Process Creating a Node on the Grid
Modeling Your Application, Data or Service Metadata Reuse Semantically Annotating Your UML Model Transforming Your UML Model into caDSR Metadata SDK Code Generation Compatibility Review Process Creating a Node on the Grid
Session 0: UML Basics Why Model? Modeling achieves four aims: Helps you visualize a system Permits you to specify the structure or behavior of a system Guides you in constructing a system Documents the decisions you have made Build models of complex systems because they are difficult to comprehend in their entirety Build models to better understand the system you are developing.
Session 0: UML Basics What is UML? UML is a language for Visualizing Specifying Constructing Documenting The artifacts of a software system.
Session 0: UML Basics UML Visualizing Communicating conceptual models to others is prone to error unless everyone involved speaks the same language. There are things about a software system you can’t understand unless you build models. An explicit model facilitates communication.
Session 0: UML Basics UML Specifying UML allows you to build models that are precise, unambiguous and complete There are many UML diagram types caCORE utilizes one diagram type UML Class Diagram
Session 0: UML Basics UML Constructing UML models can be directly connected to a variety of programming languages. Maps to Java, C++, Visual Basic, etc. Tables in a RDBMS or persistent store in an OODBMS Permits forward engineering Permits reverse engineering
Session 0: UML Basics UML Documenting The UML addresses documentation of system architecture, requirements, tests, project planning, and release management. Use Case Diagram Actor A Use Case 1 Use Case 2 Use Case 3 Actor B Class Diagram GrpFile read( ) open( ) create( ) fillFile( ) rep Repository name : char * = 0 readDoc( ) readFile( ) (from Persistence) FileMgr fetchDoc( ) sortByName( ) DocumentList add( ) delete( ) Document name : int docid : int numField : int get( ) open( ) close( ) read( ) sortFileList( ) create( ) fillDocument( ) fList 1 FileList add( ) delete( ) 1 File read( ) read() fill the code.. Sequence Diagram user mainWndfileMgr : FileMgr repositorydocument : Document gFile 1: Doc view request ( ) 2: fetchDoc( ) 3: create ( ) 4: create ( ) 5: readDoc ( ) 6: fillDocument ( ) 7: readFile ( ) 8: fillFile ( ) 9: sortByName ( ) ƯÁ¤¹®¼¿¡ ´ëÇÑ º¸±â¸¦ »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù. ÈÀÏ°ü¸®ÀÚ´Â Àоî¿Â ¹®¼ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼ °´Ã¼¿¡ ¼³Á¤À» ¿äûÇÑ´Ù. È¸é °´Ã¼´Â ÀоîµéÀÎ °´Ã¼µé¿¡ ´ëÇØ À̸§º°·Î Á¤·ÄÀ» ½ÃÄÑ È¸é¿¡ º¸¿©ÁØ´Ù. Deployment Diagram Window95 ¹®¼°ü¸® Ŭ¶óÀ̾ðÆ®.EXE Windows NT ¹®¼°ü¸® ¿£Áø.EXE Windows NT Windows95 Solaris ÀÀ¿ë¼¹ö.EXE Alpha UNIX IBM Mainframe µ¥ÀÌŸº£À̽º¼¹ö Windows95 ¹®¼°ü¸® ¾ÖÇø´ ºÐ»ê ȯ°æÀÇ Çϵå¿þ¾î¹× ³×Æ®¿÷À¸·ÎÀÇ Á¤º¸ ½Ã½ºÅÛ ¿¬°á ¸ðµ¨ - À©µµ¿ì 95 : Ŭ¶óÀ̾ðÆ® - À©µµ¿ì NT: ÀÀ¿ë¼¹ö - À¯´Ð½º ¸Ó½Å: ÀÀ¿ë ¼¹ö ¹× µ¥ÀÌŸ ¼¹ö, Åë½Å ¼¹ö - IBM ¸ÞÀÎÇÁ·¹ÀÓ: µ¥ÀÌŸ ¼¹ö, Åë½Å ¼¹ö
Session 0: UML Basics Representing Objects in the UML An Object represents an entity, either physical, conceptual or software In UML an object is represented as a rectangle with an underlined name : Professor J Clark : Professor Named Object Anonymous Object Professor J Clark
Session 0: UML Basics What is a Class? A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. An object is an instance of a class. A class is an abstraction in that it Emphasizes relevant characteristics. Suppresses other characteristics.
Session 0: UML Basics A Sample Class Properties Name Location Days offered Credit hours Start time End time Class Course Behavior Add a student Delete a student Get course roster Determine if it is full
Session 0: UML Basics Representing Classes in UML A class is represented using a rectangle with three compartments: The class name The structure (attributes) The behavior (operations) Professor - name - employeeID : UniqueId - hireDate - status - discipline - maxLoad + submitFinalGrade() + acceptCourseOffering() + setMaxLoad() + takeSabbatical() + teachClass()
Session 0: UML Basics Relationship between Classes and Objects A class is an abstract definition of an object. It defines the structure and behavior of each object in the class. It serves as a template for creating objects. Classes are not collections of objects. Professor Jones Professor Smith Professor Allen Professor
Session 0: UML Basics What is an Attribute? An attribute is a named property of a class that describes the range of values that instances of the property may hold. A class may have any number of attributes Attributes Student - name - address - studentID - dateOfBirth
Session 0: UML Basics Attributes in Classes and Objects Class Objects Student - name - address - studentID - dateOfBirth :Student - name = “M. Modano” - address = “123 Main St.” - studentID = 9 - dateOfBirth = “03/10/1967” :Student - name = “D. Hatcher” - address = “456 Oak Ln.” - studentID = 2 - dateOfBirth = “12/11/1969”
Session 0: UML Basics Decomposing UML Class Diagrams into Metadata UML Class Diagrams form the basis for creating and registering semantically unambiguous caDSR metadata In the caDSR, a data element corresponds to the combination of a semantically enhanced class diagram attribute. UML ClasscaDSR Data Element ClassObject Class AttributeProperty Datatype (of the attribute)Representation data element concept value domain
Session 0: UML Basics Comparing Class Diagrams to Data Elements Class - attribute: datatype Data Element Data Element Concept Value Domain Property Object Class Permissible Values UML Class caDSR Data Element
Session 0: UML Basics Comparing Class Diagrams to Data Elements Gene - identifier: string Gene Identifier java.lang.string Gene Identifier java.lang.string Identifier Gene string UML Class caDSR Data Element
Session 0: UML Basics Review Exercise What is the class name? How many attributes does this UML class have? What are the attribute names? How many data types does this UML class use? How many data elements can be created from this one UML Class? Gene - identifier: string UML Class - title: string - symbol: string - OMIMID: string
Session 0: UML Basics Review Exercise - Answers What is the class name? Gene How many attributes does this UML class have? 4 What are the attribute names? identifier, title, symbol, OMIMID How many data types does this UML class use? 1 How many data elements can be created from this one UML Class? 4 Gene - identifier: string UML Class - title: string - symbol: string - OMIMID: string
Session 1: Creating Your UML Model Sample Class Diagram ClassName attributeName associationName Bi-directional Association Datatype Generalization Uni-directional Association Multiplicity Stereotype
Session 1: Creating Your UML Model Getting Started UML Modeling Tool NCICB Recommends Enterprise Architect System/project domain is drawn in UML Logical model describes target domain Data model describes database schema Object-relational mapping (maps classes to objects) All UML Models should be placed in the Logical View Package of the modeling tool
Session 1: Creating Your UML Model Getting Started caCORE SDK tools impose modeling guidelines Java naming conventions Package rules Element constraints The Data Model is required only for the SDK and Code Generation, it is ignored by the SIW and UML Loader Example Only UML class diagram elements may be used Cannot use interface, object, etc.
Session 1: Creating Your UML Model Class Naming Conventions Establish a scope for the convention Determine the authority that establishes a name Develop semantic rules for the source and content of words used in a name Formulate syntax rules for required word order Develop lexical rules covering controlled word lists, name length, character set, and language Set guidelines on uniqueness of names in context
Session 1: Creating Your UML Model Class Naming Conventions Cont’d Be consistent Adopt a case convention Avoid using class identifiers in attribute names Abbreviations and acronyms should be avoided Avoid technical jargon Never pluralize class or attribute names Add “Collection” to association ends with multiplicity >1
Session 1: Creating Your UML Model Adding Classes In the Project View, right click the Logical Model folder, select Add > Add Element Leave the Type selected as Class Enter the name of the class (remember the naming conventions) Select all check boxes Click OK The Details tab will display to add attributes
Session 1: Creating Your UML Model Adding Attributes to Classes Click Attributes Enter the name of the attribute in the name field (adhere to naming convention) Enter the datatype in the Type field Type in the java primitive or wrapper class, using the dropdown list can cause problems Click Save Click New to enter more attributes Click Close when finished Do NOT use the Link tab
Session 1: Creating Your UML Model Adding tags for definitions for classes Select the Class in the Project View Select Element > Tagged Values from the Main Menu OR CTRL+SHIFT+6 Click the new tag icon Enter “documentation” as the tag name Enter the class definition as the value DO NOT use Notes section for the definition
Session 1: Creating Your UML Model Adding tags for definitions for attributes Select the attribute Select Element > Tagged Values from the Main Menu OR use CTRL+SHIFT+6 Enter “description” for the tag name Enter the attribute’s definition in the value field. DO NOT use the Notes section for the definition
Session 1: Creating Your UML Model Associations From the Menu bar, select Link > Association, Aggregation or Generalization Click and hold one class (source), then drag the and drop to the second class (target) to create the link. Right click on the association and select Association Properties. Click the Source Role tab Enter the role name (className) Add “Collection” if >1 Select the Multiplicity from the dropdown Click OK Do the same for the Target Role
Session 1: Creating Your UML Model Adding Packages – Value Domains Package Value Domains should be located in a separate folder than the other classes, but still in the Logical Model Package.
Session 1: Creating Your UML Model Java Wrappers Java Wrapper classes can be added to appropriate package No need to add attributes
Session 1: Creating Your UML Model UML notations ignored by SIW/UML Model Loader Stereotypes (other than enumeration) Attribute multiplicity (use -1 to represent many) Options in Class and Attribute Details pages Scope Abstract class Cardinality (always use -1 to represent many) Operations in classes
Session 1: Creating Your UML Model Exercise Use the step by step instructions to Open an existing model file in Enterprise Architect Add a Class and Attribute to the existing diagram