0% found this document useful (0 votes)
5 views47 pages

Final_ADVPrograming

This document serves as an assignment cover sheet for students at the International School of Management and Technology, detailing the requirements for submitting assignments at levels 4 and 5. It includes sections for student details, unit and assignment information, and a declaration regarding academic integrity, specifically addressing plagiarism and collusion. Additionally, the document outlines key concepts of object-oriented programming (OOP), including principles, encapsulation, classes, inheritance, and abstraction, among others, as part of an assignment on developing a HR and Payroll management system.

Uploaded by

Subash Rijal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views47 pages

Final_ADVPrograming

This document serves as an assignment cover sheet for students at the International School of Management and Technology, detailing the requirements for submitting assignments at levels 4 and 5. It includes sections for student details, unit and assignment information, and a declaration regarding academic integrity, specifically addressing plagiarism and collusion. Additionally, the document outlines key concepts of object-oriented programming (OOP), including principles, encapsulation, classes, inheritance, and abstraction, among others, as part of an assignment on developing a HR and Payroll management system.

Uploaded by

Subash Rijal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

ADVANCED PROGRAMMING

INTERNATIONAL SCHOOL OF
MANAGEMENT AND TECHNOLOGY

ASSIGNMENT COVER SHEET


This form is to be completed by students submitting assignments of level 4 and level 5.
Students are required to complete all sections and attach to your assignment.

STUDENT DETAILS

STUDENT NAME

STUDENT ID

UNIT AND ASSIGNMENT DETAILS

UNIT TITLE

UNIT NUMBER

ASSIGNMENT
TITLE

ISSUE DATE DUE DATE

ASSESSOR
NAME

ESTIMATED
WORD LENGTH

SUBMISSION

HAND IN DATE

DECLERATION AND ACKNOWLEDGEMENT


When submitting assignments, each student must sign a declaration confirming
that the work is their own.

1
AD. PROGRAMMING

Plagiarism and Collusion


Plagiarism: to use or pass off as one’s own, the writings or ideas of another
without acknowledging or crediting the source from which the ideas are taken.
Collusion: submitting an assignment, project or report completed by another
person and passing it off as one’s.
In accordance with the Academic Integrity and Plagiarism Policy:
1. I declare that:
a) this assignment is entirely my own work, except where I have included fully-
documented references to the work of others,
b) the material contained in this assignment has not previously been submitted
for any other subject at the University or any other educational institution,
except as otherwise permitted,
c) no part of this assignment or product has been submitted by me in another
(previous or current) assessment, except where appropriately referenced, and
with prior permission from the Lecturer / Tutor / Unit Coordinator for this unit.

2. I acknowledge that:
a) if required to do so, I will provide an electronic copy of this assignment to the
assessor;
b) the assessor of this assignment may, for the purpose of assessing this
assignment:
I. reproduce this assignment and provide a copy to another member of
academic staff;
II. communicate a copy of this assignment to a plagiarism checking
service such as Plagiarism Check (which may then retain a copy of this
assignment on its database for the purpose of future plagiarism
checking).

I am aware of and understand that any breaches to the Academic Code of Conduct
will be investigated and sanctioned in accordance with the College Policy.

SIGNATURE DATE

Contents
STUDENT DETAILS...................................................................................................................1
UNIT DETAILS...........................................................................................................................1
Object oriented programming (OOPs)......................................................................................6
Principles of OOP.....................................................................................................................6

2
ADVANCED PROGRAMMING

Encapsulation............................................................................................................................6
Classes and objects....................................................................................................................7
Method and properties..............................................................................................................9
Access Modifiers.......................................................................................................................9
Get and Set Method...................................................................................................................9
Constructor and Destructor.....................................................................................................10
Polymorphism.........................................................................................................................10
Operator overloading..............................................................................................................11
Different types of operator overloading..................................................................................11
Function overloading..............................................................................................................11
Inheritance...............................................................................................................................12
Types of inheritance................................................................................................................12
Abstraction..............................................................................................................................13
Abstract class..........................................................................................................................14
Interface..................................................................................................................................14
Generics..................................................................................................................................15
Features of Generics................................................................................................................15
Delegates.................................................................................................................................15
Properties of delegates............................................................................................................16
Class relationships...................................................................................................................16
Composition............................................................................................................................16
Generalization.........................................................................................................................17
Aggregation.............................................................................................................................17
Realization..............................................................................................................................17
Design pattern.........................................................................................................................17
Types of design pattern...........................................................................................................17
Relationship between the design patterns and object oriented programming.........................18
Presentation slides...................................................................................................................19
Introduction.............................................................................................................................25
UML Class Diagram...............................................................................................................26
i. Static Diagrams................................................................................................................26
iii. Physical Diagrams........................................................................................................26
Why UML...............................................................................................................................26

3
AD. PROGRAMMING

UML class...............................................................................................................................27
Table of contents.....................................................................................................................28
Abstract...........................................................................................................................................30
Summary.........................................................................................................................................30
Scope..............................................................................................................................................31
Objective.........................................................................................................................................31
Programming prerequisite in lab report..........................................................................................31
Introduction....................................................................................................................................32
Screenshots.....................................................................................................................................32
Conclusion......................................................................................................................................37
Output.....................................................................................................................................43
References...............................................................................................................................50

4
ADVANCED PROGRAMMING

Introduction
The scenario says that a fitness studio has contacted me. They have 80-90 staffs in total,
including full time and part time. As a junior software developer of NepalWeb Solutions, I am
tasked with developing a HR and Payroll management system for Vity fitness studio. At first, I
will prepare a document that examines the key components related to the object-oriented
programming paradigms and analyze design patterns. Then I will design a series of UML class
diagrams to describe the scenario in detail.

Object oriented programming (OOPs)

(Spiceworks, 2022 , OOP is a programming paradigm that emphasizes code that performs tasks
and objects that make up data fields. OOP defines object classes intimately tied to related
processes, in contrast to traditional logic-based systems. It also presents the principles of attribute
and method inheritance, transforming it into a mathematical field-based system for data storage
and necessary actions.
.

Principles of OOP
The principles of OOP include Abstraction, Encapsulation, Inheritance, and Polymorphism.
Objects and classes are also essential in any object-oriented programming language. OOP is a
programming paradigm based on objects and classes. Its principles include Abstraction,
Encapsulation, Inheritance, and Polymorphism. You can build more efficient, scalable, and
maintainable software systems by mastering these principles.

Encapsulation
As per (Braunschweig, 2018), Object-Oriented Programming (OOP) utilizes encapsulation to
safeguard your code from unauthorized access. Encapsulation merges data and procedures, which
manipulate that data, within a class. This method conceals the state or values of a structured data
object within the class, preventing unauthorized entities from direct access to the data. To access
and modify the data, publicly accessible methods known as getters and setters are included in the
class. Through these methods, other client classes can securely access the data. Encapsulation is a
reliable means to protect your data and ensure the safety and security of your code.

To demonstrate the concept of encapsulation, let's consider encapsulating certain aspects of a


human into a programmable entity. In this scenario, the data would differentiate among human

5
AD. PROGRAMMING

characteristics, and its methods would define feasible operations or actions that the entity can
carry out.

Classes and objects


(Programiz.com, 2023), A class represents a group of objects that share similar characteristics,
behavior, properties, and attributes. It serves as a blueprint for an object, similar to a rough
sketch of a house outlining features like floors, doors, and windows. By using this description,
we can create an object, much like constructing a house from a provided sketch. Multiple objects
can be created from a class, similar to building several houses from a single sketch. An object is
an instance of a class. For example, if we have a class called Dog, it may include various breeds
such as Bulldog, German Shepherd, and Pug. Both objects and classes help break down large
projects into smaller sub-problems.

6
ADVANCED PROGRAMMING

Output

Method and properties


(Vegibit.com, Methods play a crucial role in programming languages like C#. They define
specific behavior and are responsible for executing particular tasks. Within classes, access
modifiers regulate the accessibility of methods. By default, methods are private and can only be
used within the same class. The internal keyword can be used to make the method available
throughout the entire project, while the public keyword allows the method to be accessed from
anywhere. It is important to grasp these access modifiers when defining methods in
programming.

In C#, properties function similarly to fields but come with the added feature of getters and
setters. These accessors enable developers to control the actions when data is read from or
written to a property, making them a valuable tool for data validation. Properties help ensure that
the data is secure and reliable, thereby enhancing application security and reliability.

7
AD. PROGRAMMING

Access modifiers are keywords that set the access level/visibility of classes, fields, methods, and
properties. The public keyword is one such access modifier in C#. C# has several access
modifiers, including public.
Modifier Description
Public The code is accessible for all classes
Private The code is only accessible within the same
class
Protected The code is accessible within the same class,
or in a class that is inherited from that class
Internal The code is only accessible within its own
assembly, but not from another assembly.
Protected internal The code is accessed from the same assembly
and the derived class of the containing class
from any other assembly.
Private protected The code is accessed within the same class,
and its derived class within the same
assembly.

8
ADVANCED PROGRAMMING

Get and Set Method


In the programming language C#, properties can be equipped with one or two code blocks
referred to as accessors, specifically the get and set accessors. These accessors provide the means
to modify the internal implementation of class variables while simultaneously exposing them for
external access, without impacting the external method of interaction, aligning with our specific
requirements. The syntax for the get and set methods is as follows:

<access_modifier> <return_type> <property_name>


{ g
et
{
// return property value
}
set
{
// set a new value
}
}

9
AD. PROGRAMMING

Constructor and Destructor


(Patel, 2020), Constructors are used to make instances of a class. The constructor is invoked
upon class instantiation. The constructor is named after the class, and its visibility can be
managed with access modifiers. The constructor is publicly accessible by default. It can accept
one or more parameters, and a class may have more than one constructor. The constructor is
automatically called whenever a new instance of a class is created.

Destructors release the resources used by an object. When an object goes out of scope, a special
class method called a destructor, with a name that starts with a tilde (~) and matches the class
name, is invoked. Destructors cannot have access modifiers and cannot take any parameters.
Each class can have only one destructor, which is exclusive to that class. Destructors cannot be
defined in structures and are automatically called when an object is eligible for destruction. The
destructor of an instance can be executed at any time after it becomes eligible for destruction.

Polymorphism
(Trivedi, 2023), One important idea in Object-Oriented Programming (OOP) is polymorphism,
which allows programmers to utilize the same functions in multiple ways. We get the term
polymorphism from the Greek "one name, many forms." "Poly" denotes "many," while "morph"
denotes "forms." Put more simply, it indicates that a single object can exist in various forms or
that a single name can have multiple purposes. Polymorphism makes multiple implementations
of a class with the same name possible. In addition to inheritance and encapsulation, it is one of
the core ideas of object-oriented programming.

Operator overloading
(GeeksforGeeks, 2018), With C#, you may use the same operator for multiple tasks thanks to a
feature called operator overloading. Applying this to user-defined data types allows C# operators
to have more functionality. In essence, it allows one or both operands to belong to a user-defined

10
ADVANCED PROGRAMMING

class, allowing for the design of user-defined implementations of certain operations. It's crucial
to remember that overloading is only possible with the approved list of C# operators. It is more
difficult to perform operations on user-defined data types than on built-in data types. Operators
with user-defined data types need to be overloaded to meet the demands of the programmer in
order to be used. An operator can be given a function to do this. The operator's function is
declared using the operator keyword.

Syntax
access specifier className operator Operator_symbol (parameters) {
// Code
}

Different types of operator overloading


Operators Description
+, -, !, ~, ++, -- Unary operators take one operand and can be
overloaded.
+, -, *, /, % Binary operators take two operands and can
be overloaded.
==, !=, = Comparison operators can be overloaded.

&&, || Conditional logical operators cannot be


overloaded directly
+=, -+, *=, /=, %=, = Assignment operators cannot be overloaded.

Function overloading
(GeeksforGeeks, 2014), In object-oriented programming, a characteristic known as function
overloading occurs when two or more functions share the same name but have different
parameters. This implies that multiple tasks can be completed with a single function name. Each
function's parameters, though, have to be unique. Function overloading is an example of
polymorphism in C++. The parameters need to meet one or more of the following requirements
in order to execute function overloading:
• The number of parameters is different
• The type of parameters is different
• The sequence of parameters is different.

Inheritance
One object can automatically inherit all of the traits and behaviours of its parent object in C#
thanks to the inheritance mechanism. This implies that properties and methods that are already
specified in another class can be extended, modified, and reused. In C#, the class whose
members are inherited is referred to as the base class, and the class that inherits members of
another class is called the derived class. A specialised class that inherits the members of the base
class is called a derived class.

11
AD. PROGRAMMING

Types of inheritance

Types Definition
Single inheritance In this inheritance, a derived class is created from a single base
class.
Multi-level inheritance In this inheritance, a derived class is created from another derived
class.
Multiple inheritance In this inheritance, a derived class is created from more than one
base class. This inheritance is not supported by .NET Languages
like C#, F#, etc., and Java Language.
Multipath inheritance In this inheritance, a derived class is created from other derived
classes and the same base class of other derived classes. This
inheritance is not supported by .NET Languages like C#, F#, etc.
Hierarchical Inheritance In this inheritance, more than one derived class is created from a
single base class and further child classes act as parent classes for

12
ADVANCED PROGRAMMING

more than one child class.


Hybrid Inheritance This is a combination of more than one inheritance. Hence, it may
be a combination of Multilevel and Multiple inheritance or
Hierarchical and Multilevel inheritance Hierarchical and Multipath
inheritance, or Hierarchical, Multilevel and Multiple inheritances.
Since .NET Languages like C#, F#, etc. do not support multiple and
multipath inheritance. Hence hybrid inheritance with a combination
of multiple or multipath inheritances is not supported by .NET
Languages.

Abstraction
According to (Janssen, 2023), In programming languages that use object-oriented design,
abstraction is a fundamental idea. Its main goal is to make complexity simpler by keeping the
user from knowing needless details. Because of this, the user can develop more intricate
reasoning based on the given abstraction without having to understand or take into account all of
the hidden complexity. In an OOP language, objects offer an abstraction that hides the internal
workings of the implementation. Like the coffee maker in your kitchen, all you need to know is
which object methods are accessible to call and which input parameters are required to carry out
a specific action. It is not required to comprehend the steps this procedure takes to achieve the
intended result, nor how it is put together.

Abstract class
In programming languages that use object-oriented design, abstraction is a fundamental idea. Its
main goal is to make complexity simpler by keeping the user from knowing needless details.
Because of this, the user can develop more intricate reasoning based on the given abstraction
without having to understand or take into account all of the hidden complexity. In an OOP
language, objects offer an abstraction that hides the internal workings of the implementation.
Like the coffee maker in your kitchen, all you need to know is which object methods are
accessible to call and which input parameters are required to carry out a specific action. It is not

13
AD. PROGRAMMING

required to comprehend the steps this procedure takes to achieve the intended result, nor how it is
put together.

Interface
(C-sharpcorner.com, 2019), An interface is a tool or framework that facilitates communication
between several elements. The English language serves as an interface between two people, the
military's code of conduct between people of different ranks, and a remote control is an interface
between a user and a television. Similar to a class in the Java programming language, an
interface is also a sort. But an interface never uses strategies, unlike a class. Rather, the methods
outlined by the interface are implemented by the classes that implement it; a class may
implement more than one interface.

The class hierarchy of bikes establishes the limits of what constitutes a "bicycles." But bikes
have a different way of interacting with the world. A stock program might, for instance, be used
to manage a bike in a store. The class of items that a stock program manages is irrelevant as long
as the objects supply specific information, such as price and tracking number. Rather than
restricting class links to unrelated items, the stock program creates a communication protocol.
This protocol consists of a collection of method definitions that are housed inside an interface.
The methods that set and retrieve the retail price, assign a tracking number, and other functions
would be defined by the stock interface but not carried out.

For the bike class to work with the stock program, it needs to implement the specified interface.
When a class implements an interface, it agrees to implement each and every function specified
in the interface. This means that the bike class would need to provide the implementation for
functions such as determining and obtaining the retail price, allocating a tracking number, and
other required functions. An interface defines a set of behaviors that can be implemented by any
class in the class hierarchy.
Interfaces are useful for the following purposes.:
• Capturing similarities among unrelated classes without artificially forcing a class
relationship
• Declaring methods that one or more classes are expected to implement
• Revealing an object's programming interface without revealing its class
• Modelling multiple inheritance, a feature that some object-oriented languages support
that allows a class to have more than one superclass

14
ADVANCED PROGRAMMING

Generics
This text discusses the use of the Generic feature in C# 2.0, which allows type and client-defined
types to be used as parameters in methods, classes, and interfaces. One of the main benefits of
using Generic is that it ensures type safety, which is a key constraint for arrays. In C#, all classes
derive from the Article base class, which means that any object can be included in an array.
However, this compromises type safety and goes against the purpose of C# as a type-safe
language. Additionally, using arrays involves a large overhead in terms of performance and
explicit type casting, which is necessary to retrieve objects from an array.

Generics in C# are a powerful feature that allows you to define type-safe data structures. This
results in a significant performance improvement and high-quality code, as it helps to reuse data
handling algorithms without duplicating type-specific code. Generics are similar to templates in
C++, but they are different in terms of usage and capabilities. Generics introduce the concept of
type parameters, which allows you to create methods and classes that accept the definition of
data type until the class or method is declared and is launched by customer code. Generic types
perform better than regular system types since they reduce the need for boxing, unboxing, and
type casting of variables or objects.

Features of Generics
Generics is a programming technique that offers the following benefits to your projects:

i. It allows you to improve code reuse, type safety, and performance.

ii. You can create generic collection classes. The .NET Framework class library includes several
new generic collection classes in the System.Collections.Generic namespace. You may use these
generic collection classes instead of the collection classes in the System.Collections namespace.

iii. You can create your own generic interfaces, classes, methods, events, and delegates.

iv. You may create generic classes that are constrained to enable access to methods on specific
data types.

v. You may retrieve information on the types used in a generic data type at runtime through
reflection methods.

Delegates
A delegate is a type that represents references to methods with a specific parameter list and return
type. When you instantiate a delegate, you can associate its instance with any method with a
compatible signature and return type. You can invoke (or call) the method through the delegate
instance.

Agents are used to pass strategies and arguments to different methods. Event handlers are simply
methods that are called through agents. You create a custom method, and a class such as a

15
AD. PROGRAMMING

Windows control can call your method when a specific event occurs. The following example
demonstrates an agent declaration. Delegation is an important design pattern in itself. It is often
used in Objective-C and NEXTSTEP programming as an alternative to mandatory inheritance
from a complex framework and multiple inheritances.

If B is a subclass of A, then sending B a message for something in A's interface means that B
can reuse the implementation found in A. Inheritance uses structure to reuse the implementation
from A. B's interface can be extended to have some of the same functionality of A. However,
when a B object is sent a message corresponding to a method in A's type, it forwards the message
to an A object. The inheritance structure we saw earlier for implementing a Set in terms of a List
is an example of the use of inheritance.

Properties of delegates
Delegates have the following properties:
i. Delegates in C# are similar to C++ function pointers, but unlike C++
pointers to member functions, delegates encapsulate both an object
instance and a method.
ii. Delegates enable passing techniques as parameters. They can define
callback methods.
iv. Delegates can be linked together; for example, multiple tactics can be addressed at a
single event.
v. Methods do not need to match the delegate type precisely. For more information,
refer to the use of Variance in Delegates.
vi. C# rendition 2.0 presented the idea of mysterious techniques, which permit code
squares to be passed as parameters instead of an independently characterized strategy.
C# 3.0 presented lambda articulations as an increasingly compact method for
composing inline code squares. Both unknown techniques and lambda articulations
(in specific settings) are ordered to assign types. Together, these highlights are
currently known as unknown capacities. For more data about lambda articulations,
see Lambda articulations.

Class relationships
Class relationships in class diagrams illustrate how different classifiers interact, including
generalizations, realizations, and dependencies.

Composition
A relationship known as a composition relationship exists between an object as a whole and one
of its integrated elements. To put it another way, it's just the relationship—also called a "has-a"
relationship—that exists between a whole and its part.

16
ADVANCED PROGRAMMING

Generalization
In several types of diagrams, including class, component, deployment, and use-case diagrams,
generalization relationships are frequently used to show that all of the properties, actions, and
relationships described in the parent entity are inherited by the child entity. In a generalization
connection, both items must be of the same type to comply with UML semantics.

Aggregation
An aggregation connection in UML models shows that one classifier is a subset of or subservient
to another classifier. In this kind of association, separate elements are put together or set up in a
certain way to produce a more complex object.

Realization
A relationship between two model elements is called a realization relationship in UML
modelling. One model element in this connection, referred to as the customer, acts in a manner
that is prescribed by another model element, referred to as the provider. It's crucial to remember
that several clients may act in the same manner as one provider.

Design pattern
Design patterns are pre-made fixes for typical software design issues. They may be modified,
much like blueprints, to address persistent design issues in your code. Design patterns are
scenario-specific and offer a consistent vocabulary. A "singleton" design pattern, for instance,
refers to the use of a single item. A single object will be used, and all developers who are
conversant with this design may identify that the programme adheres to the singleton pattern
from one another.

Types of design pattern

17
AD. PROGRAMMING

S.N. Pattern & Description

1 Creational Patterns
These design patterns provide a way to create objects while hiding the creation logic,
rather than instantiating objects directly using new operator. This gives program more
flexibility in deciding which objects need to be created for a given use case.
2 Structural Patterns
These design patterns concern class and object composition. Concept of inheritance is
used to compose interfaces and define ways to compose objects to obtain new
functionalities.
3 Behavioral Patterns
These design patterns are specifically concerned with communication between objects.
4 J2EE Patterns
These design patterns are specifically concerned with the presentation tier. These
patterns are identified by Sun Java Center.

Relationship between the design patterns and object oriented programming


The programming approach known as object-oriented programming, or OOP, is centered on
grouping code into objects and their connections. Objects are representations of actual items in
the real world that include data and functions to work with that data. The relationships between
things, including inheritance and composition, are defined by their object relationships.

Conversely, design patterns are tried-and-true fixes for common programming issues. They serve
as blueprints for creating objects and types that address certain problems in a programme. A
description of specific objects and classes, together with information about their dependencies
and properties, make up each design pattern. They offer all-purpose answers to typical issues,
allowing developers to use tried-and-true development paradigms to speed up the development
process.

Better software interactions are made possible by design patterns, which let developers refer to
things with familiar, understandable names. They provide programmes the ability to produce
things while concealing the reasoning behind their creation, giving them greater freedom in
deciding which objects are necessary for a particular use case. These design patterns, which
address class and object composition, are examples of the best practices followed by seasoned
developers of object-oriented software. They may be used with any programming language and
provide answers to common issues that software developers have while creating new
applications.
.

18
ADVANCED PROGRAMMING

Presentation slides

19
AD. PROGRAMMING

20
ADVANCED PROGRAMMING

21
AD. PROGRAMMING

22
ADVANCED PROGRAMMING

23
AD. PROGRAMMING

Introduction
I've shown programming standards that may help a business grow in a prior endeavour.
Presenting configuration class outlines created by UML apparatuses, class charts, and UML tools
is the current job. The assignment will address class connections, the use of class graphs in
project planning, and interfaces with other models. Class graphs are essential for a company's
long-term development, and these techniques will teach engineers how to apply the structure
simply.

24
ADVANCED PROGRAMMING

UML Class Diagram


According to (https://www.facebook.com/tallyfy, 2018), UML, or Unified Modelling Language,
is a visual language used to express software components. The idea behind UML is that "a
picture is worth a thousand words," as the saying goes. We are better able to comprehend
possible flaws or issues in software or business procedures when we use visual representations.
Confusion resulted from the many ways of modelling and documenting software systems that
were available in the 1990s. Consequently, three Rational Software developers worked on the
UML between 1994 and 1996. Its goal was to give software systems a more uniform visual
representation.

UML has three primary sorts of graphs


i. Static Diagrams
In order to explain the continuous structure of programming components, this paper outlines
class, objects, and data structures along with their interrelationships.

ii. Dynamic Diagrams


Use a visual representation of the execution stream or the changing states of substances to
demonstrate how programming components change throughout execution.

iii. Physical Diagrams


Illustrate the physical connections between the structures and source, libraries, and binary files
used in programming.
.

Behavior charts illustrate how articles change over time in a system, with seven types of charts
available.

• Use Case Diagram


• Activity Diagram
• State Machine Diagram
• Sequence Diagram
• Communication Diagram
• Interaction Overview Diagram
• Timing Diagram

Why UML
Software developers convey design information using the Unified Modelling Language (UML), a
standard language. Instead of learning new proprietary languages, developers may save time and
money by utilizing UML. Communicating with other groups or people who were evaluating the
design is also made easier. Engineers can save time by using UML to automate some design
processes. Additionally, by employing this language, possible issues with the system may be
avoided, saving time during the development and testing stages. Furthermore, UML facilitates
code reuse, which cuts down on coding time for developers.

25
AD. PROGRAMMING

Software developers use the UML language to construct efficient models and designs for
functional systems. They are able to exert less effort during the software development process as
a result. Workflow determination is one of the main benefits of utilizing UML. Developers finish
the code and then draw diagrams to assign roles and describe various processes and activities.
They are able to develop more effective procedures and make well-informed judgements as a
result. UML offers thirteen distinct diagram kinds that professionals, including software
engineers, may build and apply.

The UML class diagram is one of these diagrams. An item or group of objects with shared
properties, functions, and connections are represented by a class in UML. It offers a template for
making that class's objects, which may be applied to many situations. The static structure of a
system, comprising the classes, their characteristics, and the connections between them, is
represented by the class diagram. This aids in the understanding of the system's general
architecture by software engineers, enabling them to plan and execute the system with more
knowledge.
.
Software developers utilize UML, or Unified Modelling Language, as a tool to produce efficient
models and designs for software systems. This language allows developers to assign
responsibilities and set workflow, which helps to expedite the software development process.
Developers draw diagrams to record different jobs and procedures after writing the code. They
are better able to make judgments and develop more effective procedures as a result. Software
engineers and other experts can utilize the 13 various types of diagrams that make up UML.

UML class
The Unified Modelling Language, or UML, is a popular graphical language in software
engineering that facilitates the visual depiction of software systems. A class diagram, one of the
many UML diagrams, shows the classes, their characteristics, and their behaviors to show the
structure of a system. In UML, an item or a collection of objects with comparable characteristics
and behaviors can be represented by a class. These classes and their characteristics are
represented by the symbols in the class diagram. Even before beginning the actual coding
process, a software engineer may quickly and simply visualize the system structure and
comprehend the interactions between different classes by utilizing class diagrams.

26
ADVANCED PROGRAMMING

Class diagrams are static, meaning they represent the system structure at a particular point in
time and do not show the system's dynamic behavior.

Fig: UML diagram according to the scenario

27
AD. PROGRAMMING

28
ADVANCED PROGRAMMING

Abstract
Configuration designs provide adaptable answers to basic issues in the creation of programming.
Nevertheless, recent assessments have shown that plan designs frequently overlook cross-cutting
issues. Sadly, these intersecting problems are typically not feasible to be modularized in object-
oriented (OO) talks, which might lower the framework's viability and usefulness. Finding out if
aspect-focused techniques, as opposed to configuration designs, are more effective in
modularizing cross-cutting difficulties is crucial. The performance of aspect-oriented and
conventional object-oriented designs in terms of crucial programming building blocks like
coupling and cohesion should ideally be compared quantitatively. A quantitative comparison of
aspect-oriented and object-oriented solutions for a collection of delegation-based configuration
designs is presented in this paper. As assessment criterion, we employed rigorous programming
to create attributes. We discovered that most aspect-oriented solutions more effectively handled
example-related issues, even while certain aspect-oriented implementations of certain instances
resulted in greater coupling and lines of code.

Summary
In the modern world, mastery of configuration designs demands commitment. You may improve
as a programmer and developer by looking over and analyzing configuration samples; this will
provide you more possibilities when looking for a unique activity. With a practical approach and
real-world examples, this paper intends to demonstrate to you how to execute configuration
designs in an easy-to-understand and straightforward manner. This paper provides an objective
viewpoint that might assist you in understanding how to apply design patterns to projects and
real-world scenarios, in contrast to usual beliefs about design patterns.

When I initially started studying Design Patterns, I saw that many of the models were based on
ridiculous scenarios that one may never come across, like creating a class of howling or barking
animals, drawing geometric patterns, or cooking pizza. These models clarified the idea, but they
were hard to use in practical settings. This research offers an alternative strategy that emphasizes
real-world examples.
.

Right now, attempt to go past those run-of-the-mill guides to do genuinely extraordinary things.
For example,
• Creating your direction line comfort.
• Creating your language to make SQL inquiries over an Excel document.
• Creating applications fit for exchanging between more than one database, similar to
Oracle and MySQL, given the necessities of the client.
• Managing the worldwide settings of your application.
• Creating an execution pool to deal with the number of strings running at the same time,
shielding your application from coming up short on assets.
• Using intermediaries to deal with the security of your application.
• Using procedures to change how the clients are signed into your application; it could be
utilizing a database, web administration, etcetera.
• Creating your state machine to deal with the life pattern of your server.

29
AD. PROGRAMMING

Scope
When describing each structural design, it is essential to make clear what is meant by extension
and how it impacts each design plan. Extension is the measure of an organized pattern's ability to
impact and change the overall design. The scope of a structured pattern in product-oriented
programming is limited to a class or an object, which is an instance of that class. Only class-
related designs can use class patterns, which address how classes connect to their subclasses
through inheritance. Contrarily, object design patterns look at the connections between things,
which are more dynamic and subject to change while the program operates. The majority of
design patterns are pertinent to objects, which means that they belong in the object scope as
opposed to the class scope and are more situation-specific. The scope of a structured pattern may
be defined, making it simpler to decide whether to apply the pattern to a given situation.

Objective
A lab report, which you may be acquainted with, is not the same as a design report. A lab report
is divided into four basic sections: Introduction, Methods, Results, and Discussion. It discusses
an experiment and its findings. The main distinction between lab reports and design reports is
that the latter does not have a methodologies section, except the description of the assessment
strategy. When experimenting, you have to explain the methodology you used so that another
person can verify the findings. For instance, the results of emissivity tests will change depending
on whether an energy balance or a thermopile is used. It might be uncomfortable to have no
techniques part in your design report when you may have spent up to half the semester debating
many concepts before settling on one, but you won't write about that process. What matters to the
audience is what you come up with, not how you got there. A design report is results-oriented
rather than historical ("first, we tried this and it didn't work, so then we tried that and finally we
arrived at this"). You are writing too much if the majority of your design report is devoted to
discussing your idea selection procedure.

Programming prerequisite in lab report


Rather than being based on practical considerations, non-utilitarian needs often influence
software design decisions. For example, architectural decisions are frequently influenced by the
requirement for efficiency and adaptability. We may use design patterns that minimize the
expense of adding functionality later on by keeping in mind that a customer might wish to add
functionality in the future. Although many business analysts ignore them, non-functional criteria
frequently dictate the most important architectural choices in a piece of software. Design patterns
are always contextualized, according to Gamma et al.'s concept. When to apply each pattern is

30
ADVANCED PROGRAMMING

clearly outlined in good design patterns. Writing better requirements may be achieved by being
knowledgeable about design patterns and the indicators an architect looks for when choosing a
design pattern. It indicates that something is lacking from your requirements if a software
architect perusing them is unable to establish whether a design pattern applies.

Introduction
In my previous work, I talked about UML class diagrams which are used to plan out software
programs. I used these diagrams to design a system for managing employees at a company called
Vity Fitness Studio. Now, I'm working on turning those designs into an actual software program!
I'll be sharing pictures of what the software will look like, the code that makes it work, and
explaining the different design patterns (basically just different ways of organizing code) that I
used to make it all come together.

Screenshots
Login

31
AD. PROGRAMMING

32
ADVANCED PROGRAMMING

33
AD. PROGRAMMING

34
ADVANCED PROGRAMMING

35
AD. PROGRAMMING

Conclusion
Understanding the MVC design pattern is crucial when creating a web application. This method
eventually cuts down on the amount of time needed to create an effective application by enabling
the production of distinct, reusable models that are simple to update. A key idea in computer
programming, the MVC theory may help with a range of web development services and projects.
I have created an Employment Management System for Vity Fitness Studio, and to help you
understand the process, I've included screenshots of the user interface and the source codes. I
have also included a thorough analysis of the design patterns that have been employed to aid in
the project's development.

36
ADVANCED PROGRAMMING

Design pattern investigation


Subash Rijal
2th April, 2024

Introduction
In this final stage of our project, we are tasked with summarizing the case study in relation to the
design pattern. Over the course of previous tasks, we delved into the designs, implementations,
and patterns utilized in the Employment Management System. This current task involves
introducing different design patterns available in the market, which fall under the categories of
creational, structural, and behavioral patterns. Additionally, the project entails selecting
appropriate patterns from a set of scenarios provided, comparing them to various design
patterns, and providing reasons for their selection and goals.

Ranges of different design patterns with example


There are mainly three types of design patterns which is listed below:

Creational design pattern


Certainly:

Design patterns serve as a method for developing classes or objects, enhancing the efficiency
and ease of software development. These patterns are categorized into two types: class-
creational and object-creational. The former employs inheritance, while the latter utilizes
delegation. Notable examples of creational design patterns encompass the Factory Method,
Abstract Factory, Builder, Singleton, Object Pool, and Prototype. Developers can produce
higher-quality code and expedite software development processes by utilizing these patterns.

Creational pattern range


If you need to access a database for various tasks in your code, you might typically establish
multiple connections to the same database. However, this can lead to problems such as an
excessive number of connections or placing too much strain on the database. To address these
issues, you can utilize a singleton class, which enables you to create just one instance of the
class and maintain a single connection to the database. This approach helps you to manage the
load balance and avoid unnecessary connections.
In order to ensure that your code is flexible and easily modifiable in the future, you can leverage
the Factory design pattern. This pattern serves as a bridge between various classes, enabling you
to seamlessly switch between different databases (such as SQL Server and Oracle) without
requiring changes to your code. Employing the Factory pattern guarantees that your code is
ADVANCED PROGRAMMING

loosely coupled and can be readily modified in the future.

38
ADVANCED PROGRAMMING

Example

39
ADVANCED PROGRAMMING

40
ADVANCED PROGRAMMING

The builder pattern has been implemented in the C# program created using the Visual Studio
IDE. An interface IBuilder has been created with functions BuildPartA(), BuildPartB(), and
BuildPartC(), which provide methods for generating various sections of product objects.
Subsequently, a concrete builder class has been constructed to implement the building phases
and adhere to the builder interface. It's important to note that different types of builders may
develop wholly distinct products that do not follow the same interface, so concrete builders are
expected to provide their own techniques for obtaining the desired results. As a result, such
processes cannot be declared in static programming languages.

In this implementation, a builder instance is expected to be ready to begin building another


product after providing the final result to the client. Therefore, at the end of the "GetProduct"
method body, the reset method is called. It's essential to utilize the builder pattern for items that
are highly complex and require significant customizations.

In the product class, attributes like list, add, and string ListParts have been defined. It's important
to note that concrete building patterns might result in unrelated products, i.e., results from
different builders that may not have the same interface.

The director class is responsible for carrying out the building steps in the correct order, which
can be useful when producing things in a specified order of setup. However, the director class is
optional since the clients directly control the builders.

In the main program class, the client code creates a builder object, passes it to the director, and
then initiates the construction process. The end result is retrieved from the builder object.

41
ADVANCED PROGRAMMING

Structural pattern
These plan designs are tied in with sorting out various classes and articles to shape bigger structures
and give new usefulness. Structural structure designs are Adapter, Bridge, Composite, Decorator,
Facade, Flyweight, Private Class Data, and Proxy.

Scope of structural design pattern


When 2 interfaces are not perfect with one another and need to make set up a connection between
them through a connector it’s called connector configuration design. Connector design cha nges
over the interface of a class into another interface or classes the customer expects that is connector
lets classes cooperates that couldn't in any case as a result of inconsistency. So in these kind of
incongruent situations, we can go for the connector design.

Model core
The code underneath represents the connector configuration design concentrating on noting what
classes comprise of, their jobs and the connection of the components in design exists.

42
ADVANCED PROGRAMMING

In the code above, we define an interface called ITarget, which represents the domain-specific
interface that client code will use. We then create the Adaptee class, which has some useful
behavior. However, its interface is incompatible with the existing client code, so it needs to be
modified before the client code can use it. We then create the adapter class, which inherits from
ITarget. This adapter class makes the interface of the Adaptee compatible with the ITarget
interface. When the main program is executed, the adapter can translate the target and produce
the expected output.

Output

Behavioral pattern
Behavioral patterns involve identifying common communication patterns between objects and
implementing these patterns. They include Chain of Responsibility, Command, Interpreter,
Iterator, Mediator, Memento, Null Object, Observer, State, Strategy, Template Method, and
Visitor.
Range of Behavioral Design Pattern
The template pattern outlines the basic structure of an algorithm and allows some steps to be
handled by subclasses. Subclasses can utilize the template pattern to modify specific parts of an
algorithm without affecting its overall structure. When it comes to expanding the module's
behavior in a project, it is important to enable the module to adapt to new application
requirements or to meet the needs of new applications without altering the source code. In some
scenarios, it may be possible to add to the module but not modify its structure. A developer can
implement a template design pattern to address these requirements.
Code example
The following code exemplifies the strategy design pattern, with a focus on elucidating the roles
of classes and the interrelationships among pattern elements.

43
ADVANCED PROGRAMMING

In the above code, the setting class was created to characterize the crucial interface to customers.
The setup maintains a reference to one of the methodology protests while ignoring the technique's
solid class. It should be abl e to communicate with all systems via a procedural interface. A setting
44
ADVANCED PROGRAMMING

recognizes a technique via the constructor, but also allows a setter to change it at runtime. The
Set Strategy task is created since the setting allows for the replacement of a technique object at
runtime. The capability DoSomeBusinessLogic refers to a setting that delegates some work to
the methodology object rather than doing various adaptations of the calculation entirely by itself.
Then, an interface called IStrategy is created, which announces tasks essential to every single
supported adaption of specific calculations. This interface is used by the setting to call the
computations defined by the solid procedures.
ConcreateStrategyA and ConcreateStrategyB are created, which execute the calculation while
adhering to the underlying methodological interface (making them interchangeable in the given
case). The customer code selects a solid method in the principle class and passes it to the unique
situation. In this case, the client must consider the differences between the techniques in order to
make the best option. The preceding code is then executed, and the result is shown below.
Output

Conclusion
We had to assess the case in terms of design patterns once the Tejobindu Garments (Employee
Management System) application was deployed. As a result, I provided numerous design
patterns in this assignment, as well as useful illustrations of creational, structural, and behavioral
patterns. Additionally, I compared the best design pattern from a variety with a number of
scenarios that were given, and I eventually provided a critical assessment of the design pattern
selection based on the scenarios that were provided.

45
ADVANCED PROGRAMMING

References
1. Spiceworks. (2022). What Is OOP (Object Oriented Programming)? Meaning, Concepts,
and Benefits - Spiceworks. [online] Available at:
2. https://www.spiceworks.com/tech/devops/articles/object-oriented-programming/
[Accessed 13 Apr. 2023].
3. Braunschweig, D. (2018). Encapsulation. [online] Rebus.community. Available at:
4. https://press.rebus.community/programmingfundamentals/chapter/encapsulation/
[Accessed 13 Apr. 2023].
5. Programiz.com. (2023). C# Class and Object (With Examples). [online] Available at:
https://www.programiz.com/csharp-programming/class-objects [Accessed 13 Apr.
2023].
6. Vegibit.com. (2023). C# Methods And Properties. [online] Available at:
https://vegibit.com/cmethods-and-properties/ [Accessed 13 Apr. 2023].
7. Patel, P. (2020). Constructors vs. Destructors - C#. [online] C-sharpcorner.com.
Available at: https://www.c-sharpcorner.com/article/constructor-vs-destructor-c-sharp/
[Accessed 13 Apr. 2023].
8. GeeksforGeeks. (2018). C Operator Overloading. [online] Available at:
https://www.geeksforgeeks.org/c-sharp-operator-overloading/ [Accessed 13 Apr. 2023].
9. Trivedi, J. (2023). Understanding Polymorphism In C#. [online] C-sharpcorner.com.
Available at: https://www.c-sharpcorner.com/UploadFile/ff2f08/understanding-
polymorphism-in-C-Sharp/ [Accessed 13 Apr. 2023].
10. GeeksforGeeks. (2014). Function Overloading in C. [online] Available at:
https://www.geeksforgeeks.org/function-overloading-c/ [Accessed 13 Apr. 2023].
11. Janssen, T. (2023). OOP Concept for Beginners: What is Abstraction? [online] Stackify.
Available at: https://stackify.com/oop-concept-abstraction/ [Accessed 13 Apr. 2023].
12. Pankaj Kumar Choudhary (2015). Interface in C#. [online] C-sharpcorner.com.
Available at: https://www.c-sharpcorner.com/UploadFile/f0b2ed/interface-in-C-Sharp/
[Accessed 13 Apr. 2023].
13. https://www.facebook.com/tallyfy (2018). All You Need to Know About UML Diagrams:
Types and 5+ Examples. [online] Tallyfy. Available at:
https://tallyfy.com/umldiagram/#:~:text=A%20UML%20diagram%20is%20a,document
%20information%20about%20t he%20system. [Accessed 13 Apr. 2023].

46
ADVANCED PROGRAMMING

47

You might also like