The goal of this assignment is to gain experience with some of the popular design pattern you are likely to encounter "in the wild".
I want your programs to demonstrate the salient features of each design pattern.
You do NOT need to generate complex examples, your programs can be relatively short.
But try and come up with a plausible use for each pattern that isn't clearly derivative from the Head First Design Pattern examples.
Pattern 1: State design pattern
Create an object that has at least three states.
Object should have at least one method that returns different output depending on the current state.
Object should internally update its state after each call to this method or methods.
Create a client program that demonstrates how your classes and the pattern works.
Pattern 2: Observer pattern
Create an object that needs to be observed.
Attach at least two observers to this object.
I want you to implement the Observer pattern yourself, do NOT reuse the provided Observer pattern in the Java class library.
Create a client program that demonstrates how your classes and the pattern works.
Pattern 3: Decorator pattern
Create an object with at least two methods that produce some sort of output when they are called.
Create a decorator that adds at least two additional operations that also produce output.
Create a client program that demonstrates how your classes and the pattern works.
Documentation
Aside from the code, each project should contain the following:
A UML diagram showing the classes involved in the pattern.
A readme.txt plaintext file answering the following questions:
What problem is your program is solving? (i.e. is it controlling a stoplight, watering the lawn, etc)
Why is this pattern useful for solving this problem from a software engineering perspective?
That is, how does it encourage maintainable/extensible/readable code?
Give concrete examples.
Submission.
Please submit a zip to the Moodle dropbox containing your Eclipse project directories.
Be sure to include in each project the required UML diagram as well as a readme.txt file answering the questions above.
NOTE: please include your name(s) in your Eclipse project name as this makes it easier for me to import multiple submissions into my Eclipse.