9

HTW Berlin Medieninformatik HTW Berlin
Fachbereich 4
Internationaler Studiengang
Internationale Medieninformatik (Bachelor)
Info 1: Informatik I
Summer Term 2014

Laboratory 8: Dealing with Objects

Pre-lab

This exercise can be done in larger groups—there should be at least 2 persons in each group, and a maximum of 4. You will need lots of paper and pens and some cards—we have a lot available. You can go outside to do this, if the weather permits.

What to Bring to Lab

Please bring these exercises P1 and P2 printed out or written out with you to lab. Please have your name on your page.

P1. How do you obtain tickets to go see a movie? Write down the steps that you take, in order.

P2. If you have tickets and have to cancel, what do you have to do? Write down the steps, in order.

P3. Read up on the Class-Responsibility-Collaboration Card method (CRC Cards). This must be read before class, as you will not be able to do the exercise if you have no idea what this is.

Post-Lab, AKA  What To Turn In

Your completed assignment, submitted in Moodle as a pdf, should include:

Lab assignments are due the night before the next lab at 22.00, I want you to get some sleep the night before the next class. They may, of course, be turned in earlier. You hand them in by preparing the report in PDF and submitting it to Moodle. If you want to hand in the physical cards themselves, you can do this during the next lab.


Assignment

CRC Cards

  1. We are going to assume that there have been several meetings with the operators of a cinema who want to have a system to handle the bookings of seats for their movie screenings. The operators have described the expected functionality, but we won't be concerned with how that happens, this is called Requirements Engineering and will be discussed in the third semester in Informatik 3. Assume that this is the description written (adapted from Barnes/Kölling):

    The cinema booking system should store seat bookings for multiple theaters. Each theater has seats arranged in rows. There can be a different number of seats in every row. Customers can reserve seats, and are given a row number and a seat number. They may request bookings of several adjoining seats. Each booking is for a particular show (that is, the screening of a given movie at a certain time). Shows are at an assigned date, time, and price, and are scheduled in a theater where they are screened. The system stores the customer's name and telephone number. The customer is told what the booking will cost when the tickets are picked up.

    The first step is to discover some candidate classes and methods. Use the Booch method to determine candidate classes and methods, and write them down.
  2. Make CRC cards for each of your candidate classes. Only put down the class names for now.
  3. The first scenario that we will be doing is a reservation:

    Jane Doe calls the cinema and want to make a reservation for two seats to watch Godzilla at 8 pm. The cinema employee starts using the booking system to find and reserve a seat.

    Jane is interacting with the booking system, which will probably be represented by a class such as CinemaBookingSystem. Using the CRC cards, play through the scenario. How does the system find the show? As you discover responsibilites and collaborators, write them down on the cards. Assume there are plenty of free seats. Jane will choose seats 13 and 14 from row 12. The reservation is now made. How is this done, exactly? What data is going to have to be stored? Where? If you feel the need to create a new class, feel free to do so! If you discover that a class needs to be split in two—make two new cards and rip up the old one. If two need to be merged, do so. Keep a list of things you want to keep track of on a separate piece of paper.
  4. Choose another scenario and play this through. If you have time, do more! You will submit your final CRC cards and a description of the process you went through, in complete sentences. Each member can submit a copy of the group report with their own reflection on what they learned.
    Here are some suggestions for possible scenarios:

    1. Jane has a booking and needs another two, adjoining seats.
    2. Mary wants to book 4 seats together, but there are not 4 adjoining seats in one row available.
    3. Joseph wants to book, but there are no seats available.
    4. Otto has a booking he wants to cancel.
     

Writeup

Submit your writeup as your post-lab to the Moodle area by 22.00 the night before your next lab.

 


Some rights reserved. CC-BY-NC-SA Prof. Dr. Debora Weber-Wulff - CC-BY-NC-SA
Questions or comments: <weberwu@htw-berlin.de>


The exercises are adapted from Objects First with Java, A Practical Introduction Using BlueJ. David Barnes & Michael Kölling, 2011