Jukebox Active Learning

Jukebox Active Learning

Responsibility Driven Design Responsibility Driven Design, Rebecca Wirfs Brock, 1990 The Coffee Machine Design Problem, Alistair Cockburn, C/C++ User's Journal, May and June 1998. Introducing Object-Oriented Design with Active Learning, Rick Mercer , Consortium for Computing in Small Colleges, 2000 1 In Rebecca Wirfs Brocks' Words Responsibility-Driven Design is a way to design that emphasizes behavioral modeling using objects, responsibilities and collaborations. In a responsibility-based model, objects play specific roles and occupy well-known positions in the application

architecture. Each object is accountable for a specific portion of the work. They collaborate in clearly defined ways, contracting with each other to fulfill the larger goals of the application. By creating a "community of objects", assigning specific responsibilities to each, you build a collaborative model of our application. Responsible: able to answer for one's conduct and obligationstrustworthy, Merriam Webster 2 Responsibility Driven Design in Rick's words 1. Identify candidate objects that model a system as a sensible set of abstractions

2. Determine the responsibility of each object what an instance of the class must be able to do, and what each instance must know about itself 3. Understand the system through role play To help complete its responsibility, an object often needs help from other objects 3 OO Design Principle

The Single Responsibility Principle Classes should have a single responsibility http://en.wikipedia.org/wiki/Single_responsibility_principle Why? Cohesion, when high, reduces complexity, makes the system more understandable http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 Maintenance: Fixing or changing a module should

not break other parts of the system 4 First Design a Model Note: design is iterative Find a set of objects (candidate classes) that model a solution Each will be a part of the bigger system Each should have a single responsibility What are these objects? 5

Find the Objects Candidate An objects may come from understanding of the problem domain knowledge of the system that the problem specification may have missed or took for granted The words floating around the room Alistair

Cockburn The nouns in the problem statement Underline the noun phrases to look for the objects that could model the system 6 The Problem Specification repeated 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) 7 A First Cut at the Candidate Objects (may become classes) What objects effectively model the system? What is

the responsibility, Example Song: Know song title, artist, playtime, how often it's been played today Others? 8 Yesses Jukebox: coordinates activities one instance to start things and keep them going maintain

one account: model user who play songs Song: one song that can be played CardReader: reads the magnetic ID card JukeboxAccount changed from Student: 9 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" Arthur Reil 10 More Candidate Objects?

SongCollection: songs to choose from What about storing a collection of accounts? JukeBoxAccountCollection Use a compact disk player or real Jukebox? Could have a software equivalent like SongPlayer to play audio

files? 11 Date Date: Can determine when a song is played and the current date. Maybe Can we use use java.util.GregorianCalendar?

12 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 13 Candidate Objects and the system boundary 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 14

Sequence Diagrams Interaction diagrams describe how groups of objects collaborate in some behavior The UML defines several forms of interaction diagram, the most common is the sequence diagram A class diagram shows a fixed view of a system A sequence diagram represents a dynamic view of a system by capturing message sends over time Can document a scenario such as Dealer deals cards to all players Withdraw Money when there is enough balance Withdraw Money when there is not enough balance 2515

2616 Sequence Diagrams Not good at showing details of algorithms such as loops and conditional Good at showing the calls between participants Gives a good picture about which participants are doing which processing 2717 More Distributed Control Shown here 2818

Syntax Objects are lined up on top in rectangles Dashed lines represent lifetime of objects Rectangles are activation lines When the object is "alive" Activation bar of the receivers of the message is smaller than the sender's activation bar Not much detail written 2919 Another Example http://www.ifi.uio.no/in219/verktoy/doc/html/doc/user/mg/dgmsuml6.html

Scenario: The user tries to use an ATM, but the account is not known 3020 Role Play Need 7 students to play the role play the scenario Rick wants to play Feelin Alright 1. CarderReader 2. JukeboxAccountCollection 3. JukeBoxAccount 4. Jukebox

5. Songplayer 6. SongCollection 7. Song The rest of you will have to write a sequence Diagram by hand, it will be like taking notes, a start 21

Recently Viewed Presentations

  • Metacognitive Markers - elementary.somersetsilverpalms.net

    Metacognitive Markers - elementary.somersetsilverpalms.net

    Metacognitive markersDefinition. Metacognitive markers are symbols used to mark the text you are reading that reflect the thinking you are doing as you read.. After reading, your metacognitive markers can be used to quickly find evidence when you are talking...
  • Effective Contamination Control and Cleanroom Protocols

    Effective Contamination Control and Cleanroom Protocols

    Effective Contamination Control, Cleanroom Protocols, & Lab Safety ... surface and particles and allows particles to float off Those adhering on surface can be rubbed off and retained in wiper. Must be careful not to redeposit particles Efficiency varies Tacky...
  • Maya, Aztec, and Inca Civilizations

    Maya, Aztec, and Inca Civilizations

    was the capital city of the Aztec Empire. Legend of Tenochtitlan The Gods told the Aztecs to search for an eagle holding a snake in its beak perched atop a cactus.
  • "What Mean Ye By These Stones?" Joshua 4:6, 20

    "What Mean Ye By These Stones?" Joshua 4:6, 20

    Substance (hupostasis) "a setting or placing under; thing put under, substructure, foundation:" (Thayer) "That which provides the basis for trust and reliance" (Greek-English Lexicon Based on Semantic Domain)
  • Customs Around the World In the USA, most

    Customs Around the World In the USA, most

    Images and information taken from www.mexconnect.com and www.azcentral.com Additional Pictures taken by Jan Gray, Jennifer R. Wood, and Philip Wood * Customs Around the World In the USA, most people avoid talking about death Many other cultures around the world...
  • Gestion du risque et des erreurs - Pharmactuel

    Gestion du risque et des erreurs - Pharmactuel

    Règles d'utilisation pour chacun des vaccins - mars 2003 Cartable contenant tous les documents pertinents pour chaque vaccin Protocole de vaccination en GMO Section « immunisation» sur l'intranet QUESTIONS * * Asthme n'est pas associé à un risque accru d'infections...
  • Chapter 16

    Chapter 16

    Electronic direct fuel injection systems deliver just the right amount of fuel, resulting in higher performance with lower fuel consumption. Catalytic converters are used in the exhaust system to reduce levels of nitrogen oxides, which the sun heats into smog....
  • Middle English - Chaucer Style - Boston College

    Middle English - Chaucer Style - Boston College

    Middle English - Chaucer Style by Dan Foley The Canterbury Tales Chaucer's Masterpiece - Never Finished 31 Pilgrims 4 Stories Each - Chaucer Old Source of this Slideshow Certain words strong as ever Others have had vastly different changes in...