Exercise on Object-oriented Programming
Gain practical experience with a purely object-oriented programming style.
Develop a sample program in Smalltalk as an example for a pure object-oriented language.
Create a "Look at me!" animation where a figure looks in the direction of the mouse pointer.
The program should display window containing a face with eyes. The eyes should look in the direction of the mouse pointer and follow mouse movements. Note that the eyes do not necessarily look in the same direction (for example, when the mouse pointer is between the eyes).
You can create a simple or sophisticated illustration, with pre-made bitmap images or by programmatically drawing the entire face and the eyes. The representation is entirely up to you. The smiley face shown here is just an example.
It should be possible to change size and proportion of the face (for example, by resizing the enclosing window, or with dimensions supplied as method parameters).
Important: You can easily find working examples of similar animations implemented in Smalltalk. You are encouraged to study such examples, but you must finally implement your own program. During the demo, you must be able to explain how you did it, and you should be able to demonstrate that your program works for faces with different sizes.
Squeak is an open-source development environment for Smalltalk.
Pharo is an alternative system with a more modern look. In fact, Pharo was built on top of the Squeak system.
Both Squeak and Pharo are available for Windows, Mac and various Unix variants. They come with a wealth of documentation, tutorials and examples. For further information, see the documentation and samples on the project pages.
When you present your results at the end of the semester, we expect you to critically discuss your own implementation with respect to Smalltalk compared to other object-oriented languages. Which language properties of Smalltalk did you actively use? Which of them were helpful for the given task? Which got in your way and required workarounds? What would your solution look like if you had implemented it in a different language, such as Java?
During your presentation, you must expect questions about the standard classes of Smalltalk. It is therefore highly recommended that you familiarize yourself with the available classes in the Smalltalk class library. You should be able to explain why you chose a certain class in your implementation.
You have to present the result of your work in person at the end of the term. Please bring your own computer and prepare it for a quick demo, including a look at the source code of your implementation.
The presentation takes place in room number 0204 (Blaschek's office, Science Park SP3, 2nd floor)