Exercise index of this lecture   Alphabetic index   Course home   

Exercises and solutions
Introduction to Object-oriented Programming


1.1   How did you program the Hangman game?  

This is an exercise for students who have a practical experience with the development of the Hangman program, or a similar game.

Recall how you carried out the development of the program.

To which degree did you adhere to top-down development by stepwise refinement?

If you did not use this development approach, then please try to characterize how you actually did it.


1.2   Aggregated Concepts  

Take a look at the concepts which are represented by the phenomena in the room where you are located. Identify at least four aggregated concepts. Enumerate the concepts of the decomposition.


1.3   Concepts and Phenomena  

The purpose of this exercise is to train your abilities to distinguish between concepts and phenomena.

Decide in each of the following cases if the mentioned item is a concept or a phenomena:

  1. The door used to enter this room.
  2. Todays issue of your favorite newspaper.
  3. Your copy of today's issue of your favorite newspaper.
  4. The collection of all copies of today's newpapers
  5. Denmark.
  6. European country.
  7. The integer 7.
  8. The set of integers between 1 and 10.
  9. The set of all students who attend this course.
  10. The oldest student who attend this course.

For an item considered as a phenomenon, identify the underlying concept.

Solution

Some of the items clearly represent phenomena. These are:

  • The door used to enter this room.
  • Your copy of today's issue of your favorite newspaper.
  • Denmark.
  • The integer 7.
  • The oldest student who attend this course.

Most of the other items may, depending on our perspective, represent either a phonomenon or a concepts. Personally, I consider almost all of the items to represent phenomena. 'European country', however, is most likely to be considered a concept, namely a specialization of the concept 'Country'. Collections like newspapers and students typically represent phenomena. (Properties of such phenomena includes "the number of elements in the collections". Operationally, it may be possible to add an element to a collection or remove an element from the collection).

The concept behind "the collection of all copies of today's newpapers" may be newspaper bundle. You can imagine many instances of this concept (just take a look in your surrounding).


1.4   University Concepts  

In a university study, the study activities are usually structured in a number of semesters. There are two kinds of study activitities: projects and courses. At Aalborg University, there are currently two kinds of courses: Study courses (dk: studieenhedskurser) and project courses (dk: projektenhedskurser).

Characterize the concepts of university study, study activity, semester, project, course, study course, and project course relative to Aggregation/Decomposition and Generalization/Specialization.

Solution

A university study is aggregated by semesters. A semester is aggregated by study activities. Study activity is a generalization of project and course. In turn a course is a generalization of study course and project course.


Generated: Monday February 7, 2011, 12:11:54