Table of Contents
For the following projects, you have to to take care of
adding for every property a check function that validates the constraints defined for the property, and a setter method that invokes the check function and is to be used for setting the value of the property,
before any data is saved in the
in the model code of your app, while In the user interface ("view") code you have to take care of
styling the user interface with CSS rules (for instance, by integrating a CSS library such as Yahoo's Pure CSS),
validation on user input for providing immediate feedback to the user,
validation on form submission for preventing the submission of invalid data.
Make sure that your pages comply with the XML syntax of HTML5 by means of XHTML5 validation (setting the validator field
with our Coding Guidelines and is checked with JSLint (http://www.jslint.com).
If you have any questions about how to carry out the following projects, you can ask them on our discussion forum.
If you would like to work on these practice projects with the guidance of a coach, then you should enrol in the introductory online course (book parts 1-3) offered by our partner developer-competence.com.
The app deals with just one object type:
Movie, as depicted in Figure 7.1 below. In the subsequent parts of the
tutorial, you will extend this simple app by adding enumeration-valued attributes, as well as
actors and directors as further model classes, and the associations between them.
In this model, the following constraints have been expressed:
Due to the fact that the
movieId attribute is declared to be the standard identifier of
Movie, it is mandatory and unique.
title attribute is mandatory, as indicated by its multiplicity expression , and has a
string length constraint
requiring its values to have at most 120 characters.
releaseDate attribute has an interval constraint: it must be greater than or equal to
Notice that the
attribute is not mandatory, but optional, as indicated by its
multiplicity expression [0..1].
In addition to the constraints described in this
list, there are the implicit range constraints defined by assigning the datatype
approach, all these property constraints are encoded in the model class within property-specific
You can use the following sample data for testing your app:
Table 7.1. Sample movie data
|Movie ID||Title||Release date|
More movie data can be found on the IMDb website.