casual-simulation / casualos

Casual Open Simulation for the Web
https://ab1.bot
MIT License
48 stars 9 forks source link

Proposal: Add Unified Modeling Language Support #258

Open Techie09 opened 2 years ago

Techie09 commented 2 years ago

1 Proposal

To Enhance CasualOS experience with basic implementation of UML (Unified Modeling Language) that provides the essential building blocks for creating complex UML components as a composition of bots.

2 Requirements

Below is a list of what I believe to be the requirements needed to create a minimally viable solution. Some requirements may seem to be an optional enhancement, but I feel that this list is essential to creating a useable feature.

2.1 Implement all UML Notation

described within the specifications found here: \ UML Specifications Document: Notations and DI Representations

2.2 Mirror UML component structure

CasualOS should mirror the UML component structure of each UML Notation Object as a CasualOS bot that contains child bots. Collectively the bots should render into a single visual.

2.3 UML Edge

From what I understand, a UML Edge defines 1 or more connectors to the UML Shape or Diagram. This means that each UML Shape or Diagram has one top-level property that defines a UML Edge. The UML Edge can only be initialized with a UML Edge (top-level) component.

2.4 Add Connector to Shape/Diagram

Initialize the start of a connector by clicking on the Shape or Diagram. A MenuPortal would open with the option to add a UML Connector to the Component. The start node and one other node would be created. The user will have to drag the final node to a component to link the end of the connector to another component.

2.5 Define Default Visual Styling

The default styling of the UML Notation Objects could effectively be a 3D extrusion of the 2D image.

2.6 Manage a Complex Connector Path

Connectors should contain a sequence of nodes that represent the path taken from start to finish. A Menu Option should be available To add another Node to the Path using the Mini MenuPortal.

3 Optional Enhancements

Here is a list of enhancements that I think would add value to the overall User experience without constraining the user's ability to customize the basic UML components.

3.1 Improve Visual Styling

Add Custom Styling and Create a Material-Style using the Custom Styles

The material style would essentially stack children on top of the parent with preset thickness of each object and spacing between the layers. please see the material design docs for more information on what the design specifications are when creating a layout.

3.2 Expose Nested Properties in Parent Component

An example of this would be the UML Comment. It contains a UMLLabel(comment) component which would contain a property to set the text value. Minimal viable product would just support setting the text value by navigating to the nested component and changing the necessary property. An improved solution could expose this property to the top-level component and provide an event for the change in value (OnLabelTextChanged for example) that could be used for saving, updating or validation purposes.

3.3 Add Validation

Validation could be added to enforce 2 main rules:

3.4 Auto Arrange

I know this has been implemented before. I'm not familiar with what algorithmic approach is to arrange UML diagrams. This wouldn't need to be perfect. Getting most edge-cases would be sufficient to make this a viable tool (much like pathfinding/AI it likely can't account for every scenario, but there is a point where it is useable)

3.5 Export

Would like to see the ability to Export the connected graph of UML components into a 2D format like pdf. or into a 3D format such as an stl.

3.6 Add Diagram Types as Templates

Add support to create Diagram Type Templates that predefine a layout and contain logic to properly expand the Template based on its purpose. While this would be restricting the user, it would reinforce the best practices for UML Design, and the user can always make a completely custom Diagram and use any combination of UML Objects to convey their needs.

4 Example Implementation

The example below demonstrates a rough idea of how a UML Comment could be initialized

4.1 Creating a UML Comment: SheetPortal View

By setting the form and subType, CasualOS could update the rendering of the object as a UML object

Note: that I did not go further into detail in the example, but it seems reasonable to think that mirroring the UML components as bots would make the most sense. I also did not manually create an example with a gridPortal view since I am still fairly new to using CasualOS.

Example1 "Example Implementation of SheetPortal"

5 References

Here is a list of links to the references used throughout this document:

Techie09 commented 2 years ago

I would be interested in learning how to go about implementing a UML Component in CasualOS so that it could be exported as an app or other consumable package. I could at least build the components to get the project started and then if added to the roadmap, the source code would be available to further develop a final solution.

I would like to see this implemented, as it would be great for prototyping UML Diagrams with team collaboration to develop, discuss and review the prototypes.