In preparation

Java Capstone Series Pt. 1

Offered by Dr. Thomas Staubitz, Ralf Teusner

Work Sheet 2

Examples and Exercises

We've collected some examples and exercises for you. We already have covered some of these in the videos, so you just can follow the steps. There are also others that you need to solve on your own. These exercises are non-graded, so it's completely up to you if you want to work on them or not.

We've started a separate discussion thread for each of these exercises, please use these threads to discuss your findings/problems/ideas with this particular exercise. Please, do not hi-jack these discussions for off-topic posts to keep them focussed. There's plenty of room for other discussions in the forum.

Download Examples and Exercises

You'll find all listed examples on GitHub:

Counter 3 - Animation

//TODO

  1. Add animation
  2. Refactor
    a. Replace the Observer class with an AbstractView hierarchy
    b. Remove the remains of the obsolete Observer "pattern" in the model
    c. Try both: pushing and pulling the value from the Counter model.
  3. Discuss your findings/problems/ideas in the forum

We did most of this in the video:

You'll find the starting point for this in the capstone1-counter3 example on GitHub (or just continue with the previous example).
You'll find a solution for this in the capstone1-counter4 example on GitHub.

Counter 4 - Builder

//TODO

  1. Encapsulate counter creation in the Builder pattern.
  2. Discuss your findings/problems/ideas in the forum

You'll find the starting point for this in the capstone1-counter4 example on GitHub (or just continue with the previous example).
You'll find a solution for this in the capstone1-counter5 example on GitHub.

Here's a diagram for the builder pattern

Builder pattern

To be honest, the diagram in this case is not very informative. Try to use it in combination with the code examples. The notes in the diagram indicate which classes in the code examples are corresponding to the classes in the diagram. Both code examples include more classes than the diagram as the diagram does not show the actual product that is built.

In the capstone1-Builder example the product to be built consists of several parts, which are connected pairwise either uni- or bi-directional.

In capstone1-counter5 an interactive GUI component is built, which consists of a model, several views, and a controller.