Get Started

Understand the System

The first step of achieving a realistic Modo model is to analyze and understand the system to be modeled as realistically as possible. It is not a time consuming effort to remodel the system using Modo. However a more realistic analysis will save you time to focus on the solution in deeper details.

For the quick-start example, let's think of the registration system of a university.

 

Define Main Elements

The registration system most likely has students, instructors and courses. Those can be considered as the main elements of that system, and below is how you represent them.

/* Registration System Element Declarations */
Student;
Instructor;
Course;

As seen above the elements of a system can be declared that easily. However when you want to add the properties of those elements, it is better to use the below representation.

/* Registration System Element Declarations */
Student {
}
Instructor {
}
Course {
}

It is the common practice to define singular elements, and let the frameworks handle the groups of those elements. That is why the above example defines Student, Instructor and Course, instead of Students, Instructors and Courses.

 

Define Member Elements

The elements of the registration system have some properties in real-life. Like the name and surname of a student, like the ID of a course etc. Those properties are called member elements in Modo.

/* Registration System Element Declarations */
Student {
    Name = String;
    Surname = String;
    ID = Number;
    GPA = Number;
}

Instructor {
    Name = String;
    Surname = String;
    ID = Number;
}

Course {
    Name = String;
    ID = Number;
    Instructor = Instructor;
}

As you can see in the example above the member elements are defined within the curly brackets of the related element. The equal sign (=) is used to assign the types of the member elements. The types of the member elements can be built-in elements or other elements that are previously defined by the user. The later enables the easy modeling of the relations between elements.

Modo language does not contain any built-in elements. However, built-in elements can be defined in different syntaxes of Modo, which are designed for different technologies.

In lines 3, 4, 9, 10 and 14 the built-in element String is used, where in line 18 the user-defined element Instructor is used as the type of the member element.

 

Element Type vs. Element Value

When there is a need to access the value of a certain member element, a dollar symbol ($) is placed preceding the element name.

/* Student Element Declaration */
Student {
    Name = String;
    Surname = String;
    ID = Number;
    GPA = Number;
    Fullname = String;
    $Fullname = $Name + ' ' + $Surname;
}

In the above example the type of the Fullname member element is String. However the value of the element is a string combination of the values of the member elements Name and Surname. This shows that at any time, the value of the fullname property of a student is his/her name, surname and a single space in between them.

 

Extend Your Elements

Different elements can be derived from built-in elements or previously defined elements.

/* Registration System Element Declarations */
Student {
    Name = String;
    Surname = String;
    ID = Number;
    GPA = Number;
    Advisor = Advisor;
}

Instructor {
    Name = String;
    Surname = String;
    ID = Number;
}

Advisor = Instructor {
    OfficeDay = Weekday;
}

In the above example a new element Advisor is defined. The advisor is in fact an Instructor but an additional property of office day is added.

The member elements can also be extended like the elements.

/* Registration System Element Declarations */
Student {
    Name = String;
    Surname = String;
    ID = Number;
    GPA = Number;
    Advisor = Instructor {
        OfficeDay = Weekday;
    }
}

Instructor {
    Name = String;
    Surname = String;
    ID = Number;
}

In the above example the member element Advisor of the element Student extends the element Instructor adding the property of office day.

 

Different States of the System

Modo can also represent different states of the system. The at symbol (@) is used to define those rules.

/* Registration System Element Declarations */
Student {
    Name = String;
    Surname = String;
    ID = Number;
    GPA = Number;
    CanGraduate = Boolean;
    $CanGraduate = true @ ($GPA >= 2);
    $CanGraduate = false @ ($GPA < 2);
}

The above example adds a new member element CanGraduate to the Student element. The value of this member element changes for different values of the GPA member element.

For more detailed information, please download Modo Language Specification Document.