Tutorial: Your First Project¶
In this tutorial you will create a simple library model, validate it, and generate a Python backend – all within the BESSER Web Modeling Editor. By the end you will understand projects, class diagrams, and code generation.
Note
This tutorial uses the online editor at editor.besser-pearl.org. No installation is required.
Step 1: Create a Project¶
Open the editor in your browser.
Click File > New / Open / Import Project.
Enter a project name (e.g., “My Library”) and click Create Project.
You are now in the editor with an empty class diagram canvas.
Step 2: Add Classes¶
Let’s model a simple library with books and authors.
From the Palette on the left, drag a Class element onto the canvas.
Double-click the class to open its properties.
Set the name to
Book.Add attributes (one per line):
+ title: str + pages: int + price: float
Drag another Class onto the canvas and name it
Author.Add attributes:
+ name: str + birth: date
Step 3: Add a Relationship¶
Click on the
Bookclass.Drag from a blue connection point on
Bookto theAuthorclass.A relationship line appears. Double-click it to edit properties.
Set the Name to
written_by.Set the Type to
Bidirectional.Set the multiplicity:
*on the Book side,1..*on the Author side (a book has one or more authors, an author can write many books).
Step 4: Add an Enumeration¶
Drag an Enumeration from the palette onto the canvas.
Double-click it and set the name to
Genre.Add values (one per line):
Poetry,Thriller,History,Romance.Now open the
Bookclass properties and add an attribute:+ genre: Genre
Step 5: Validate Your Model¶
Click the Quality Check button in the top bar.
If your model has no errors, you will see a success message.
If there are issues (e.g., duplicate class names), the editor will show specific error messages.
Step 6: Generate Code¶
Click the Generate menu in the top bar.
Select Python Classes from the dropdown.
A
.pyfile is downloaded containing Python class definitions forBook,Author, andGenre.
You can also try other generators:
SQL DDL: Generates SQL
CREATE TABLEstatements.Django: Generates a full Django project with admin panel.
Full Web App: Generates a React + FastAPI application (requires a GUI diagram – see GUI Diagrams).
Step 7: Explore Further¶
Now that you have the basics, try:
Adding methods to your classes (e.g.,
+ get_full_name(): str).Adding OCL constraints (drag from palette, write rules like
context Book inv: self.pages > 0).Creating an Object Diagram to model specific instances.
Switching to a State Machine or Agent Diagram via the left sidebar.
See Diagram Types for detailed guides on each diagram type.