Exercise on Object-oriented Programming

Goal

Gain practical experience with a purely object-oriented programming style.

Method

Develop a sample program in Smalltalk as an example for a pure object-oriented language.

Task

Create a simple drawing program for straight lines.

The program should display a window with an initially empty drawing area. The user can then draw straight lines by clicking the starting point, dragging the mouse pointer and releasing the mouse button at the end point. It should be possible to draw an unlimited number of lines.

The above is the absolute minimum requirement. You should extend that by at least one of the following additional features:

  • Undo: remove drawn lines in the reverse order in which they were drawn.
  • Colors: different pen colors (for example, with a clickable palette)
  • Pen size: different pen sizes (for example, with a text field or a pop-up button)
  • Editing: modify existing lines, for example, by clicking and dragging lines and/or their end points
  • Zooming: view the drawn picture at different scale factors (e.g., 50%, 100%, 150%)

Important: You can easily find working examples of similar programs 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.

Development Systems

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.
It is mostly a matter of taste which of these systems you prefer. For the POPL exercise, you can use either.

Expected Results

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.

Presentation

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.
Don't start with the project at the end of the semester, but rather view it as a continuing exercise that you should do in parallel with the course.

The presentation takes place in room number 0204 (Blaschek's office, Science Park SP3, 2nd floor) on Tuesday, January 8 and Wednesday, January 9.

Tuesday, January 8Wednesday, January 9
08:30: Dominik Dirmeier08:30: Matthias Winkler
08:40: Patrick Fritsch08:40: --
08:50: --08:50: --
09:00: --09:00: --
09:10: --09:10: --
09:20: --09:20: --
09:30: Simon Eilmsteiner09:30: --
09:40: Lukas Makor09:40: --
09:50: Michael Jäger09:50: --
10:00: Florian Kiesl10:00: Sebastian Kloibhofer
10:10: --10:10: --
10:20: Daniel Pucher10:20: --
10:30: Pei-An Wang10:30: Mohammed Gomaa Saber Mahmoud
10:40: --10:40: --
10:50: Manuel Hoffmann10:50: --
11:00: Johannes Wöß11:00: Redjon Prengzi
11:10: --11:10: --
11:20: Amarildo Kondi11:20: --
11:30: --11:30: --
11:40: Ayda Shafi11:40: --
11:50: Arif Anatol Celik11:50: --
12:00: --
12:10: --
12:20: --
12:30: Adrián Szegedi
12:40: Marián Sabat
12:50: Nisrine Zerouali
13:00: Lukas Steghofer
13:10: --
13:20: --
13:30: Ghilas Belkaci
13:40: Daniel Alexander Pekarek
13:50: --
14:00: Ramya Jayaraman
14:10: Jakob Faschinger
14:20: Edvin Herac
14:30: Christian Huber
14:40: Markus Mülleder
14:50: Ardi Kurtishi