Class Diagram

Innoslate's Class Diagram is a type of static structure diagram that describes the structure of a system by showing the system’s classes, attributes, operations (or methods), and the relationships among objects.

Using Class Diagrams

Function Description
Creating Class Diagrams Using ‘Diagrams View’ in Innoslate, you can create a new ‘Class Diagram.’
Class Diagram Constructs The ‘Class Diagram’ supports six unique diagram constructs: a ‘Class,’ an ‘Operation,’ an ‘Attribute,’ an ‘Input Parameter,’ a ‘Return Type,’ and a ‘Logical Connection.’
Adding a Class ‘Class’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Adding an Operation An ‘Operation’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Adding an Attribute An ‘Attribute’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Adding an Input Parameter An ‘Input Parameter’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Adding a Return Type ‘Return Type’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Adding a Logical Connection ‘Logical Connection’ construct can be added to a ‘Class Diagram’ via drag-and-drop.
Removing a Construct A construct can be easily removed from a ‘Class Diagram.’
Assigning a Parent Class A parent class can be assigned in a ‘Class Diagram’ via drag-and-drop.
Importing Java classes Import Java classes into the ‘Class Diagram’.

 

‘Class Diagram’ in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, attributes, operations (or methods), and the relationships among objects.

class diagram overview

Creating Class Diagrams

Within the ‘Diagrams Dashboard,’ users can create a new diagram by clicking the ‘ Create Diagram’ button in the top right corner of the page.

create diagram

 

Clicking the ‘ Create Diagram’ button will open the Create Diagram dialog where you will be directed through the process of creating a new diagram.

Create a Class Diagram

  1. Choose Which Type of Diagram to Create
    In step 1, select ‘Class Diagram,’ under ‘General,’ as your diagram type.

                create_class_step1-1

     

    Click the ‘Next’ button.

               create_class_step1-2

  2. Specify New Root Action Information
    In step 2, you will be prompted to input a diagram ‘Name,’ ‘Number’ (optional), and ‘Description’ (optional). Then, click the ‘Next’ button to save and automatically open your new Class Diagram.
    create_class_step2

Class Diagram Constructs

The ‘Class Diagram’ supports six unique diagram constructs: a ‘Class,’ an ‘Operation,’ an ‘Attribute,’ an ‘Input Parameter,’ a ‘Return Type,’ and a ‘Logical Connection.’ Each diagram construct is described in more detail below:

  • Class

    In the system model, an Asset entity is used to represent a ‘Class’ construct. A ‘Class’ must be added to the diagram first before any of the other constructs can be added. In the diagram, this construct is represented as a rounded box that contains the name of the ‘Class.’

    class construct class diagram

  • Operation

    In the system model, an Action entity is used to represent an ‘Operation’ construct. A ‘Class’ must be added to the diagram first before this construct can be added. In the diagram, this construct is represented as a line of text containing the name of the ‘Operation’ in an “Operations” section of the ‘Class.’

    operation construct class diagram

  • Attribute

    In the system model, a Characteristic entity is used to represent an ‘Attribute’ construct. A ‘Class’ must be added to the diagram first before this construct can be added. In the diagram, this construct is represented as a line of text containing the name of the ‘Attribute,’ a semicolon, and the units of the ‘Attribute’ in an “Attributes” section of the ‘Class.’

    attribute construct class diagram

  • Input Parameter

    In the system model, an Input/Output entity is used to represent a ‘Input Parameter’ construct. An ‘Operation’ must first be added to a ‘Class’ in the diagram before this construct can be added. In the diagram, this construct is represented as a line of text containing the units of the ‘Input Parameter’ in parenthesis.

    input construct class diagram

  • Return Type

    In the system model, an Input/Output entity is used to represent a ‘Return Type’ construct. An ‘Operation’ must first be added to a ‘Class’ in the diagram before this construct can be added. In the diagram, this construct is represented as a semicolon and a line of text containing the units of the ‘Return Type.’

    return type construct class diagram

  • Logical Connection

    In the system model, a Logical entity is used to represent a ‘Logical Connection’ construct. At least two ‘Class’ constructs must be added to the diagram first before a ‘Logical Connection’ can be added. In the diagram, this construct is represented as a solid line connecting two ‘Class’ constructs and a line label containing the name of the ‘Logical Connection.’

    logical connection construct class diagram

Adding a Class

‘Class’ construct can be added to a ‘Class Diagram‘ via drag-and-drop. A ‘Class’ must be added to the diagram first before any of the other constructs can be added.

  1. Within a ‘Class Diagram,’ click the ‘Class (Asset)’ icon in the ‘New’ tab of the left sidebar and continue to hold down the left mouse button.

    add_class_step1

  2. Drag the ‘Class (Asset)’ icon over to the adjacent diagram canvas.

    add_class_step2

  3. Release the left mouse button while over the diagram canvas to drop the new ‘Class’ and add it to the diagram.

    add_class_step3

     

    Notice the ‘Class’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  4. Once added to the diagram, enter a meaningful ‘Name’ for your new ‘Class’ via the ‘Attributes’ tab of the left sidebar (focused automatically for convenience).

    add_class_step4

  5. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_class_step5

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Adding an Operation

An ‘Operation’ construct can be added to a ‘Class Diagram‘ via drag-and-drop. A ‘Class‘ must be added to the diagram first before this construct can be added.

  1. Within a ‘Class Diagram,’ click the ‘Operation (Action)’ icon in the ‘New’ tab of the left sidebar and continue to hold down the left mouse button.

    add_operation_step1-1

  2. Drag the ‘Operation (Action)’ icon over to the bottom section of the destination ‘Class’ of your choice.

    add_operation_step2-1

  3. When the ‘Class’ box highlights green, release the left mouse button to drop the new ‘Operation’ and add it to the diagram.

    add_operation_step3-1

     

    Notice the ‘Operation’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  4. Once added to the diagram, enter a meaningful ‘Name’ for your new ‘Operation’ via the ‘Attributes’ tab of the left sidebar (focused automatically for convenience).

    add_operation_step4-1

  5. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_operation_step5-1

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Adding an Attribute

An ‘Attribute’ construct can be added to a ‘Class Diagram‘ via drag-and-drop. A ‘Class‘ must be added to the diagram first before this construct can be added.

  1. Within a ‘Class Diagram,’ click the ‘Attribute (Characteristic)’ icon in the ‘New’ tab of the left sidebar and continue to hold down the left mouse button.

    add_attribute_step1

  2. Drag the ‘Attribute (Characteristic)’ icon over to the middle section of the destination ‘Class’ of your choice.

    add_attribute_step2

  3. When the ‘Class’ box highlights green, release the left mouse button to drop the new ‘Attribute’ and add it to the diagram.

    add_attribute_step3

     

    Notice the ‘Attribute’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  4. Once added to the diagram, enter a meaningful ‘Name’ for your new ‘Attribute’ via the ‘Attributes’ tab of the left sidebar (focused automatically for convenience).

    add_attribute_step4

  5. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_attribute_step5

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Adding an Input Parameter

An ‘Input Parameter’ construct can be added to a ‘Class Diagram‘ via drag-and-drop. An ‘Operation‘ must first be added to a ‘Class‘ in the diagram before this construct can be added.

  1. Within a ‘Class Diagram,’ click the ‘Input Parameter (Input/Output)’ icon in the ‘New’ tab of the left sidebar and continue to hold down the left mouse button.

    add_inputparam_step1

  2. Drag the ‘Input Parameter (Input/Output)’ icon over to the bottom section of the ‘Class’ of the destination ‘Operation’ of your choice.

    add_inputparam_step2

  3. When the ‘Operation’ box highlights green, release the left mouse button to drop the new ‘Input Parameter’ and add it to the diagram.

    add_inputparam_step3

     

    Notice the ‘Input Parameter’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  4. Once added to the diagram, you can specify the unit(s) for your ‘Input Parameter’ under the ‘Attributes’ tab of the left sidebar.

    add_inputparam_step4


  5. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_inputparam_step5

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Adding a Return Type

‘Return Type’ construct can be added to a ‘Class Diagram‘ via drag-and-drop. An ‘Operation‘ must first be added to a ‘Class‘ in the diagram before this construct can be added.

  1. Within a ‘Class Diagram,’ click the ‘Return Type (Input/Output)’ icon in the ‘New’ tab of the left sidebar and continue to hold down the left mouse button.

    add_return_class_step1

  2. Drag the ‘Return Type (Input/Output)’ icon over to the bottom section of the ‘Class’ of the destination ‘Operation’ of your choice.

    add_return_class_step2

  3. When the ‘Operation’ box highlights green, release the left mouse button to drop the new ‘Return Type’ and add it to the diagram.

    add_return_class_step3

     

    Notice the ‘Return Type’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  4. Once added to the diagram, you can specify the unit(s) for your ‘Return Type’ under the ‘Attributes’ tab of the left sidebar.

    add_return_class_step4

  5. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_return_class_step5

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Adding a Logical Connection

‘Logical Connection’ can be added to the ‘Class Diagram‘ via drag-and-drop. The example used on this page connects two ‘Class‘ constructs with a ‘Logical Connection.’

  1. Within a ‘Class Diagram,’ select the ‘Class’ you would like connected to another ‘Class.’

    add_logical_class_step1

  2. Click the green circle and continue to hold down the left mouse button.

    add_logical_class_step2

  3. Drag the green circle over to another ‘Class’ of your choice.

    add_logical_class_step3

  4. When the parent ‘Class’ box highlights green, release the left mouse button over the ‘Simple Association (connected by)’ section to drop the new ‘Logical Connection’ and add it to the diagram.

    add_logical_class_step4

     

    Notice the ‘Logical Connection’ stays selected once it has been dropped. Since it is selected, the toolbar changes to include buttons for functions that can be used on the construct. The sidebar also changes to include additional ‘Metadata,’ ‘Attributes,’ and ‘Relationships’ tabs.

  5. Once added to the diagram, enter a meaningful ‘Name’ for your new ‘Logical Connection’ via the ‘Attributes’ tab of the left sidebar (focused automatically for convenience).

    add_logical_class_step5

  6. If wanting to change the logical connection type, select the ‘Paths’ button. You can select ‘Aggregation (related to),’ ‘Composition (decomposed by),’ ‘Generalization (extend),’ or ‘Simple Association (connected by).’

    add_logical_class_step6

  7. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    add_logical_class_step7

* Note: The above process describes using the ‘New’ tab of the left sidebar, which automatically generates a new entity to represent each new diagram construct. If you would like to reuse existing entities from your database to represent a new construct, use the ‘Existing’ tab instead.

Removing a Construct

A construct can be easily removed from a ‘Class Diagram.’

  1. Within a ‘Class Diagram,’ select the construct you wish to remove. This will make the toolbar appear with applicable functions which can be used on the selected construct.

    removing_class_step1

  2. Click the  ‘Remove’ button to remove the construct from the diagram (as the default action).

    removing_class_step2

    * Note: The  ‘Remove’ button also includes a drop-down menu where you can select ‘Delete from Database’ or the default option of ‘Remove from Diagram.’

Assigning a Parent Class

The parent of a ‘Class’ construct can be assigned in the ‘Class Diagram‘ via drag-and-drop. Both the “to-be” parent and child ‘Class’ constructs must be added to the diagram first before the parent can be assigned.

  1. Within a ‘Class Diagram,’ select the ‘Class’ you would like to assign as the parent.

    assign_parent_class_step1

  2. Click the green circle and continue to hold down the left mouse button.

    assign_parent_class_step2

  3. Drag the green circle over to the child ‘Class’ of your choice.

    assign_parent_class_step3

  4. When the child ‘Class’ box highlights green, release the left mouse button over the ‘Composition’ section to add a decomposed by relationship.

    assign_parent_class_step4

  5. Once added to the diagram, the new relationship should appear as a filled diamond shape and directional arrow from the parent to the child ‘Class’ construct.

    assign_parent_class_step5

  6. Click the ‘Save’ button located on the toolbar to persist your changes to your project’s database.

    assign_parent_class_step6

Importing Java Classes

The Class diagram can import java classes and convert them into class diagrams.

Importing a Java Class

Java code can be added to a ‘Class Diagram’ via the ‘Import Java’ button on the toolbar.

  1. Within a ‘Class Diagram’, click the ‘Import Java’ button on the toolbar.

    Class_Import_Button-1

  2. There are 2 import options for your Java class: text and file upload.
    To upload text, simply paste your Java class code into the text box.

    Class_Import_Modal_Text


    To upload a file, drag and drop your .java file over the drop area, or click within the drop area to browse your computer’s file system to select the file to upload.

    Class_Import_Modal_File

  3. Verify that your Java file contains a package statement and the code uses valid Java 8 syntax. Once you have uploaded your file, click ‘Apply’ to parse the Java file into the ‘Class Diagram.’

    Class_Imported-1

  4. Assets (Java class), Attributes (Java class variables) and Operations (Java methods) are each parsed into the different Innoslate entities on the ‘Class Diagram’. For Attributes and Operations, the modifiers and annotations are added to the entity’s description. The Java type (i.e. intString, etc.)  is added to the entity’s ‘Units’ attribute. If the class variable was given an initial value in the declaration, that value is added to the entity’s ‘Value’ attribute.
Class_Edit2
Class_Edit

The Java importer supports all of the basic Java 8 class structures, including ConcreteEnumStaticFinalAbstract, and Interface.
The importer also supports nested classes which will be parsed into separate Assets and will draw the decomposition relationship between the 2 Assets if the outer Java class extends or implements the inner class.

 

To continue learning about General Diagrams, Click Here.

(Next Article: Class Diagram Modifications & Settings)