We wanted to outline the domain model before diving into library details. We also looked at the data model of the TheMoviedb.org data to confirm that it matched our expectations.
In Java code this looks pretty straightforward:
Example 3.1. Domain model
class Movie { int id; String title; int year; Set<Role> cast; } class Actor { int id; String name; Set<Movie> filmography; Role playedIn(Movie movie, String role) { ... } } class Role { Movie movie; Actor actor; String role; } class User { String login; String name; String password; Set<Rating> ratings; Set<User> friends; Rating rate(Movie movie, int stars, String comment) { ... } void befriend(User user) { ... } } class Rating { User user; Movie movie; int stars; String comment; }
Then we wrote some tests to show how the basic plumbing works.