SE311 · Annotated SlidesChapter 5.2 — Domain Model Exercise: the Movie Shop
Chapter 5.2 · Annotated slides

Domain Model Exercise: the Movie Shop

A worked case study: from the Movie Shop requirements statement to a domain model, analysing each requirement for classes, attributes, associations and generalizations, the solution diagram, and common errors.

Slide text Study notes Highlight: key words Tips, tricks & traps Seen again elsewhere How it can come up
Slide 1: Slide 1
Exam weight Low

    EXERCISE: MOVIE SHOP DOMAIN MODEL

    The following are the requirements for a web-based system to computerize the management of the sale and rental of movies for a movie shop.

    • The system must be able to handle both physical and digital movies.
    • It must be able to record which movies are sold and rented and by whom.
    • For sold movies, the quantity sold should be recorded; for physical movie rental, which copy is rented and when it is due back should be recorded.
    • The system should keep track of overdue rentals of physical movies and send email notices to customers who have movies overdue.
    • There will be a customer membership option for an annual fee, which will entitle a member to discounts (10%) on the sale and rental of movies.
    • Members should be able to make reservations for physical movie rentals either in person at the shop, by telephone or via the Web.
    • A member can reserve at most five physical movies at any one time, but there is no limit on how many physical movies a member or nonmember can rent at any one time.
    • As an added feature, the shop would like to allow customers (either members or nonmembers) to input, via the Web, mini-reviews (up to 100 words) and a rating (from 1, lowest, to 10, highest) of movies they have purchased or rented.
    2
    Exam weight Low
    1. Read the requirements once for the big picture, then line by line for classes, attributes and associations.

    EXERCISE: MOVIE SHOP DOMAIN MODEL

    (c o n t'd )

    • These reviews should be anonymous if the customer so wishes (i.e., customers can specify whether they want their name to be made known when other customers browse the reviews).
    • A sales clerk should be able to enter and update the following information about all customers (members or nonmembers): name, address, phone number, age, sex, and email address.
    • Members are assigned a membership number by the shop when they become members and a password, which allows them to change their personal information and to buy and rent digital movies via the Web.
    • The shop manager should be able to generate various reports on the sale and rental of movies.
    • A sales clerk should be able to sell and rent physical movies and process the return of rented physical movies.
    • When selling or renting physical movies, a sales clerk must be able to look up customer information and determine whether the customer is a member.
    • A sales clerk must be able to enter basic information about a movie (i.e., movie id, title, leading actor(s), director, producer, genre, synopsis, release year, running time, selling price, and rental price).
    3
    Exam weight Low

      EXERCISE: MOVIE SHOP DOMAIN MODEL

      (c o n t'd)

      From the movie sales and rental shop requirements statement:

      a) identify all the classes, attributes, association classes,

      associations, aggregations/compositions, generalizations and multiplicity constraints that are relevant to include in the domain model for the new system. (Only those that are explicitly given in or implied by the requirements statement should be included.)

      b) Construct a class diagram showing how the classes

      identified in (a) are related by associations, aggregations/ compositions and generalizations. Show the most likely multiplicities for all associations, making reasonable assumptions where necessary. If a multiplicity cannot be inferred from the requirements statement or common real-world domain knowledge, then indicate this with a “?” . Do not show the attributes of the classes in the class diagram.

      4
      Exam weight Low

        EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS

        We first analyze the requirements statement to determine the requirements for the domain model and then present the domain model.

        • The system must be able to handle both physical and digital movies. classes: Movie attributes: Movie: isPhysical, isDigital
        • It must be able to record which movies are sold and rented and by whom. classes & associations: Customer Purchases Movie Customer Rents Movie
        • For sold movies, the quantity sold should be recorded; for physical movie rental, which copy is rented and when it is due back should be recorded. classes & associations: Movie Has RentalCopy Customer RentsPhysical RentalCopy attributes: Purchases: quantity RentalCopy: copyNumber, returnDate
        5
        Exam weight Low
        1. Analysis: each requirement → the classes, attributes and associations it implies (e.g. Movie, PhysicalMovie, DigitalMovie, Customer, Member, Rental, Reservation, Review).

        EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS

        • The system should keep track of overdue rentals of physical movies and send email notices to customers who have movies overdue. attributes: Customer: email
        • There will be a customer membership option for an annual fee, which will entitle a member to discounts (10%) on the sale and rental of movies. generalization: Member is a kind of Customer → Customer Generalizes Member
        • Members should be able to make reservations for physical movie rentals either in person at the shop, by telephone or via the Web. classes & associations: Member Reserves RentalCopy
        • A member can reserve at most five physical movies at any one time, but there is no limit on how many physical movies a member or nonmember can rent at any one time. constraint: max-card(Member, Reserves) = 5 max-card(Customer, RentsPhysical) = *
        6
        Exam weight Low

          EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS

          • As an added feature, the shop would like to allow customers (either members or nonmembers) to input, via the Web, mini-reviews (up to 100 words) and a rating (from 1, lowest, to 10, highest) of movies they have purchased or rented. classes & associations: Customer Provides Review IsFor Movie → Customer Provides Review Review IsFor Movie attributes: Review: reviewText, rating
          • These reviews should be anonymous if the customer so wishes (i.e., customers can specify whether they want their name to be made known when other customers browse the reviews). attributes: Review: anonymous
          • A sales clerk should be able to enter and update the following information about all customers (members or nonmembers): name, address, phone number, age, sex, and email address. attributes: Customer: name, address, phoneNumber, age, sex, email
          7
          Exam weight Low

            EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS

            • Members are assigned a membership number by the shop when they become members and a password, which allows them to change their personal information and to buy and rent digital movies via the Web. attributes: Member: memberNumber, password
            • The shop manager should be able to generate various reports on the sale and rental of movies. functional requirement: no new domain model requirements
            • A sales clerk should be able to sell and rent physical movies and process the return of rented physical movies. functional requirement: no new domain model requirements
            • When selling or renting physical movies, a sales clerk must be able to look up customer information and determine whether the customer is a member. functional requirement: no new domain model requirements
            8
            Exam weight Low

              EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS

              • A sales clerk must be able to enter basic information about a movie (i.e., movie id, title, leading actor(s), director, producer, genre, synopsis, release year, running time, selling price, and rental price). attributes: Movie: movieId, title, leadingActor[0..*], director, producer, genre, synopsis, releaseYear, runningTime, sellingPrice, rentalPrice
              9
              Exam weight Low
                Slide 10: EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS
                Exam weight Low
                  Slide 11: EXERCISE: MOVIE SHOP DOMAIN MODEL SOLUTION
                  Exam weight Low
                  1. Solution: Movie generalizes into physical and digital movies; Rental and Reservation link customers to physical copies.
                  Slide 12: EXERCISE: MOVIE SHOP DOMAIN MODEL SOLUTION
                  Exam weight Low
                    Slide 13: EXERCISE: MOVIE SHOP DOMAIN MODEL SOLUTION
                    Exam weight Low
                      Slide 14: EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS
                      Exam weight Low
                        Slide 15: EXERCISE: MOVIE SHOP DOMAIN MODEL ANALYSIS
                        Exam weight Low
                          Slide 16: Slide 16
                          Exam weight Low
                            Slide 17: EXERCISE: MOVIE SHOP DOMAIN MODEL SOLUTION
                            Exam weight Low

                              EXERCISE: MOVIE SHOP DOMAIN MODEL COMMON ERRORS

                              ⚫

                              Using “ids” to relate c

                              lasses

                              ⚫

                              Representing the client/organization (e.g., Shop) Incorrect use/overuse of generalization

                              ⚫

                              (e.g., Person, Nonmember, PhysicalMovie, DigitalMovie) Incorrect use/overuse of aggregation/composition

                              ⚫

                              (e.g., Movie<> —— RentalCopy, Movie<> —— Review,

                              Customer<> —— Member)

                              Incorrect use of association class

                              ⚫

                              Incorrect constraints (e.g., XOR)

                              ⚫

                              18
                              Exam weight High
                              1. Common errors: modelling actions as classes, putting methods in a domain model, missing multiplicities, attributes that should be classes (and vice versa).
                              🎯 How this can come up · 1 question
                              MCQ

                              Which is a common domain-model error?

                              EXERCISE: MOVIE SHOP DOMAIN MODEL COMMON ERRORS

                              ⚫

                              Representing operati

                              ons

                              (e.g., generates, browses, enters, looks up, etc.) Storing reports

                              ⚫

                              Representing implementation aspects

                              ⚫

                              (e.g., System, Web, telephone, reports)

                              ⚫

                              Over specifying the model (e.g., sales clerk, manager)

                              Key question: What information about things/

                              procedures needs to be persistent (i.e., in files or a database)?

                              19
                              Exam weight Low