1 / 11

Jukebox Objects

Jukebox Objects. Outline. Design a solution as a set of candidate objects with well-defined responsibilities Compare your objects to Rick ’ s Role play To understand responsibilities of objects, at least in one design. Find the objects.

whodge
Download Presentation

Jukebox Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jukebox Objects

  2. Outline • Design a solution as a set of candidate objects with well-defined responsibilities • Compare your objects to Rick’s • Role play • To understand responsibilities of objects, at least in one design

  3. Find the objects • The student affairs office want to put some newfound activity fee funds toward a Jukebox in the student center. The Jukebox must allow students to play a song. No money will be required. Instead, a student will swipe a magnetic ID card through a card reader, view the song collection and choose a song. Students will each be allowed to play up to 1500 minutes worth of "free" Jukebox music in their academic careers, but never more than two songs on any given date. No song can be played more than five times a day*. • *What a drag it would be to hear "Dancing Queen" 14 times while eating lunch (apologies to ABBA)

  4. Yesses? Song:Know song title, artist, playtime, how often it's been played today, the audio file name SongCollection: Stores all songs so they can be viewed and get one selected JukeboxAccount:changed from Student: maintain one account: model user who play songs, knows time remaining and songs played today, password JukeboxAccount: Stores all student accounts

  5. Yesses? Jukebox: coordinates activities one instance to start things and keep them going CardReader: reads the magnetic ID card (could be replaced by JTextField and JPassword input

  6. A No StudentIdCard: store user data • Object-Oriented Design Guideline Eliminate classes that are outside the system • The hallmark of such a class is one whose only importance to the system is the data contained in it. • Student identification number is of great importance • The system should not care whether the ID number was read from a swiped magnetic ID card, typed in at the keyboard, or "if a squirrel arrived carrying it in his mouth" ArthurReil

  7. More Candidate Objects? • Use a compact disk player or real Jukebox? • Could we instead have a software equivalent like SongPlayer to play audio files?

  8. Date Date: Can determine when a song is played and the current date. • Maybe, if you want to write your own • Can we use use java.util.GregorianCalendar?

  9. Another No? StereoSystem: Amplifies the music • No, it's on the other side what we have to build • The next slide summarizes some needed candidate objects • It also sets the boundaries of the system • There are model of the real world objects

  10. Candidate Objects and the system boundary Rick drew this in 1995, before UML existed, can’t change it now CardReader Gets student ID JukeboxAccountCollection Stores all JukeboxAccount objects JukeboxAccount JukeBox Coordinates activities SongCollection Stores all Songs that can be played Song SongPlayer Plays a song

  11. Others? • PlayList? • SongSelector?

More Related