Detailed Report: System Design Using Design Patterns and UML Diagrams

Verified

Added on  2024/06/28

|15
|2451
|499
Report
AI Summary
This report provides a comprehensive solution to a system design assignment, focusing on the application of creational design patterns and UML diagrams. It discusses Singleton, Factory Method, Builder, and Abstract Factory Method patterns, highlighting their advantages and disadvantages. The report includes use case diagrams for checkout procedures and computer price calculations, implemented using draw.io. It justifies the selection of the Factory Method pattern for its efficiency in order management and invoice generation. The report further elaborates on code reusability and abstraction levels, along with sequence diagrams illustrating the flow of processes such as subtotal calculation and computer price determination. The diagrams visually represent the interactions between different system components, offering a detailed understanding of the system's architecture and functionality. Desklib provides access to this and other solved assignments to aid students.
Document Page
Contents
Introduction
......................................................................................................................................2
Answer 1
.......................................................................................................................................... 3
Answer 2
.......................................................................................................................................... 4
References
........................................................................................................................................7
Appendix A
......................................................................................................................................8
Conclusion
..................................................................................................................................... 15
Figure 1: Check out
......................................................................................................................... 4
Figure 2: Computer Price
.................................................................................................................5
Figure 3: Use Case Diagram
............................................................................................................8
Figure 4: Class diagram
................................................................................................................... 9
Figure 5: Sequence diagram
.......................................................................................................... 10
Figure 6: Class diagram
................................................................................................................. 11
Figure 7: Sub_total of items
.......................................................................................................... 12
Figure 8: Sequence diagram of computer price
............................................................................. 13
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
Introduction
The report contains the overall solution of the questions that are provided in the assessment.

There are many diagrams that are included in the report so that the report can be understood

properly and efficiently. The report consists of the proper explanation of the solution that is

provided in the given assessment.
Document Page
Answer 1
The patterns of the creational designs are concerned with the method by which the creation of the

object is there as well as the complexities that are faced by the objects and the concern related to

the instability of the object creation which needs to be controlled (
Dwivedi et al., 2016). There is
an operator that is called the new operator is dangerous as it can scatter the objects on the

application and over the time it may have become more difficult to change the implementation in

the program as the classes that are present in the program can get more compacted and get

coupled very tightly. These creational design patterns provide help in recovering from this issue

by decoupling the classes from the process of initialization method which was present.

Here four creational design patterns are discussed in details so as to provide a better

understanding of these designing patterns. They are listed as:

Singleton.
Factory method.
Builder.
Abstract Factory method.
Now let’s understand them one by one:

Singleton
creational design pattern helps in ensuring that only one instance of an object is
available in the application (
Issaoui et al., 2015).
Factory method
is another creational design pattern that helps in creating the class object which
is related and by not specifying objects that are accurate and needed to create.

Builder creational design pattern
is useful as it helps in creating the objects which are complex
and is performed by using the approach of step by step processes.

Abstract factory method
is the last approach that is discussed here which is used in the creation
of objects family which are dependent (
Jaafar et al., 2016).
These mentioned design patterns are understood by the above description in brief and these have

some pros as well as cons that will be discussed herein the coming paragraph:

Advantages:

Design patterns provide the solutions for the issues which are based on the programming.
These design patterns are the structure of designing that helps in achieving the purposes
or aim that is specific.

These patterns help to make code flexible.
They are idiom programmings which are at a high level (Yu et al., 2015).
Helps in providing the connections by the program components.
Document Page
These patterns provide the structure of the design that helps in achieving some specific
goals.

Provide connectivity with program components (Cooper, 2017).
Disadvantages:

These design patterns provide no certainty with under the stability of the pattern
designing.

These patterns reduce the understanding of the code of addition indirections (Elish and
Mohammed 2015
).
Answer 2

Here is the solution of design problem 1 where the diagram on the use case of check out

procedure is provided:

Figure
1: Check out
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
Here is the solution to the use case of computer price is given: (Pradhan et al., 2015)
Figure
2: Computer Price
Provided solution for design problems:

(a) After studying all the design patterns, the factory method design pattern is the most useful

one. This design pattern helps in providing permission to the subclasses in order to choose the

type of object for creating objects. It helps in making the coupling loss by removing the

application of some specific classes in the code. This is the indication of the interaction of the

code along with the abstract class. This factory design pattern helps in the maintenance of the

order as well as help in generating the bills of the items as well as products which are chosen.

The design patterns resolve the problem of providing different operations for the creation of the

objects and are possible by just the factory method of design patterns. Therefore, this observation

provides that the design pattern of the factory method is one of the most efficient design patterns

among all the patterns.

(b) The use cases are drawn by the help of draw.io for explaining the processes of the checkout

and computer price designing. The created use case has links with many other entities. In the

diagram of checkout, the check out entity is interconnected with the entities of the cart; policy

gifts, print receipts and many others that can be seen in the diagram. These entities have many

attributes that help them in defining them and the cart entity is also interconnected with the gift

entity as well as the items. These items get added to the products that are different like

electronics, clothes, and books. The policy of the gifts named entity is connected with the gift

entity as many policies are applied and applicable to the gifts entity.
Document Page
Next is the class diagram which is based on the computer prices as this entity include two
different attributes and is interconnected with the relationship with the entity items. The two

entities are Localcomputerprice as well as OverseasComputerPrice which get connected with the

check out table that is created. The computer price table gets connected with the item table and

the aggregation of all the dependencies forms a class diagram.

(c) The selected design pattern is the factory method and it has many benefits that can

improvise the design. Through this factory design pattern, the orders can be properly maintained

and managed and the invoice of the customer can be easily handled with the generation of the

bills and amount. Another major profit that this design provides is the problems and issues

resolve feature of the operations that can be designed and this is possible by calling the method

of the factory method. These major profits can improvise the efficiency that is why this method

is selected (
Mayvan and Rasoolzadegan, 2017).
(d) The security if the patterns that are selected are for the reusability that implies the code

through which the code can make use again. The code that can be reused can be performed in the

most simpler technique for ensuring the basic level and many tasks are performed by the reuse of

the code. This includes the import of the code in the package form or the addition of the file of

package get simpler as well as least ambiguous. The reuse of code should be performed by

everyone, in fact, a standard should put on by the organizations to reuse the codes.

The disadvantage of the code reuse includes that if one code is reused again then the code that is

optimized will be obsolete and efficiency will reduce.

Then comes the abstraction level in the code of java which helps in providing the optimized code

that increases the efficiency so that the information of the background can get hide. This is how

the code gets optimized.

Another demerit of the abstraction level which the programmer needs and any background detail

if needed get hides and it can cause problems to the programmer. For every method, there are

pros as well as cons that were discussed above.
Document Page
References
Mayvan, B.B. and Rasoolzadegan, A., 2017. Design pattern detection based on the graph

theory.
Knowledge-Based Systems, 120, pp.211-225.
Cooper, J.W., 2017.
Design Pattarn Java Companion. Addison Wesley.
Elish, M.O. and Mohammed, M.A., 2015. Quantitative analysis of fault density in design patterns: An

empirical study.
Information and Software Technology, 66, pp.58-72.
Yu, D., Zhang, Y. and Chen, Z., 2015. A comprehensive approach to the recovery of design pattern

instances based on sub-patterns and method signatures.
Journal of Systems and Software, 103, pp.1-16.
Issaoui, I., Bouassida, N. and Ben-Abdallah, H., 2015. Using metric-based filtering to improve design

pattern detection approaches.
Innovations in Systems and Software Engineering, 11(1), pp.39-53.
Jaafar, F., Guéhéneuc, Y.G., Hamel, S., Khomh, F. and Zulkernine, M., 2016. Evaluating the impact of

design pattern and anti-pattern dependencies on changes and faults.
Empirical Software
Engineering
, 21(3), pp.896-931.
Pradhan, P., Dwivedi, A.K. and Rath, S.K., 2015, May. Impact of design patterns on quantitative

assessment of quality parameters. In
2015 Second International Conference on Advances in Computing
and Communication Engineering
(pp. 577-582). IEEE.
Dwivedi, A.K., Tirkey, A., Ray, R.B. and Rath, S.K., 2016, November. Software design pattern recognition

using machine learning techniques. In
2016 IEEE Region 10 Conference (TENCON) (pp. 222-227). IEEE.
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
Appendix A
Use case

Figure
3: Use Case Diagram
This is the use case diagram that is created by using draw.io and this shows the relation between

the user where the user can check out and the checkout includes two other option of computer

price as well as the receipt of the printed price. So this use case is just displaying the use cases of

the user and the function that he can perform.
Document Page
Class diagram
Figure
4: Class diagram
This is the class diagram of the whole scenario that contains functions of the price of the

computer as well as the checkout that were the main requirement of the system. The class

diagram contains the relationships and dependencies of the entities and attributes that are present

in the diagram. Every entity has some attributes and by combining these attributes the, class

diagram is composed completely.
Document Page
Sequence Diagram
Figure
5: Sequence diagram
The sequence diagram is composed by the use of draw.io. There are various entities that are

purchase screen, payment screen, checkout controller, shopping cart, computer price, the policy

of gift1, the policy of gift2, the policy of gift3 and controller of the printing the receipts. The

sequence diagram helps to understand the flow of the work in the form of a sequence and the

whole process can be understood by the person if he or she will read a sequence diagram.

A sequence diagram helps in simply depict the interaction among the objects in the order of

sequence which is explaining the interactions that can take place among each other. One can also

use the terms of the event diagrams as well as the scenario of the events that helps in referring

the sequence diagram. These sequence diagrams help in describing by how as well as in which

order the objects are functioning in a proposed solution or in the system. The sequence diagram

helps in describing the order and is used by many businesses and organization or the enterprises
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
or the developers of the software for the documentation and to understand the requirements that
exist for the new as well as the old existing solutions or systems.

Class diagram

Figure
6: Class diagram
This is the class diagram in which various relationships are shown and for every entity, there are

multiple attributes and the relationships in the form of dotted arrows as well as bold arrows

define different relationships. For every entity, there are different functions that define the entity

and help the user to understand the data type of every function.

Sequence diagram (sub_total of items)
Document Page
Figure 7: Sub_total of items
The above-given diagram displays the subtotal of the items and is created by using the draw.io.

The diagram displays the sequence flow of the function that is used by the system. There are four

main components in this attribute as there are Checkout controllers, Overseas price computer,

LocalpriceComputer, and the Product. For all the components there are some methods that

includes the getPrice(), computeSubTotal(), addItemPrice(), DestinationOverseas() all these

methods are mentioned in the diagram.

Sequence diagram (Computer price- total price)
chevron_up_icon
1 out of 15
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]