Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
( Object Oriented Programming ) - ( Black Box Testing ) - ( Small Refactoring ) - ( Refactoring the Three Key Cup App )
Code for this tutorial: https://github.com/dsp-de/tutorial-three-key-cup-app |
---|
Clone the repository https://github.com/dsp-de/tutorial-three-key-cup-app and import it into your workspace. Run the application. If you run into problems, don't hesitate to ask questions on the mailing list. Configurations problems are frequent and we are unable to forsee them all.
exercise.basic.VertexTest
as JUnit test. It should succeed.exercise.basic.PolyLineTest
. There are two problems in it. The comments in the code tell you how you should solve them.
(In preparation of this part get familiar with the design pattern “state”. Searching may help you. The first two matches are quite ok.)
The class hierarchy below exercise.model.Shape
doesn't make much sense. You can simplify it by introducing the state pattern. Remember: You are doing a refactoring. This means the program should behave exactly the same after you changed it. (There “are” only the three keys “1”, “2” and SPACE. The cup is rotatable and the smoke resizable but not the other way round.)
You may have a look at:
Martin Fowler: Refactoring - Improving the design of existing code, pp. 362-367, “Tease Apart Inheritance”.
(Search on observer.)
The classes in the package exercise.model
know explicitly by which part of the GUI they are displayed. This makes it tough to add other views. Introduce the design pattern “Observer”. After this change it would be easy to add e.g. a view which shows the actual effect of the keys.
We do think this code could need some improvement. We have at least eight suggestions. Find four locations, where the code needs improvement. For each of these locations do the following:
We have compiled a list of hints. Feel free to use them, if you don't prefer to explore the code first on your own.