Wednesday, March 29, 2017

Design Patterns which are used on Spring project - Part 1

Composite Pattern

In order to manager the nested nature of the tasks we will use the composite pattern, which allows each Task object to have references to other Task objects below/within it. The Major and Minor Task objects will also keep track of other Task related information such as due date, and description (see Class Diagram).

* Task = a Task object is an interface used to describe both MajorTask objects and MinorTask
objects.
* Major Task = A MajorTask object is one that include a reference to 1 to many subtasks.
* MinorTask = a MinorTask object or “Leaf” is a task with no tasks below it.

Memento Pattern

The memento pattern is used when “snapshots” of an object’s current state want to be saved for possible reference. Here, we use the pattern to control document versioning.

* Document = this object holds a reference to the actual file we are currently working with, as
well as other pertinent information like revision number and tags.
* Version = This is the snapshot of the document, which keeps track of the state of the Document
object when it asked to create this version of Memento of itself.
* CareTaker = the CareTaker keeps track of all the different Version objects as they are created
over time. It maintains them all so that any one of them can be referenced or reverted back to
in the future if necessary

Strategy Pattern

We use the Strategy Pattern in relation to roles and permissions of users. Each Role represents a set of
permissions allowable in the system. Each User will hold an instance of a Role object using one or more of the following permissions “strategies”. This will allow for easy adjustment of permissions.
■ GrantWorker
■ GrantOwner
■ Technical Admin
■ ReadOnly/Auditor
■ Grant Manager
■ Financial Analyst

Factory Method
We used the Factory Method pattern for the creation of Workflows to get rid of some overhead when they are created. Certain workflows can be designed with tasks already in place to help with the grant process. When creating a workflow, the WorkFlowFactory will create all of the necessary tasks “behind the scenes”.

* WorkFlow = an interface of the different kinds of workflows
■ Research
■ CFA
■ Reapply
■ Audit
* WorkFlowFactory = creates the specific workflows

No comments: