LambdaLegion UML Program (CWorld Version) V1.0

The UML Diagram (CLI Edition) is a command-line tool designed to help users create, manage, and visualize UML (Unified Modeling Language) diagrams directly from the terminal. Primary functionalities include adding, renaming, and deleting classes, relationships and attributes within a UML diagram.

Features

  • GUI: Program features a graphical user interface in additon to a CLI to interact with diagrams.
  • Class Management: Add, rename, and delete classes within your UML Diagram.
  • Attribute Handling: Manage attributes for each class, including adding, renaming, and deletion.
  • Relationship Management: Define and modify relationships between classes, such as association, inheritance, and composition.
  • Save/Load Functionality: Save your current diagram state to a JSON file and load it back into the application for continued management.
  • Export as Image: Export the diagram as a png image file.

Setup and Installation

Pre-Requisites

Python 3.10 or higher. You can download Python here

Download the Project

In a Terminal

To download the project directly into a terminal: 'git clone https://github.com/mucsci-students/2024sp-420-PythonB/releases/tag/v3.0.0'

In a Desktop Environment

Download the zip here and extract it.

Build the Project

It is recommended you use a virtual environment when running this program. Instructions for this can be found here.

The command to execute a python program varies with operating system. On Mac: python3. On Linux: on Windows: py. Python will be used below, substitute the command appropriate for your operating system in its place.

  1. Open a terminal and navigate to the folder that the project was cloned to.
  2. Navigate to the source directory of the project (its name should be 2024sp-420-PythonB)
  3. Enter your virtual environment (create one if you don't have one, instructions above)
  4. Type 'pip install -e .'.
  5. Type 'python main.py' to run the program in its default mode (Additional modes below).

Operation modes

  • python main.py - default operation mode, opens a GUI.
  • python main.py cli - runs the program in CLI mode.

If you are in the CLI mode, type 'help' for a the help menu. In the gui, use the menu options available at the top of the screen and along the left side of the window.

Commands for CLI

help class - Prints a help menu for class.
add class <class_name> - Adds a class.
delete class <class_name> - Deletes a class.
rename class <old_name> <new_name>- Renames a class from its old name to a new name.
list class <class_name> - Lists information about the given class.
list classes - Lists all classes in the diagram.

help relations - Prints a help menu for relations.
add relation <source> <dest> <type> - Adds a relation between a source class and destination class of a specified type.
delete relation <source> <dest> - Deletes the relation between source and dest
list relations - List all relations in diagram.
list relation <class_name> - List all relations containing the given class.

add field <class_name> <fld_name> - Adds a field to given class.
delete field <class_name> <fld_name> - Deletes a field from class.
rename field <class_name> <old_name> <new_name> - Renames a field

add method <class_name> <mthd_name> - Adds a method to a class.
delete method <class_name> <mthd_name> - Deletes a method from a class.
rename method <cls_name> <mth_name> <new_name> - Renames a method

add param <cls_name> <mthd_name> <param> - Adds a param to a method within a class.
delete param <cls_name> <mthd_name> <param> - Deletes a param from a method within a class.
rename param <cls_name> <mthd_name> <param_name> <new_name> - Renames a methods parameter within a class.

save <file_name> - Saves the diagram.
load <file_name> - Loads a diagram.
export <file_name> - Export the diagram as a png image file.
undo - Undoes the last command.
redo - Undoes an undo.
quit - Quits the program.

Test the project

'pytest' - from the source directory of the project, automatically finds and executes all test files.

Design Patterns

  • MVC - MVC is used as an organizational structure for the program. It can be seen in the names of the folders that contain controllers, the model, and the different views.

  • Singleton - The file uml_undo_redo.py contains a definition for a UML_States class; only one of these can ever exist in the program. The definition of __new__ only creates a new instance of the object if one is not already created.

  • Visitor - There are two examples of visitor in the program; uml_save_load.py and uml_list.py are both implementations of the uml_visitor.py interface, which in turn relies on accept methods defined in each other object in the model. This structure allows recursive descent through the diagram while storing extra location data (tab depth in the case of listing), which helps to keep listing and converting to json clean and maintainable.

  • Memento - The file uml_undo_redo.py contains a definition for a UML_States class; this class is an example of a memento for the diagram. Upon successful execution of a command, around line 38 of the file controller.py, the diagram is converted to JSON and stored as a state in that list. From there, undo and redo can be used to restore past or future diagram states. If a command or GUI action fails, the diagram will automatically revert to the last valid state (as can be seen around line 45 of the controller) if a valid state exists.

  • Decorator - The file controller.py is a decorator for the cli_controller.py and gui_controller.py files. controller.py has a method beginning around line 49 titled __pick_controller that decides which controller needs to be instantiated for the current instance of the program. That controller is then decorated with the functionality of controller.py, enabling it to run the program.

  • Factory - The GUI View has a factory for constructing all of the dialog boxes that the user interacts with, such as when adding a class to the diagram. The Diagram_Factory is towards the bottom of the GUI View under the Dialog Factory seperator.

Authors

January 2024 to March 2024:

  • Zhang Chen, Jillian Daggs, Katie Downlin, Patrick McCullough, Danish Zubari

March 2024 to Present:

  • Ganga Acharya, Marshall Feng, Peter Freedman, Adam Glick-Lynch, Tim Moser

Acknowledgments and Licenses

Third-Party Assets

  • Font: Anonymous Pro by Mark Simonson. This font is used under the SIL Open Font License (OFL). More information about this license is available at SIL Open Font License.