Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools

Assignment 1: Object Oriented Programming

Release date: Thursday, 11.04.13 - Due date: Tuesday, 16.04.13, 11:59 (noon)

If one of the tasks seems too difficult, skip to the next one and return to the skipped ones later.
There is an introduction into the basic OOP concepts at Oracle (who bought Sun).
It is OK to ask questions about basic things like Strings, Lists, loops on the mailing list.
You may find a bunch of other tutorials online. Some even as Videos.
This is the only assignment (besides assignment 0) that you may submit via email to your tutor!
To do so, right click on the project in eclipse and select export as zip file.
To submit the following assignments you will use our repository.
This assignment should be solvable if you know how to program in C++, C# or certainly if you know Java.
In case you have no experience with object oriented programming at all, we may give you some extra time for this (and only this) assignment.

How to start

  • Install eclipse. (Select “Eclipse Classic”)
  • Download tutorial project and import it.
    • In Eclipse follow: File → Import… → General → Existing Projects into Workspace → Select archive file …
    • DO NOT get distracted to: File → Import… → General → Archive File … !!!
  • Your solutions should be in the folder src.
  • You should never change any class in the tst folder.
  • The tasks are described in more detail in the mentioned files in the tst folder.
  • The first thing you should do is to run the tests1).
  • You will see that 11 of 14 tests are failing 2). This means that we made assertions about the base code that are not true for the current implementation.
  • After you solved all tasks 12 of 14 tests should be successful 3). If you decide to solve even the extra tasks everything should be green 4) and there should be even more tests (i.e. for the last tasks you are asked to change or even create tests.)

Task 01: Persons and Addresses (Identity vs Equality of Objects)

3 points

After you have solved this task, you should be able to understand and explain:

  • … the difference between the two concepts equality and identity of objects.
  • See A1T01_AddressTest in the package people in the tst folder.

Task 02: Number Generators (Implementing Interfaces)

3 points

After you have solved this task, you should be able to understand and explain:

  • … how you write classes that implement interfaces.
  • … how you write methods that can work on any of these classes.
  • See A1T02_NumberGeneratorTest in the package numbers in the tst folder.
  • Complete the implementation of the classes FastGrowingNumberGenerator and SuperstitionRespectingNumberGenerator as well as the implementation of the method collectSomeNumbers so that the test succeeds.

Task 03: Students and Professors are Persons (Class Inheritance)

4 points

After you have solved this task, you should be able to understand and explain:

  • … how you can create subclasses.
  • … how class extension relates to interface implementation.
  • … how you can make use of inheritance to reuse common functionality.
  • See A1T03_PersonsStudentsProfessors in the package university in the tst folder.

Task 04: The University (Using Frameworks)

4 points

After you have solved this task, you should be able to understand and explain:

  • … how to let your classes implement interfaces so that framework classes know what to expect from them.
  • … how to configure framework classes, so that you can extend their behavior without modifying them.
  • See A1T04_StudentTest in the package university in the tst folder.

Extra Tasks

6 points These tasks are optional.5)

If you're done with all the tasks above and you still have time and energy left you may want to work on …

  • A1X01_AddressExtraTest to learn more about hash codes.
  • A1X02_NumberGeneratorExtraTest to learn more about exceptions.
  • A1X04_RegistrarsOfficeTest to learn more about tests.


They don't count for the 100%. I.e. you can get more than 100%, if you solve all tasks an the the extra tasks as well.
teaching/lectures/oosc/2013/assignment_1.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024