Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Summer 2001 Final 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.
There is a discussion area for each problem – go ahead and try to answer them, and see if others agree with you! Lex Spoon and the TA's will correct any outright errors, but otherwise this is your area.
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 Sum01 Final Exam Review: Sensor Management System.
- Give three reasons that one might use a virtual machine instead of a compiler to machine code.
- Give three good and frequent reasons that one might add a primitive to a VM.
- Why, for many languages, can the call stack not be implemented using the stack instructions the CPU understands? i.e., why can't the call stack be implemented as a contiguous block of memory where items are pushed and popped from one end only?
Post comments, discussion, answers at Sum01 Final Exam Review: Virtual Machines.
- Name three reasons that a language with garbage collector can be more convenient to program in.
- Give an advantage and disadvantage to each of the following garbage collection approaches:
- reference counting
- mark and sweep
- stop and copy
Post comments, discussion, answers at Sum01 Final Exam Review: Garbace Collection.
What is wrong with each of the following optimization strategies?
- "I will write my whole program in primitives, because it needs to be fast."
- "My movie player is running too slowly, so I will implement a better data structure to manage the sequence of movie items."
- "I'm writing a program to maintain and search a database of available Squeak software packages. Because it needs to be fast, I will store the database as a balanced binary tree. It will take a week to write the balanced binary tree, but performance is very important."
Post comments, discussion, answers at Sum01 Final Exam Review: Optimization Strategies.
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 Sum01 Final Exam Review: Collection Differences.
What OO language would you choose to implement the following systems, and why?
- You are writing a device auto-detection system for an operating system. The system manages a list of device drivers, and at the user's request can attempt to automatically detect what devices are present on the system.
- You are writing a web-based registration system, similar to Georgia Tech's Banner, that records the official records of all students, faculty, and staff of a university, and which can be queried with a web browser.
- You are writing the MPEG decoder for a consumer handheld movie player that holds movies on MPEG-encoded DVD's. The device will be mass-produced, and the software isn't very complicated.
- You are developing a professional movie editting system, and you wish to write a prototype to test the user interface. The prototype will only be used for about a month, and the entire functionality doesn't need to be implemented.
- You are writing the client for an online gaming network. The client will execute within people's web browsers for convenience. Typical games are chess, backgammon, spades, and go fish.
Post comments, discussion, answers at Sum01 Final Exam Review: Language Differences.
- What's a class? What's an instance?
- What's the difference between a class method and instance method?
- What's the difference between a class variable and instance variable?
- What are the strengths and weaknesses of a prototype vs. class-based object system?
Post comments, discussion, answers at Sum01 Final Exam Review: OO Theory.
OO Theory: Message Lookup
- What is the difference between static message lookup and dynamic message lookup? Give an example feature, in any OO language you know, that supports each of these. What is an advantage to each approach?
- When performing message lookup, some OO systems will consider the class of the arguments, and some will only consider the receiver of the message; this is called multiple-dispatch and single-dispatch, respectively. Give an advantage to each approach. Describe one problem that can be easily solved with multiple-dispatch, but which is much more complicated with single-dispatch.
Post comments, discussion, answers at Sum01 Final Exam Review: Message Lookup.
OO From a Manager's Perspective
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 Sum01 Final Exam Review: Whiz-O Toys.
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
c. "All of us felt that usual 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 Sum01 Final Exam Review: HCI Design.
Name one other UML diagram besides a class diagram, and describe what it's good for.
Post comments, discussion, answers at Sum01 Final Exam Review: UML.
a. What is the difference between Factory Method and Abtsract Factory?
b. What is the difference between Adapter and Decorator?
c. Name two reasons why it might be useful for a professional programmer
to study design patterns. Give one reason why it might in fact be
Post comments, discussion, answers at Sum01 Final Exam Review: Design Patterns.
Design Patterns in Tools for Space Scientists
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 Sum01 Final Exam Review: Tools for Space Scientists.
Designing with Model View Controller
Suppose you are designing a Hopping Mania, a jump-and-run computer game where the hero must jump from platform to platform without falling between the cracks to their doom. If the hero ever steps on a rock, then it gets in their shoe and they can only run half as fast for 10 seconds. Having taken CS 2340 at Georgia Tech, you decide to design the system using the Model-View-Controller architecture.
Describe the classes you would use to support the following features (on the test, you would be asked to sketch a UML diagram, but you can simply list the classes for the online problem):
- On different levels, the layout of platforms and small rocks will be different.
- The user can press arrow keys to control the hero's motion.
- If the hero walks across a rock patch, there is a 25% chance of getting a rock in their shoe and running slower.
- In the user interface, the hero is alawys located in the center of the screen; when the hero moves, the platforms scroll around them.
For each of the following scenarios, describe which classes from your design are involved, and what messages they would send to each other:
- The user is holding down the right arrow key, and the hero runs to the right across a platform
- The user presses the up arrow key to jump while holding down the right arrow key. Unfortunately, the user jumped too early and so the hero falls off the bottom of the screen and dies. (Especially salient considering the messy desk that underlies my screen -Lex)
- The hero gets a rock in their shoe and starts running slowly.
Pay particular attention to interactions between the user interface and the rest of the system. You must use an MVC design. You may assume that any reasonable widgits are already available in the system. e.g., you may assume that there is already a widgit for displaying bitmap images, but you may not assume that there is a HappingMania widgit already written.
Post comments, discussion, answers at Sum01 Final Exam Review: Hopping Mania.
Links to this Page