Object-Oriented Programming and Design Patterns Project

Verified

Added on  2025/05/02

|36
|3514
|417
AI Summary
Desklib provides solved assignments and past papers to help students succeed.
Document Page
UNIT 20 ADVANCED PROGRAMMING
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
Table of Contents
Introduction......................................................................................................................................3
LO1. Examine the key components related to the object-orientated programming paradigm,
analyzing design pattern types.........................................................................................................4
P1. Examine the characteristics of the Object-orientated paradigm as well as the various class
relationships.................................................................................................................................4
M1. Determine a design pattern from each of the creational, Structural and behavioral pattern
types.............................................................................................................................................8
D1. Analyze the relationship between the object-orientated paradigm and design patterns.....10
LO2. Design a series of UML class diagrams...............................................................................11
P2. Design and build class diagrams using a UML tool............................................................11
M2. Define class diagrams for specific design patterns using a UML tool...............................12
D2. Define/refine class diagrams derived from a given code scenario using a UML tool........13
LO3. Implement code applying design patterns............................................................................14
P3. Build an application derived from UML class diagrams.....................................................14
M3. Develop code that implements a design pattern for a given purpose.................................21
D3. Evaluate the use of design patterns for the given purpose specified in M3........................30
LO4. Investigate scenarios with respect to design patterns...........................................................31
P4. Discuss a range of design patterns with relevant examples of creational, structural and
behavioral pattern types.............................................................................................................31
M4. Reconcile the most appropriate design pattern from a range with a series of given
scenarios....................................................................................................................................32
D4. Critically evaluate a range of design patterns against the range of given scenarios with the
justification of your choices.......................................................................................................33
Conclusion.....................................................................................................................................34
References......................................................................................................................................35
2 | P a g e
Document Page
Table of Figures
Figure 1: Single Inheritance.............................................................................................................5
Figure 2: Multiple inheritance.........................................................................................................6
Figure 3: Multi-level Inheritance.....................................................................................................6
Figure 4: Hierarchical Inheritance...................................................................................................7
Figure 5: Hybrid Inheritance...........................................................................................................7
Figure 6: Polymorphism..................................................................................................................8
Figure 7: Types of Design Patterns.................................................................................................9
Figure 8: Class Diagram of Payroll System..................................................................................12
Figure 9: Form 1............................................................................................................................15
Figure 10: Form 2..........................................................................................................................15
Figure 11: Salaried Staff Form......................................................................................................16
Figure 12: Hourly Staff Form........................................................................................................17
Figure 13: Commission Staff Form...............................................................................................18
Figure 14: Salary Staff Pay Slip Form...........................................................................................19
Figure 15: Hourly Staff Pay Slip...................................................................................................20
Figure 16: Commission Staff Pay Slip..........................................................................................21
Figure 17: Solution Explorer of the developed application...........................................................22
Figure 18: Form 1 Code.................................................................................................................23
Figure 19: Form 2 Code.................................................................................................................24
Figure 20: Salaried Staff Form Code.............................................................................................25
Figure 21: Hourly Staff Form Code...............................................................................................26
Figure 22: Commission Staff Form Code......................................................................................27
Figure 23: Salaried Staff Pay Slip Code........................................................................................28
Figure 24: Hourly Staff Pay Slip Code..........................................................................................29
Figure 25: Commission Staff Pay Slip Code.................................................................................30
3 | P a g e
Document Page
Introduction
An object-oriented programming language which connects to the real-world activities with the
program through implementing classes and the objects. In this assessment, the key components
of object-oriented paradigms were analyzed with their characteristics and the design pattern will
also be discussed. In the next part, the UML diagram will be designed with the help of the
system designed. It includes classes with their operations and the attributes used. In the next part,
the application interface and the coding part will be discussed with the help of programming
concepts.
4 | P a g e
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
LO1. Examine the key components related to the object-orientated
programming paradigm, analyzing design pattern types.
P1. Examine the characteristics of the Object-orientated paradigm as well as the
various class relationships.
Object-Oriented Programming: It is the paradigm of programming which depends on the
objects that aim for the incorporation of the advantage of reusability and the modularity. Objects
are known as the instance of the class which used to interact with the other class for computer
programs and designing applications. There are some features of OOP paradigm are:
- Programs were divided into different entities that are called objects.
- Data or information is unseen and it not been accessed by the external functions.
- New function and data will be added easily whenever it is required.
- Objects will communicate with the use of functions.
- The bottom-up approach was followed in the design of the program.
- Objects are characterized by designing data structures (Magalhães, et al., 2016).
There are some characteristics of the Object-Oriented paradigms, such as:
Inheritance: This is one of the main features of OOPs. Inheritance mainly uses to reduce the
repetition of code. By inheritance, one can reuse the code when required. Basically,
inheritance simply means when a particular class includes all the features of the parent class
in itself. Inheritance provides us the way to use methods and variables of another class.
Inheritance is mainly divided into 5 parts: -
- Single Inheritance:
In this type of inheritance, a class is extended by only one class. Only one parent and child link
are present in this type of inheritance.
Figure 1: Single Inheritance
(Source: Guru99, 2019)
In the above figure, it is clearly shown that Class A is extended by class B. As it is single
inheritance figure there is only one parent-child link is present.
5 | P a g e
Document Page
- Multiple Inheritance:
In this type of inheritance, a class extends methods of two or more classes in itself. We can say
that the class has more than two parents in multiple inheritance.
Figure 2: Multiple inheritance
(Source: Guru99, 2019)
In the above figure, Class A and Class B both are inherited in Class C which is the example of
multiple inheritance.
- Multilevel inheritance:
In this type of inheritance, a class is extended by another class and then that class is further
inherited by another class. In simple words, we can say that in multilevel inheritance a parent can
act like a child for another class (Lewis, et al, 2019).
Figure 3: Multi-level Inheritance
(Source: Guru99, 2019)
6 | P a g e
Document Page
In the above figure, Class A act as a parent for class B while class B is acting as a parent class
for class C.
- Hierarchical Inheritance:
In this type of inheritance, a class is inherited by more than one class. It means a parent class has
two or more children.
Figure 4: Hierarchical Inheritance
(Source: Guru99, 2019)
In the above figure, Class A is inherited by Class B, class C, class D so class B, C, D will act like
a child for class A.
- Hybrid Inheritance:
This inheritance e is used when a combination of multiple and single inheritance is used.
Figure 5: Hybrid Inheritance
(Source: Guru99, 2019)
In the above figure, Hybrid inheritance is shown in which same Class A methods include class D
in two ways.
7 | P a g e
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
Polymorphism:
It is the ability of the program to access child class member by the reference of its parent class.
Figure 6: Polymorphism
(Source: Javatutorial, 2017)
In the above figure ‘is A’ characteristic of OOPs is shown where Dog is an Animal and cat is an
animal is considered. In polymorphism, we can say that when a task is completed in various
ways.
Abstraction:
It is a way to hide the data from the user which is not useful. It is used in those cases where only
the result is important not the way the result is achieved. Like printing on the display, screen
functioning is abstracted from the user because we only need to print the output on the display
not how to print the output.
Abstraction is done by using access specifiers like private, public, default, etc.
Encapsulation:
Bind the complete data or code of the program into a single unit is called encapsulation. This is
done to protect the program from outside access. Class is used to encapsulate the data.
8 | P a g e
Document Page
M1. Determine a design pattern from each of the creational, Structural and
behavioral pattern types.
Design Pattern: It is the repeatable solution used for occurring problems in the software
designs. It is not the final design; it is the template or the description for the process of problem-
solving used in different situations. Design pattern will speed-up the process of development
with the help of providing paradigms of development. Effective designs of software were
required to find issues and can solve before implementation. Mainly, the design patterns will
provide the documentation and the general solutions which do not require the pattern to the
particular problem (GeeksforGeeks, 2015).
Design pattern was furtherly divided into three parts such as creational, behavioral and structural
design patterns.
Figure 7: Types of Design Patterns
(Source: Dixit & profile, 2018)
- Creational Design Patterns: These design patterns are the instantiation of the class. It was
divided into object creational and the class creational pattern. Object creational pattern uses
the delegation effectively in getting the completed job and the class creational pattern uses
the inheritance effectively in the instantiation process.
o Abstract Factory: It creates the instance of various families of the classes.
o Factory method: It creates the instance of various derived classes.
o Prototype: It is the instance which is fully initialized to be cloned or copied.
o Builder: It separates the construction of objects from their representation.
o Singleton: It is the class where a single instance will exist.
- Behavioral Design Patterns: This design pattern is the object communication of the class. It
is concerned with the communication between the objects.
o Command: It will encapsulate the request of commands like an object.
9 | P a g e
Document Page
o Iterator: It will access the collection of elements sequentially.
o Null Object: It will act like an object’s default value.
o Strategy: It will encapsulate the algorithm inside the class.
o Responsibility chain: It is the way of request passing between the object’s chain.
- Structural Design Patterns: This pattern uses the inheritance to comprises the interfaces.
o Bridge: It separates the interface of the object from their implementation.
o Facade: It is a single class which represents the entire subsystem.
o Adapter: Different classes matches the interfaces.
o Proxy: It is an object that represents the other objects.
10 | P a g e
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
D1. Analyze the relationship between the object-orientated paradigm and design
patterns.
As an experienced programmer, they thought for the best way to approaching the problem
solving or application building problems. So, they had developed the design patterns and the
object-oriented paradigm. The smart or the best developers or the programmers will able to
improves their programming skills with the help of adopting design patterns and paradigms.
Object-oriented paradigms are the simple approach or the style to the programming. Example,
with the help of the OOP paradigm, objects can be used for approaching the complete program.
An object of the class includes behavior and the data that can be connected with the logical ways
for solving the tasks at the hand successfully (Semanticscholar, 2019).
A design pattern is a solution tested to the common pattern of programming. It is considered as
best practices. If the program approached with the use of the OOP paradigm, then there were
many design patterns that can be drawn for solving specific problems.
11 | P a g e
Document Page
LO2. Design a series of UML class diagrams.
P2. Design and build class diagrams using a UML tool.
Figure 8: Class Diagram of Payroll System
12 | P a g e
chevron_up_icon
1 out of 36
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]