Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Fall 2002 Final Exam Review
The final will be cumulative, but with a strong focus on material in the second half of the class. Below are questions that are similar to the ones that will appear.
I expect the final exam to include 6-8 questions, most of which will be like the ones below. You may also be asked to write some Squeak code, like on the first esam and quizes. Some of the questions below are from actual final exams in 2390 and 2340. I recommend working together to figure out the solutions. I will check up on the discussions, but I won't provide answers where no questions are posted. Rich LeBlanc
Designing the Segway Palm
Palm has just announced a new kind of handheld
device designed specifically for attaching to the new Segway
(previously ``Ginger'' and ``IT'') Personal Transportation device
- a kind of scooter for urban commuters. The new
SegPilot will feature a map with GPS (``Global Positioning
System'') for finding your way around town, an MP3 player and FM
radio, a cellphone, and a Zagat's guide to the restauraunts around
town, as well as the traditional appointment book, to-do list, and phonebook
Palm wants some of these features to interoperate. For example:
- The single speaker jack should be internally connectable to
either the radio source or the MP3 source. The volume control effects
the speaker jack directly, while the band selector effects only the
radio source and the clip selector effects only the MP3 source.
- Map objects will be used by the GPS locator (e.g., to
tell you where you currently are), by the Zagat's guide (e.g.,
to show you where the nearest Starbuck's or Waffle House is),
and by the address book (e.g., to show you where your Aunt
Millie's house is and the quickest way to get there). This
means that the map needs to be indexed both by global GPS
coordinates and in terms of street addresses, e.g., the maps
have to know the GPS coordinates associated with 800 Atlantic
Drive. Locations in the address book and in the Zagat's guide can be
specified in terms of either GPS coordinates or in terms of street
addresses, and the Map objects have to handle translations between them.
A single Location will appear on multiple Maps, and if the Location is
asked for its coordinatesInGPS or coordinatesOnStreet, it should know
one of those and be able to ask any of its Maps for the other. A Map
should know how to map any Location to its own graphical
representation, such that the Map can highlightFor any Location.
- Draw a UML class diagram for the interactions between Maps,
Locations, the address book, and the Zagat's guide, including any
additional objects you think are necessary. You must account for all
of the functionality described in this problem, but you needn't add
any other (e.g., you don't have to handle the address book user
interface). You do need to show attributes and services that would be
necessary to implement the given functionality. Describe
briefly what each of your services would do.
- Identify one design pattern that would be useful in this
problem. Explain how it would be useful, and identify specific
classes that you would use in a design for this problem that would
correspond to the design pattern participant objects.
- Palm is using Squeak to implement the SegPilot.
Imagine that you have an ordered collection errands of
Location objects that represent places to which you have to
run errands. You have a Map gridMap on which all the
Locations appear. You are to write workspace code:
- To tell gridMap to highlightFor each of these
- To ask each of the errands locations for its
streetname (assume given, returns a string with the name of the
street). For each street containing more than one errand
location, print to the Transcript a message announcing ``There is
more than one errand on street: '' with the street name.
Post comments, discussion, answers at F02 Final Exam Review: Segway Palm Pilot.
Programming A Sensor Management System
You are building a new kind of sensor management system. Your system is going to be accepting a continuous stream of data which will be the merged data from many sensors. Your application must make appropriate sense of it. Your stream will be a series of two byte integers (i.e., in the range of 0-65536), which you will read using next off the stream accessed by the global variable SensorStream. That is, SensorStream next will always return an integer between 0 and 65536. Answers can be written below or on the back.
a. The integer value 0 will actually be a flag value indicating a Character Display Message. A reading of 0 is telling you that the next two readings are to be interpreted as an X and Y value and the third reading will be the ASCII value for a character. So, the readings 0 10 100 65 would tell you to put an ASCII capital A at the position 10, 100 on the screen. Write the Squeak code to read the first 100 readings off of SensorStream and process any Character Display Messagescontained in those readings. (Hint: Character value: returns a character for a given ASCII value, Strings understand the message displayAt: which takes a Point.)
b. Some key events require you to correlate readings from multiple sensors. For example, a sound sensor gets triggered with random noise, but if the sound sensor gets triggered multiple times and the motion sensor in the same room gets
triggered, that indicates an alarm must be thrown. Readings in the range of 1-255 indicate that the corresponding sound sensor has gone off. Readings in the range of 256-511 indicate that the corresponding motion sensor has gone off. For example, a value of 1 indicates that sound sensor 1 has been triggered, and a value of 256 indicates that motion sensor 1 has been triggered.
Write code to read 100 values off SensorStream. If values between 1 and 255 come in, record the value and the number of times that that value has appeared (e.g., "5 appeared three times"). If a value between 256 and 511 comes in, put up "ALARM!" in a notifier if the corresponding sound sensor has gone off more than three times. (Hint: Object understands inform: that takes a string, then pops up a notifer with the string.) Besides writing the code, also tell me which data structure you used for recording and quickly finding the values and why you made that choice.
Post comments, discussion, answers at F02 Final Exam Review: Sensor Management System.
Helping the Video Game Industry
Given your experience with designing and
implementing epic adventure games, you have been hired as a
consultant to Electronic Arts as they develop their response to
the Myst series of adventure games.
- (5 points) The computer game and video game industry is enormous these days. EA realizes that there are two different potential markets for these games: The 12-18 year old market (low-budget, intense competition with movie industry), and the growing 25-40 year old market (can afford more expensive hardware). EA wants to know if they can have one user interface for both of these markets, or should they think about two user interfaces. How would you help them answer this question? What should they do before they start designing their user interface(s)?
- (5 points) Time passes, and now EA has some storyboards of the game and its interface. They want to know now, before they start coding and without spending too much money, if they're on the right path or have come up with a completely awful interface. What would you recommend they do and why?
- (10 points) EA is considering using a Model-View-Controller (MVC) structure for implementing the user interface for their new game. For example, if the user opens the Arkenchest, all the objects in the room touched by the evil ArkenLord should begin to glow. Trace out for EA the flow of messages in an MVC structure (assuming an object-oriented language, and that all objects in the visible world are View objects) between the user's opening the Arkenchest and the glowing of the objects.
- (5 points) EA used Squeak for their implementation, especially for the multimedia and portability aspects. Now they're looking to optimize some features. For example, parsing the 3-D objects is taking too long. Name at least two things that EA could try in order to speed up their code.
Post comments, discussion, answers at F02 Final Exam Review: Helping the Video Game Industry.
For each of the below applications, you are to pick the object-oriented language of your choice for implementing the application (e.g., Smalltalk in general, Squeak in specific, Java, C++, Eiffel, etc.) and provide your rationale! We don't have a right answer in mind for each of these, but we are looking for true, reasonable statements in your rationale.
(E.g., ``I'm going to pick C++ because it gives me the most
robust implementation'' would be a bad answer.)
- A. You're building a claims-entry system for a large insurance firm. You're not using the Web because you're using your own proprietary secure networking protocol. You have to run on whatever platform the insurance agent may purchase. New claims forms are defined by the company fairly frequently-usually several a month. This requires new GUI forms and new processing code to be implemented for each new form.
- B. You're building a new adventure game based on the movie Shrek to run only on Windows boxes with hardware acceleration. You're going to be distributing the code on CD. You'll have a small, hand-picked group of developers who are expert in your language of choice. There is intense pressure to have the game out by summer's end, so you only have a month or two to implement the complete game.
- C. The Bell operating companies have decided to finally rewrite TIRKS, the massive multi-million line database system that keeps track of all the phone lines in the country, including keeping track of change records, etc. TIRKS is currently written in PL/1 and System 360 assembler. This rewrite is a huge investment, and it's not expected to be rewritten again for another 30 years-but it must be maintained. It's going to be done in an object-oriented language with a team of hundreds of programmers.
- D. You're building an MPEG library for a set-top box. MPEG decoding, of course, is a numeric code that is very compute intensive. The library will be burned into ROM and executed from an embedded ARM processor running only a single application. You expect to sell millions of these boxes, and the library is expected to change very, very little, if at all, after it's finished, since the MPEG spec is cast in stone.
- E. You're building a distributed Doom-like game, intended to support players on home PCs and Macs, that tie into a central server over the internet (possibly via a slow link, like a phone line). The game requires heavy, compute-intensive 3D rendering. Players are allowed to define their own characters and weapons; the 3D models and behavioral code for these entities are uploaded to a central server. Instead of running the behavioral code and rendering the models on the central server, they are broadcast to all the other players' computers, where they are executed locally. This allows for crisp interaction over slow communications links-when Felicia fires her laser blaster at George, the laser-gun simulation runs and renders locally on George's computer.
- F. You need to choose a language & language implementation to allow people to define the programed behaviors for game characters and weapons-i.e., the bits of code that get shipped around between players.
Post comments, discussion, answers at F02 Final Exam Review: Language Choices.
You're designing a web crawler for a new cellular-phone service that's going to offer wireless Internet access. The key features that you need your web crawler to provide:
- You have to follow links breadth-first from a list of most-popular sites that marketing is going to provide you, to a depth of 5 clicks from the top.
- As you find these pages, you need to convert them into your company's BCML (Bizarre Cellphone Markup Language), and convert all GIF, JPEG, PNG, and BMP images into the BCI (Bizarre Cellphone Image) format.
- All documents should be stored into the database of the ``cellphone faux HTTP server'' that will serve the appropriate BCML or BCI document for a given URL. This server sits at the phone company, and ships web documents (translated into BCML and BCI format) out to cellphones in response to URL requests.
You begin your design, and you make several decisions about your classes:
- You want a class named CFHserver (Cellphone Faux HTTP server). An instance will handle the store:forURLs: message (defined in detail below), and produce a document when sent the forURL: message. A CFHserver will also know its urlDatabase.
- A class named BCObject will be an abstract superclass, and its concrete subclasses will be BCMLObject and BCIObject. All BCObjects will know how to displayOn: a given Canvas. They will also respond to isBCML and isImage.
- You want the URLdatabase to understand the messages storeDocument:forURL: for BCML documents and storeImage:forURL: for BCI documents. The instances of URLdatabase will know its current file and index.
The CEO is betting the entire company on this new application. Once he discovers you've had CS2340, he instantly promotes you to chief architect of the system. Here are your immediate tasks:
- (15 points) Draw a class diagram for the classes CFHserver, BCObject, BCMLObject, BCIObject, and URLdatabase.
- (10 points) Identify at least one other UML diagram (your choice which one!) that would be useful in describing how this design would work. Describe the UML diagram you have chosen, why you have chosen it, and what it would show that the class diagram does not.
- (10 points) Imagine that you are now actually implementing this design. Your CFHserver will be sent the message store:forURLs: which will take two arguments: An ordered collection of BCMLObject and BCIObject objects, and a matching ordered collection of Strings containing the URLs for the HTML/GIF/whatever matching documents. You want to store these into the database of the server. You may use any of the methods described above.
Write the Squeak method store:forURLs: for CFHserver.
Post comments, discussion, answers at F02 Final Exam Review: Cellular Web-browser.
- Give three reasons that one might use a virtual machine (and compiling to native code) instead of a compiler to compile directly to machine code.
- Give three good and frequent reasons that one might add a primitive to a VM.
- What takes up the majority of time and effort in a VM (typically)?
- Why are VMs so often stack-based architectures? Why not have registers?
Post comments, discussion, answers at F02 Final Exam Review: Virtual Machines.
Optimization: Collection Differences
a. Identify a use where Arrays are the best choice, where Bags are the best choice, and where Dictionaries are the best choice.
b. For figuring out if an element is in the Collection, Sets are much, MUCH faster than Arrays. Why?
c. When are OrderedCollections much slower than Arrays? When are OrderedCollections almost the same speed as Arrays? What causes OrderedCollections to be slower?
Post comments, discussion, answers at F02 Final Exam Review: Collection Differences.
- Identify three challenges to the strategy adopted by Microsoft in their .NET Framework where objects will be serialized to XML and XML instances (defined through XML Schemas) can be compiled to objects.
- What are XML schemas? How are they like and unlike class definitions?
- What's the argument that XML "instances" aren't really objects?
Post comments, discussion, answers at F02 Final Exam Review: Issues of Serialization
You're advising a team of developers who are considering adopting XP. Being an expert on XP, please answer their questions.
- "XP programmers don't document their code!?! How can their code still be readable after they write it?"
- "What in the world do they mean that code written by an individual has to be thrown away? What other kind of code is there?"
- "Integrating daily sounds like we'll spend all our time in integration. How can we make daily integration work more smoothly?"
- "Is there any evidence that this really works?"
Post comments, discussion, answers at F02 Final Exam Review: XP
Re-designing a Networked Computer Game
Mattel finds that Barbie software has become so wonderfully successful, as has first-person role-playing games, that they've merged these to produce a new title: Barbie's First Cocktail Party. But they've run into lots of problems. You've been hired as a consultant to help sort it all out for them.
a. "We're downloading 3-D models of Barbie and all her guests, and it's taking a horrendously long time. Is there anything that we can do to reduce that time?"
b. "Cross-platform is very important to us, but someone in upper management suggested we go with Visual Basic. And Bill Gates isn't returning our calls about producing Linux and Macintosh versions of VB. What do you recommend that we use, and what argument should we provide to upper management for it?"
c. "We've heard about this UML stuff for our design notations, and it sounds great. We know all about UML class diagrams. What's another UML diagram that you think is good? What's it good for?"
Post comments, discussion, answers at F02 Final Exam Review: Networked Barbie Game
You are going to be designing a suite of tools for space scientists. Your scientists are going to need to work with three kinds of documents:
- Data Collection Documents: Containing live satellite data in a form appropriate for doing numeric calculations with.
- Data Visualization Documents: Does 2-D and 3-D graphs of satellite data linked to it.
- Data Planning Documents: For organizing modules both on the satellite and off for gathering and processing sensor data.
a. Explain how one (your choice which one) Design Pattern would be useful in building this application. Draw a UML class diagram of the portion of your design where the design pattern would be useful. (Note: You are not drawing the whole class diagram, nor are you showing me the structure of the Design Pattern. Rather, you are showing me a few classes in your application whose design would be based on the Design Pattern you've selected.)
b. The Space Scientists think this object-oriented stuff is just silly. "Fortran was good enough for my advisor and for me and for my students," they say. "Why not just use that?" What are the advantages of object-oriented design and programming for this problem?
Post comments, discussion, answers at F02 Final Exam Review: Tools for Space Scientists
Designing Networked Games
You are responsible for design and development of a new video game based on the Rugrats cartoon series on Nickelodeon. The video game will allow players to take on the roles of Tommy, Chuckie, Angelica, Phil, and Lil, and then interact to work through puzzles. The players will sit all over the network, and it's desirable to be entirely cross-platform. You must make several technical decisions up front.
a. Do you use a virtual machine? Why or why not?
b. How do you want to transmit the images of Tommy, Chuckie, and the rest? Some of your teams want to send around 3-D models of them, and others want to use Flash. What do you think and why?
c. There will be need for various kind of audio in this game: Background music based on the cartoon, recordings of the voices. What formats do you think you would want to use and why?
Post comments, discussion, answers at F02 Final Exam Review: Design Networked Games
Imagine that you have a dictionary that looks like this:
|Key ||Value |
|Fred || Wilma |
|Barney || Betty |
|George || Martha |
|Ozzie || Harriet |
And you want to create the transpose of the dictionary so that it looks like this:
|Key ||Value |
|Wilma || Fred |
|Betty || Barney |
|Martha || George |
|Harriet || Ozzie |
Do it. Can you do it in one line of code? In how few lines of code if you need more than one?
Post comments, discussion, answers at F02 Final Exam Review: Transposing a Dictionary
a. Name an application where MVC is preferable to Morphic.
b. Name an application where Morphic is preferable to MVC.
c. Identify three major design differences between Morphic and MVC.
d. Can you use the MVC Paradigm in Morphic? Why or why not?
e. Name at least one commercial UI package today that is based on the MVC paradigm.
Post comments, discussion, answers at F02 Final Exam Review: MVC vs. Morphic
A company has just designed a user interface that was an utter disaster. You have been brought in as an HCI consultant to explain what they did wrong. For each of the below quotes from the companies engineers, respond and explain what they should have done.
a. "We used it ourselves for over a week! We really loved it! I can't understand why we're getting all these nasty letters from our users!"
b. "We wanted to save on screen real estate so we used 9 point text throughout the user interface. Well, now it turns out that all these Senior Citizens homes bought our software. Did you know that older folks have trouble with reading smaller text?"
c. "All of us felt that OK and Cancel buttons in the lower right hand corner were boring. So instead, if you click at the top of the dialog box, it closes as if you did 'OK,' and if you click at the bottom, it closes as if you clicked 'Cancel.' What's that? No, we didn't use any labels – they would just take up screen real estate."
Post comments, discussion, answers at F02 Final Exam Review: HCI Design
A. What are the strengths and weaknesses of the Model-View-Controller structure for user interfaces? Give me an example of an application where MVC would really help, and another where MVC wouldn't help.
B. What are the strengths and weaknesses of an object-oriented approach? Give me an example of a project where using OOA/D/P is the right idea, and an example where it's a bad idea.
C. What are the strengths and weaknesses of Squeak vs. Java? Give me an example where using Squeak is a good idea and one where it's a bad idea, and one where Java is a good idea and one where it's a bad idea.
Post comments, discussion, answers at F02 Final Exam Review: Tradeoffs
a. Factory Method and Abstract Factory design patterns are quite similar. How are they similar and how are they different?
b. How are the Adapter and Bridge patterns similar and different?
Post comments, discussion, answers at F02 Final Exam Review: Design Patterns
Multimedia Programming in Squeak
Recall that you can play three notes in Squeak like this:
(FMSound soundNamed: 'brass1')
from: #((c4 1.0 500) (d4 1.0 500) (e4 1.0 5000))) play
"Triplet are note, duration, and volume"
(a) Recall, too, how to move a Pen, from wherever the Pen appears when first created.
Write the Squeak code to draw a box, where you play C in the fourth octave during the first line, D in the second, E in the third, and F in the fourth – as a clarinet.
(b) Recall that moving a Morph involves setting its bounds: to a new rectangle. Recall that you change the color of a Morph with a color: command.
Write the Squeak code to move a red EllipseMorph. Start it at 0,0 and play C; then go to 0,100 and play a D; then go to 100,100 and play an E; and finally go to 100,0 and play an F.
Post comments, discussion, answers at F02 Final Exam Review: Multimedia Programming in Squeak
You are a consultant to the WhizO Toy Company ("Makers of toys for tots of all ages"). WhizO is considering a shift to an object-oriented software development process. If they do make such a shift, you're in for big bucks as the consultant who leads the way. First step is to respond to the specific concerns of the Manager of their Software Development unit:
- "We usually have multiple teams of developers working on different parts of the programs at once. How does object-orientation help us with that?"
- "We rely heavily on simulation when developing sophisticated toys. What would be absolutely perfect would be if we could take parts of our simulation and use it in the code for the real toy. Can we do that? How?"
- "What happens if we develop add-ons for a toy, like a new Laser Gun for our Omega Video Game System? Or if we develop a new variation on a toy, like the Phaser Range Finder Gun (which is like the Laser Gun)? Can O-O help our productivity in doing this?"
Post comments, discussion, answers at F02 Final Exam Review: Whiz-O Toys
Design an Alarm System
Design an alarm system for installation in homes or businesses. You may assume that someone else is creating sensors and the mechanism to trigger alarms. You have to create the software to respond to alarms and to alert authorities.
- For any kind of alarm, you need to send all the alerts necessary for a given alarm. For example, for all fire alarms, the fire department is always called. The head of the house or business is always called for all alarm, and one or more "local experts" might also be called. For example, if there is a fire or intruder in the warehouse, the warehouse manager should also be called.
- You need to respond to Intruders by sounding the audio alarm in the vicinity. Assume that you just send the message trigger to the audio alarm object and it will sound.
- You need to respond to Fire by triggering the sprinklers in the vicinity, if available. Assume that you just send the message trigger to the sprinklers object.
- Your system is pretty sophisticated with respect to alerting authorities. It can handle IP or phone messaging. You can assume that the messaging is handled by another piece of the system. You need to provide the address of the authority (i.e., either a phone number or an email address) and the message to be sent (which should include, for example, the kind of alarm and the alarm vicinity).
Draw the UML class diagram for this class structure. (You don't have to add more features than what's described.) Note: Partial credit will be given, so err on the side of too much, not too little. In your analysis, be sure to address:
- What classes do you need? What service do each need to provide? What attributes do each need to know?
- Where are there generalization-specialization relationships? Where are there part-whole relationships?
Note! This is an important one!
Displaying the Current Status. You must now provide an interface for your alarms: An AlarmStatusView that shows that status (triggered by a sensor or still waiting) of each alarm.
How do you implement View/Model communication? How would you change your Alarm class(es) to implement this feature? Be sure to tell me (a) how the AlarmStatusView finds out an alarm being triggered and (b) how it finds the vicinity of the triggered alarm to display.
Post comments, discussion, answers at F02 Final Exam Review: Displaying Alarm Status
Links to this Page