Advanced Programming Assignment 2: Design Patterns and Application
VerifiedAdded on 2021/11/23
|28
|4015
|256
Report
AI Summary
This report presents a comprehensive solution to an advanced programming assignment. The first part of the assignment involves building an application for a Product Management System, derived from a UML class diagram. The application, developed using Java, includes features to manage technology and houseware products, such as adding, displaying, updating, and deleting product information. The second part of the report delves into design patterns, explaining their purpose and categorization, with a focus on creational, structural, and behavioral patterns. Each pattern is defined, and its applications and benefits are detailed, accompanied by relevant examples to illustrate their practical implementation and use cases within software engineering, covering patterns like Factory, Singleton, Observer and many more. The report concludes with a discussion on the overall benefits of design patterns in creating flexible, reusable, and maintainable code.

ASSIGNMENT 2 FRONT SHEET
Qualification TEC Level 5 HND Diploma in Computing
Unit number and title Unit 20: Advanced Programming
Submission date Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name Student ID
Class Assessor name
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I
understand that making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P3 P4 M3 M4 D3 D4
~ 1 ~
Qualification TEC Level 5 HND Diploma in Computing
Unit number and title Unit 20: Advanced Programming
Submission date Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name Student ID
Class Assessor name
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I
understand that making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P3 P4 M3 M4 D3 D4
~ 1 ~
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

❒ Summative Feedback: ❒ Resubmission Feedback:
Grade: Assessor Signature: Date:
Internal Verifier’s Comments:
Signature & Date:
~ 2 ~
Grade: Assessor Signature: Date:
Internal Verifier’s Comments:
Signature & Date:
~ 2 ~

~ 3 ~
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Table of contents
Table of contents........................................................................................................................4
I. Introduction........................................................................................................................5
II. Build an application derived from UML class diagrams...................................................5
III. Design Patterns................................................................................................................12
1. What is design pattern.................................................................................................12
2. When use design patterns............................................................................................13
3. Categorization of patterns............................................................................................13
3.1 Creational Pattern..................................................................................................14
3.1.1 Factory pattern...............................................................................................14
3.1.2 Abstract Factory Pattern.................................................................................16
3.1.3 Builder Pattern...............................................................................................16
3.1.4 Singleton Pattern............................................................................................17
3.1.5 Prototype Pattern............................................................................................17
3.2 Structure Patterns..................................................................................................18
3.2.1 Adapter Pattern..............................................................................................18
3.2.2 Bridge Pattern................................................................................................19
3.2.3 Composite Pattern...............................................................................................19
3.2.4 Decorator Pattern................................................................................................19
3.1.5 Flyweight Pattern...........................................................................................20
3.3 Behavior Patterns..................................................................................................23
3.3.1 Chain-of-responsibility Pattern...........................................................................23
3.3.2 Command Pattern...............................................................................................24
3.3.3 Observer Pattern.................................................................................................24
3.3.4 State Pattern........................................................................................................25
3.3.5 Strategy Pattern...................................................................................................25
IV. Conclusion.......................................................................................................................27
V. References........................................................................................................................28
~ 4 ~
Table of contents........................................................................................................................4
I. Introduction........................................................................................................................5
II. Build an application derived from UML class diagrams...................................................5
III. Design Patterns................................................................................................................12
1. What is design pattern.................................................................................................12
2. When use design patterns............................................................................................13
3. Categorization of patterns............................................................................................13
3.1 Creational Pattern..................................................................................................14
3.1.1 Factory pattern...............................................................................................14
3.1.2 Abstract Factory Pattern.................................................................................16
3.1.3 Builder Pattern...............................................................................................16
3.1.4 Singleton Pattern............................................................................................17
3.1.5 Prototype Pattern............................................................................................17
3.2 Structure Patterns..................................................................................................18
3.2.1 Adapter Pattern..............................................................................................18
3.2.2 Bridge Pattern................................................................................................19
3.2.3 Composite Pattern...............................................................................................19
3.2.4 Decorator Pattern................................................................................................19
3.1.5 Flyweight Pattern...........................................................................................20
3.3 Behavior Patterns..................................................................................................23
3.3.1 Chain-of-responsibility Pattern...........................................................................23
3.3.2 Command Pattern...............................................................................................24
3.3.3 Observer Pattern.................................................................................................24
3.3.4 State Pattern........................................................................................................25
3.3.5 Strategy Pattern...................................................................................................25
IV. Conclusion.......................................................................................................................27
V. References........................................................................................................................28
~ 4 ~
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

I. Introduction
Based on the class diagram created in assignment 1, in this assignment I will build an
application derived from that UML class diagram. Then, I will cover a series of design
patterns with relevant examples of creative, structural, and behavioral patterns.
My report includes two parts:
Build an application derived from UML class diagram.
Design patterns.
II. Build an application derived from UML
class diagrams.
I have just made a contract with FPT company and are about to be appointed as a project
leader for a group of programmers to develop its Product Management System. In this
Product Management System, I am required to create an application to store list of products
and list of products. With the system, the user can enter information about technology
products and home appliances such as id, name, price, … in the system, correct the
information if it is incorrect, or completely delete the information of the product. View a list
of all of the system’s products. To create this system, I used the Java programming language.
My product management system includes the following features:
1) Add a technology product
2) Display list of technology product
3) Update a technology product
4) Delete a technology product
5) Add a houseware product
6) Display list of houseware product
7) Update a houseware product
8) Delete a houseware product.
Below is the main menu of the program.
~ 5 ~
Based on the class diagram created in assignment 1, in this assignment I will build an
application derived from that UML class diagram. Then, I will cover a series of design
patterns with relevant examples of creative, structural, and behavioral patterns.
My report includes two parts:
Build an application derived from UML class diagram.
Design patterns.
II. Build an application derived from UML
class diagrams.
I have just made a contract with FPT company and are about to be appointed as a project
leader for a group of programmers to develop its Product Management System. In this
Product Management System, I am required to create an application to store list of products
and list of products. With the system, the user can enter information about technology
products and home appliances such as id, name, price, … in the system, correct the
information if it is incorrect, or completely delete the information of the product. View a list
of all of the system’s products. To create this system, I used the Java programming language.
My product management system includes the following features:
1) Add a technology product
2) Display list of technology product
3) Update a technology product
4) Delete a technology product
5) Add a houseware product
6) Display list of houseware product
7) Update a houseware product
8) Delete a houseware product.
Below is the main menu of the program.
~ 5 ~

~ 6 ~
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

~ 7 ~
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 1. Main menu
And below is the result of the program.
1. Add a Tech product
The first is the feature of adding a new technology product. With this feature, I will enter
product information such as id, name, price, description.
~ 8 ~
And below is the result of the program.
1. Add a Tech product
The first is the feature of adding a new technology product. With this feature, I will enter
product information such as id, name, price, description.
~ 8 ~

In addition, when we add a new product with an existing id, the system will issue a message
and ask to re-enter it.
2. Display list of tech product
After successfully adding a new one, we can view product information through the
technology product list display feature.
~ 9 ~
and ask to re-enter it.
2. Display list of tech product
After successfully adding a new one, we can view product information through the
technology product list display feature.
~ 9 ~
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3. Update a tech product
When I need to update information technology product, I will choose the third feature "
Update a tech product”.
List of technology products before updating.
~ 10 ~
When I need to update information technology product, I will choose the third feature "
Update a tech product”.
List of technology products before updating.
~ 10 ~
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

And list of technology products after updating.
4. Delete a tech product
List of technology products before deleting.
And list of technology products after deleting.
~ 11 ~
4. Delete a tech product
List of technology products before deleting.
And list of technology products after deleting.
~ 11 ~

Besides, I can also add, update, delete houseware products similar to technology products.
Here is the link to my code:
https://drive.google.com/drive/folders/1yp4rjUVZavi4F4rzsRC9JJ0MjqMf5G
ql?
fbclid=IwAR1tdieVd22iKdYSbmHHfV0k30uaRL4kUsBCw6qDRxkKJaMJEdaKf
K4QRM.
III. Design Patterns.
1. What is design pattern
In software engineering, a design pattern is a general repeatable solution to a commonly
occurring problem in software design. A design pattern is not a finished design that can be
transformed directly into code. It is a description or template for how solve a problem that
can be used in many different situations.
In general, a pattern has four essential elements:
Pattern name, is used to provide a single and meaningful name to the pattern which
defines a design problem and a solution for it. Naming a design pattern helps itself to
be referred to others easily. It also becomes easy to provide documentation for and
the right vocabulary word makes it easier to think about the design.
The problem describes when to apply the pattern. Occasionally, the problem will
include a list of conditions that must be met before it makes sense to apply the
pattern.
~ 12 ~
Here is the link to my code:
https://drive.google.com/drive/folders/1yp4rjUVZavi4F4rzsRC9JJ0MjqMf5G
ql?
fbclid=IwAR1tdieVd22iKdYSbmHHfV0k30uaRL4kUsBCw6qDRxkKJaMJEdaKf
K4QRM.
III. Design Patterns.
1. What is design pattern
In software engineering, a design pattern is a general repeatable solution to a commonly
occurring problem in software design. A design pattern is not a finished design that can be
transformed directly into code. It is a description or template for how solve a problem that
can be used in many different situations.
In general, a pattern has four essential elements:
Pattern name, is used to provide a single and meaningful name to the pattern which
defines a design problem and a solution for it. Naming a design pattern helps itself to
be referred to others easily. It also becomes easy to provide documentation for and
the right vocabulary word makes it easier to think about the design.
The problem describes when to apply the pattern. Occasionally, the problem will
include a list of conditions that must be met before it makes sense to apply the
pattern.
~ 12 ~
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 28
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.





