Class Diagram View of Software Architectures – MATLAB & Simulink

Class Diagram View of Software Architectures

Use class diagrams to display a graphical representation of the structure of a
software architecture model. You can also use spotlight views to analyze component
dependencies and hierarchy, and you can use component hierarchy views to visualize the
component hierarchy as a tree diagram. For more information, see Create Spotlight Views and Display Component Hierarchy and Architecture Hierarchy Using Views.

A class diagram is a graphical
representation of a static structural model that displays unique architecture types of the
software components optionally with software methods and properties.

Class diagrams capture one instance of each referenced model and show relationships between them. Any component diagram view can be optionally represented as a class diagram for a software architecture model.

Software Architecture with Class Diagram View

Open Model

This example uses a software architecture model with functions, stereotypes, and properties to explore class diagrams in the Architecture Views Gallery. Open the model to follow the steps in this tutorial.

Interact with Class Diagram View

  1. Simulate the model to compile it and populate functions. On the toolstrip,
    click Run. Alternatively, update the model to compile
    it by navigating to Modeling > Update Model.

  2. To open the Architecture Views Gallery, navigate to Modeling > Architecture Views.

  3. From the View Browser, select the View 1 view.

  4. To open the class diagram view, click Diagram > Class Diagram.

    Software architecture class diagram view.

    The class diagram consists of:

    • A class box for each unique component type, including reference
      components.

    • A class box as the root that corresponds to the root architecture
      of the top model.

    • Composition connections between the types.

    If there are multiple instances of the same type of component, for
    example, multiple components that reference the same model across the model
    hierarchy, then the type of the component is still represented as one unique
    box. The component will also relate to its parents and children via multiple
    composition connections.

  5. You can select Hide methods to simplify the output by
    removing software functions from the diagram. Select Hide
    properties
    to hide information about stereotypes and property
    values applied to the components.

    Class diagram menu option.

Edit Function Properties Using Property Inspector

You can select functions in the class diagram view of a software architecture
and edit properties of the selected functions using the Property
Inspector
.

To edit function properties:

  1. Select a function in a root architecture, component architecture, or
    service interface.

  2. Edit the function properties in the Property Inspector of the view. Properties can include the
    function name, function stereotype, or, for service interfaces, the
    function prototype.

  3. When you finish editing, you can see the updated function in the class
    diagram view.

When you modify the properties of a function in the class diagram view, your
changes also get propagated to the Functions Editor and the Interface Editor.

Edit function name from Property Inspector of class diagram view

Client-Server Interfaces in Class Diagram View

Open Live Script

Class diagrams display service (client-server) interfaces. The diagram shows the service interface classes and available services.

In this example, a software architecture has two components that are connected with client and server ports. The Interface Editor shows the interface assigned to the client and server ports.

model = systemcomposer.openModel(

"SoftwareArchitectureClientServer"

);

2022-04-19_11-48-00.png

openViews(model)

To open the class diagram view, from the View Browser, select ServiceInterfaces.

This is the class diagram view of the software architecture.

  • The icon on the upper right of the component distinguishes the service interface class.

  • The service interface class contains function prototypes as services.

  • The diagram displays an aggregation connection for the client port.

  • The diagram displays a composition connection for the server port.

2022-02-20_8-50-37.png

Related Topics