Seeing Patterns

Consider using the following patterns:

Strategy

Decorator

Publisher-Subscriber (Observer)

Adapter

Composite

Lab 1

A firm’s staff consists of managers and workers. Managers manage workers and lower ranking managers. Workers execute their assigned task. However, this task may vary from day to day or worker to worker.

Lab 2

A university has a legacy evaluator that they use to evaluate applications for admission, scholarships, and student loans. However, they want to customize the evaluator in various ways for different categories of students.

Lab 3

Various numbers and types of organizations may want to be informed when a suspicious person enters a secure area.

Lab 4

An expression processor (like a command processor) evaluates expressions. There are three types of expressions: sums, products, and numbers. Here’s the syntax:

EXPRESSION ::= NUMBER | SUM | PRODUCT
SUM ::= EXPRESSION + EXPRESSION
PRODUCT ::= EXPRESSION * EXPRESSION

Lab 5

A digital solitaire game has different “skins” that can change the way cards are displayed and can add additional rules such as limiting the number of times the player can go through the deck or the amount of time the player can use.