Professional Documents
Culture Documents
TP NUMBER TP040274
DESIGN PATTERN Page |2
Table of Contents
Section 2: Implementation ....................................................................................................... 3
2.1 Design and Implementation using Simpler Solution ................................................................... 4
2.1.1 UML Diagram ................................................................................................................ 4
2.1.2 Source Code ................................................................................................................... 5
2.2 Design and Implementation using Factory Design Pattern based Solution .................................... 7
2.2.1 UML Diagram ................................................................................................................ 7
2.2.2 Source Code ................................................................................................................... 8
2.3 Design and Implementation using Proxy Design Pattern based Solution .................................... 11
2.3.1 UML Diagram .............................................................................................................. 11
2.3.2 Source Code ............................................................................................................. 12
Section 3: Analysis and Discussion ........................................................................................ 14
3.1 Measuring technique for the Selected Quality Attribute: .......................................................... 15
3.2 Analysis of the Results: ........................................................................................................ 17
3.2.1 Shape Maker’s system analysis: ...................................................................................... 17
3.2.2 Image View’s system analysis: ........................................................................................ 17
3.3 Discussion: ......................................................................................................................... 18
3.4 Conclusion: ........................................................................................................................ 19
DESIGN PATTERN Page |3
Section 2:
Implementation
DESIGN PATTERN Page |4
Simple System 2:
DESIGN PATTERN Page |5
Simple System 1:
Main Class:
Interface class:
Child classes:
DESIGN PATTERN Page |6
Simple System 2:
Main Class:
DESIGN PATTERN Page |7
Interface class:
Child Class:
2.2 Design and Implementation using Factory Design Pattern based Solution
2.2.1 UML Diagram
DESIGN PATTERN Page |8
Main Class:
DESIGN PATTERN Page |9
Interface class:
Child classes:
DESIGN PATTERN P a g e | 10
Factory Class:
DESIGN PATTERN P a g e | 11
2.3 Design and Implementation using Proxy Design Pattern based Solution
2.3.1 UML Diagram
DESIGN PATTERN P a g e | 12
Main Class:
Interface class:
Child Classes:
DESIGN PATTERN P a g e | 13
DESIGN PATTERN P a g e | 14
Section 3:
Analysis and Discussion
DESIGN PATTERN P a g e | 15
An external software reliability metric of ISO/IEC 9126 (ISO/IEC, n.d.) should be able to
measure attributes related to the software failure times. Software reliability consists of the
maturity metrics, fault tolerance metrics, recoverability metrics, reliability compliance metrics.
Also, Maturity metrics consist of the estimated latent failure density, estimated latent fault
density, failure density etc.
But, we can calculate this measure by using the software failure time distribution. It is difficult
to get the software failure time data. So, we try to the survey for measuring of software
reliability metrics.
We present our result the number of failure for one month. For example, the questions as
follows;
The product analysed in this paper is a data through the survey. Respondents were asked to
answer the satisfaction of the software product quality on the seven categories rating scale:
“Very Very Dissatisfied”, “Very Dissatisfied”, “Dissatisfied”, “Neutral”, “Satisfied”, “Very
Satisfied”, “Very Very Satisfied”
• How many failures were detected during one month?
• How many faults were detected during one month?
• How many failure conditions are resolved?
• How often the software product causes the break down?
Also, we predict the quality of software product by using the satisfaction survey. If the causes
of failure occur according to a Poisson distribution. The times between failures are independent
exponential variables, and the data constitutes a random sample of sample size from
exponential with parameter 1/φ. A variable or distribution would arise if one discusses the
number of occurrences in some time interval. For each interval the number of failures follows
a poisson distribution with parameter µ=φt. For example, specifically the Goel & Okumoto
model assumes that the failure process is modelled by Nonhomogeneous Poisson Process
model with mean value function m(t) given by
m(t)=a(1-exp(-φt)), a>0, b>0
where a and b are parameters to be determined using collected failure data. Note that for Goel
& Okumoto model, we have
m (∞) = a, and m (0) = 0.
DESIGN PATTERN P a g e | 16
Since m (∞) is the expected number of faults which will eventually be detected, the parameter
a is the final number of faults that can be detected by the testing process.
Table 1. Frequency Table
Number of Failure Frequency Probability
0
1
2
3
4
5
The value of φ is unknown, but sample mean is a good estimate of E(T)=1/φ. We estimate the
mean, parameter a, and φ after the one-month test period.
We estimated the mean, parameter a, and φ using the homogeneous poisson distribution. So,
we can calculate the value of mean value function m(t) and hazard rates r(t) on based true mean
value M(t).
We apply the simple homogeneous poisson software reliability model. By using the mean φ,
we can calculate the software reliability by software GOMMA-LOMAX model (Jung & Yang,
2005).
DESIGN PATTERN P a g e | 17
3.3 Discussion:
In our simple shape maker system, chances of failure are higher. This can be depicted in table
which is used to identify frequencies and probabilities of system failure by comparing simpler
solution and factory design pattern for our shape maker system. In a simpler shape maker
system, the system failed to run 15 times when it was run for the first time. In order for our
system to run better, I have applied factory design pattern which clearly indicates from our
frequency table in figure 1. The results clearly indicate that using factory design pattern, our
DESIGN PATTERN P a g e | 19
system has improved significantly. Only two times our system failed when it was run fourth
time consecutively as compared to 8th time while using simpler solutions. Factory method
helped system to hide implementation which is a core interface that make up the application.
It also shows the design of your application more readily which is also known as loose
coupling. Overall using factory method has been very useful for shape maker system.
In image viewer system, simpler solutions are not useful. From the statistical analysis, it shows
that the system has failed 5 times when it is executed 15 times. There were seven occasions
when system did not fail. After applying the proxy design pattern, system becomes much
improved as acknowledged by frequency table. As compared to simpler solution, the chances
of failure are much reduced and image viewer run smoothly using proxy design pattern. Proxies
have helped to improve the performance of our system by caching frequently accessed objects
3.4 Conclusion:
For this project I have used proxy and factory for the solution of Image Viewer and Shape
Maker respectively. Proxy provides a placeholder for an object to control reference to it and
factory design pattern defines an interface for creating objects but let subclasses to decide
which class to instantiate and refers to the newly created object through common interface
DESIGN PATTERN P a g e | 20
References
Engineering, B. P. S., 2018. Best Practice Software Engineering. [Online]
Available at: http://best-practice-software-engineering.ifs.tuwien.ac.at/patterns/facade.html
[Accessed 1/5/18 May 2018].
ISO/IEC, 9., n.d. Information Technology -Software Quality Characteristics and metrics Part 1,2,3.
[Online]
Available at: https://sci-hub.tw/https://link.springer.com/chapter/10.1007/11424857_81
[Accessed 01 May 2019].
Jung, H.-J. & Yang, H.-S., 2005. Software Reliability Measurement Use Software. [Online]
Available at: https://sci-hub.tw/https:/link.springer.com/chapter/10.1007/11424857_81
[Accessed 01 May 2018].
Umair, M., 2016. What Are Software Design Patterns Hiding From You?. [Online]
Available at: https://simpleprogrammer.com/software-design-patterns-hiding/
[Accessed 1/5/18 May 2018].