- Before running the program, you must have Python installed (3.10.7 at the time).
- Download the most recent version of the repository.
git clone https://github.com/mucsci-students/2022fa-420-LigmaPy.git
- Once the repo is downloaded, install the required libraries with the below commands.
python3 -m pip install -r requirements.txt
- Download the latest version from the repo.
- Python 3.10 or higher is installed.
- In a terminal, navigate to the
/2022fa-420-Ligmapy/
directory. - To run the UML editor type:
python uml.py [--cli]
Note: Add the --cli flag to run the CLI editor
CLI Commands
addClass <name>
deleteClass <name>
renameClass <currentName> <newName>
addField <class> <name> <type>
deleteField <class> <name>
renameField <class> <old_name> <new_name>
addMethod <class> <name> <return_type> [-p <name>:<type>...]
deleteMethod <class> <name>
renameMethod <class> <old_name> <new_name>
addParam <class> <method> <name>:<type>...
deleteParam <class> <method> [-a] [<name>...]
addRelationship <source> <destination>
deleteRelationship <source> <destination>
changeRelType <source> <destination> <new_type>
save <filename>
load <filename>
listClasses
listClass <name>
listRelationships
export <filename>
help [command]
exit
Design Patterns
The model contains the information for classes and relationships. This information is stored in two lists, classIndex and relationIndex, respectively. The view contains everything used to display the model information onto the canvas. The controller listens for button presses in the gui or a valid command in the cli.
Memento - UMLState
I created a class to capture and store states of the classIndex and relationIndex. This allows us to repopulate those lists with a different version (past or future), allowing us to be able to undo and redo actions.
Observer - UMLClass
The UMLClass contains a list of "subscribers" which are relationships that the class is a part of (as a source or destination). There are also class methods register
and unregister
which handle adding and removing relationships from that list. On every name change, or deletion of a class, each subscriber in the list is notified. This allows for relationships to be deleted when their source or destination has been deleted, and a class name change to be reflected in each relationship that it is a part of.
Singleton - View
Since there should only ever be one GUI window, the view class now checks if an instance has already been created or not, before making one. If there has been an instance created already, then the pre-existing instance will be returned instead of a newly made one.
Prototype - Prototype
Every time a class is added to the GUI, a label is created with "Class: Fields: Methods:". Prototype creates this label which is then copied every time a new class is created. This allows us to start with the same label every time and then adjust it as needed to add the specific qualities of the new class.
Strategy – exportImage
Each different relationship line (Aggregation, Composition, Inheritance, Realization) represents a different strategy. The algorithms for drawing the different types of lines are put into separate classes. The context export object can then change its strategy based on the line type then draw the corresponding line to canvas.
Aaron Heinbaugh | Christian Shepperson | Julia Geesaman | Samantha Noggle | Trevor Bender |
Dedicated to JSMACH <3