Chapter 17. Practice Projects

Table of Contents

1. Project 1 - Assigning both directors/actors to movies and movies to directors/actors
2. Project 2 - Assigning cities to a country, as well as members to an organization, and vice versa

All projects include the following tasks:

  1. Make an association-free design model derived from the given design model. Hint: replace associations with corresponding reference properties.

  2. Make a JavaScript data model derived from the association-fee design model. Hint: add check and setter methods.

  3. Encode your JavaScript data model, following the guidelines of the tutorial.

Make sure that your pages comply with the XML syntax of HTML5, and that your JavaScript code complies 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 advanced online course (book parts 4-5) offered by our partner developer-competence.com.

1. Project 1 - Assigning both directors/actors to movies and movies to directors/actors

This project is based on the information design model below. The app from the previous assignment is to be extended by adding derived inverse reference properties for implementing the bidirectional associations. This is achieved by adding the multi-valued reference properties directedMovies and playedMovies to the model class Person, both with range Movie.

Figure 17.1. Two bidirectional associations between Movie and Person.

Two bidirectional associations between Movie and Person.

You can use the following sample data for testing your app:

Table 17.1. Movies

Movie ID Title Release date Director Actors
1 Pulp Fiction 1994-05-12 1 5, 6
2 Dangerous Liaisons 1988-12-16 2 7, 5
3 Inglourious Basterds 2009-05-20 1 9, 1

Table 17.2. People

Person ID Name Directed movies Played movies
1 Quentin Tarantino 1, 3 3
2 Stephen Frears 2
5 Uma Thurman 1, 2
6 John Travolta 1
7 Keanu Reeves 2
9 Brad Pitt 3

More movie data can be found at the IMDb website.