Design Patterns Application in AIMS Project: Observer & Flyweight

Verified

Added on  2021/11/19

|10
|1815
|93
Project
AI Summary
This project report analyzes the application of two design patterns, Observer and Flyweight, within the context of an AIMS (likely an academic information management system) project. The student identifies the patterns, explains their intent and problem descriptions, and discusses where they are applicable within the project's design. The report includes an analysis of the problems the patterns solve (such as slow development and communication issues), as well as the consequences of using them (improved code readability and standardized solutions). The document outlines the planning for implementing the patterns, including UML class diagrams and implementation steps for both the Observer and Flyweight patterns. Finally, the report references several academic sources related to system analysis, design, and design patterns.
Document Page
1Applying Design Patterns on Aims Project
APPLYING DESIGN PATTERNS ON AIMS PROJECT
By (Student names)
[Course Name]
[Lecture Name]
[University Name]
[City where the university is located]
[Date]
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
2Applying Design Patterns on Aims Project
Table of Contents
1 The two Identified design pattern to be applied in the project and how............................................2
2 Analysis of individual project...............................................................................................................6
2.1 Where the identified patterns are applicable and why................................................................6
2.2 Problems the patterns would solve.............................................................................................7
2.3 Consequences arising due to using the patterns.........................................................................7
3 Explanation of planning to use the patterns in the project..................................................................8
4 Reference.............................................................................................................................................9
Document Page
3Applying Design Patterns on Aims Project
1 The two Identified design pattern to be applied in the project and
how
The pattern in the project design process is used to identify the various common types of
problems and also provides the solutions structures that are best to solve the problems, the
patterns do not deal with certain specified problems but instead they deals with the general types
of problems.
In the AIM individual project there are two major patterns learnt that I found essential to be
applied in the project, among the two patterns includes the observer pattern and the singleton
pattern.
The design patterns has a specific pattern where they have the Intent, Problem descriptions, the
Contexts, Forces, the Solution, the Sketch and the resulting Contexts as shown below.
i. Observer pattern.
Name Observer pattern
Intent It defines the one-to-many dependencies between the objects such that while one objects
state change all its dependents automatically get notifications and updates.
Problem
Descriptio
n
How the states are maintained in a consistent manner between the disparate and
independent parts of the software application?
Context In case there are two parts that relates to each other and one of the part is dependent of the
other part. The two parts encapsulation in separate objects enables one to do modification
and re-use those objects independently.
In case one wants a simple interface to allow the object to notify wide variety of other
objects with a loose coupling.
In case one is changing object that requires another object and one do not know number of
other objects that require to be changed.
Forces The increase in coupling enable one object to know the time any other object changes the
states. As a result of increased coupling the software design becomes rigid and hard to
modify and less usable. The various dependent objects require knowing the other object’s
Document Page
4Applying Design Patterns on Aims Project
internal structures and therefore in case the structures change the various dependent objects
require also changing. In case there are different type of the dependent objects the strong
dependencies becomes expensive in their maintenance.
Solution The complex dependencies are solved through the definition of two abstract classes which
provides simplified interfaces between the publishers and the subscribers. The two classes
represent the subjects and the observers where the subjects know their respective observers
and also might have instances of the dependent observers. The subjects provide the
interfaces that attach and detach the observer objects. The observers on the other side define
the interface that subject the user to give notification to the observers that the subject has
changed.
Sketch
ii. Flyweight pattern.
Name Flyweight pattern
Intent It is designed to allow the sharing that supports large number of objects which has parts of
the internal states which are common while the other parts of state varies.
Problem
Descriptio
How some of the objects internal states become common while the other object’s state
varies in the program?
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
5Applying Design Patterns on Aims Project
n
Context In case one wants to declare the interfaces through which the flyweight can receive and acts
on extrinsic states. The flyweight interfaces are implemented and the intrinsic states are
stored.
In case one want to create and manage the flyweight objects where the factory enables the
sharing of the flyweight objects ,however the factory will be used to maintain the pools
various flyweights objects and also return the object from the pool in case it already exist.
In case the clients want to maintain the reference to the flyweight in addition to computing
and maintenance of extrinsic states.
Forces The users requires the flying weight objects and the factory is responsible of calling the
flyweight objects .The factory in this case check the pool of the flyweight in order to
determine the in case the requested flyweight object is present in the object pool and in
case the object is available its reference is returned to the factory, however when the object
is not available then the factory create a flyweight of the requested object types ,then add it
to the objects pools and then return references to the flying weight. The flyweight then
maintains intrinsic states and then provides a method that manipulates an external state.
Solution The solution is obtained through the use of the object oriented text editor that creates the
characters objects to represents the various characters that are found on the documents, this
character object is able to maintain the information concerning the characters ,the
documents tends to have large number of characters requires large memory where the
character’s number is known and is fixed and therefore the creation of the flyweight for the
letter clients the editor memory requirement is reduced drastically.
Document Page
6Applying Design Patterns on Aims Project
Sketch
(Karumanchi, 2012).
The above two design patterns are the selected patterns and they will be used to solve the various
design problems as follows.
i. The observer pattern: This will be applied in the project design in order to facilitate
the relationship of the system project in one-to-many form and it allows the objects to
be updated and notified when one of the objects states changes.
ii. The flyweight pattern: This is the other pattern that is used to enable the objects
sharing of objects that has common internal states and the others with variable states
and thus facilitates the communications of the objects.
2 Analysis of individual project
2.1 Where the identified patterns are applicable and why
The two identified design patterns are applicable in the development of the identified AIM
project in the following cases.
i. They are used in providing the system developers with tried and tested solutions and
it is in order to ensure there are no errors in the developed system.
Document Page
7Applying Design Patterns on Aims Project
ii. They are used in the provision of neutral languages and this is because it is applicable
to all object oriented programming languages.
iii. It is used in aiding the communication and this is because of proper documentation
and is easily researched.
iv. They are used in reduction of projects technical risks and this is because of the
provision of proven track records in the developed system.
v. They are used practically in various applications since they have flexibility and
practically easy to use (Goyal, 2011).
2.2 Problems the patterns would solve
The selected design pattern is able to solve various design problems which are encountered by
the system developers during the entire system development process which includes the
following.
i. Solve the problem of slow system development process through provision of testing,
and proved developments paradigms.
ii. They solve the problems of arising of subtle issues during development processes.
iii. They solve the challenges in the codes readability for the system coders and
architects.
iv. They solve the broader problems that can be solved by the software design
techniques.
v. They solve the communication problems that are identified between the developers.
2.3 Consequences arising due to using the patterns
As a result of using the proposed pattern there are various positive results while developing the
system which includes the following:
i. There will be speedy system development due to the use of the tested and proven
developments paradigms.
ii. There will elimination of subtle issues in the development process as a result of using
re-using design patterns.
iii. There is improvement in the codes readability by the system developers, coders and
the architectures.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
8Applying Design Patterns on Aims Project
iv. The selected design patterns will also provide general and documented solutions
which are not linked only to one problem.
v. The patterns also enable effective communication between the system developers
through the use of software names that are well understood.
vi. The patterns also will provide standardized solutions to various common
programming problems.
vii. The patterns use will also enable the large scale software re-use.
viii. There will be transparency in the application’s design.
3 Explanation of planning to use the patterns in the project
In the identified project the selected patterns will be used to solve the various identified problems
above and below are the plans of using the patterns in the project.
i. Observer pattern planning.
The observer is planned by implementation of the UML class diagram as below using the
following steps.
a. Implementing the Observable object – This involves the creation of interfaces or
abstract class that defines the operations that detaches or attaches the observers to the
clients.
b. Implementing the ConcreteObservable object – This involves the creation of the
concrete Observable class that maintains the states of the objects and the attached
observers get notified in case the object state is changed.
c. Implementing the Observer object –This involves the use of the interfaces or abstract
classes that defines the operations that notifies the objects of any committed changes
(Gupta, 2015).
ii. Flyweight pattern planning.
The flyweight is planned by implementation of the UML class diagram as below using the
following steps.
Document Page
9Applying Design Patterns on Aims Project
a. Implementing the Flyweight – This is the declaration of interfaces that are used by
flyweight to receive and act on the extrinsic states.
b. Implementing the ConcreteFlyweight This involves the implementation of the
flyweight interfaces and storing of the intrinsic state.
c. Implementing the FlyweightFactory – This involves the creation flyweight’s objects
through the factory where the factory enables the sharing of flyweight objects.
d. Implementation of the Client object – The client is implemented in order to maintain
reference to the flyweights and it will enable the computations and maintenance of the
extrinsic state (Award, 2013).
Document Page
10Applying Design Patterns on Aims Project
4 Reference
Award,E.(2013) Systems Analysis and Design .3rd edn.Delhi:Galgotia Publications Pvt Ltd.
Gupta,B.(2015) Power System Analysis and Design.1st edn.New Delhi: S Chand & Company.
Goyal, A. (2011) systems Analysis and Design Paperback .2nd edn.INDIA:Prentice Hall India
Learning Private Limited.
Karumanchi,N.(2012) Peeling Design Patterns: For Beginners and Interviews.5th edn.New
York:CareerMonk Publications.
chevron_up_icon
1 out of 10
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]