PAF-Karachi Institute of Economics & Technology
(The Center of Excellence)
College of Computing and Information Sciences
DESIGN PATTERN
PROJECT REPORT:
RETAIL POS SYSTEM
CLASS ID: 111819
SUBMITTED TO:
SIR AYUB LATIF
BY :
MUHAMMAD HAMZA 12291
MUHAMMAD BILAL 12255
AMMAR MUSHTAQ 13019
1) Factory Method
Define an interface for creating an object, but let the subclasses decide which class to
instantiate. The Factory method lets a class defer instantiation it uses to subclasses. We
use factory method to get the data of product and services accordingly. Moreover we can
reuse this code if we add any new type in future.
Interface saleitemtype
Class product
Class service
Abastract class saleitemfactory
Class servicefactory
Class productfactory
2) Adapter
The Adapter Design Pattern in C# works as a bridge between two incompatible interfaces.
This design pattern involves a single class called adapter which is responsible for
communication between two independent or incompatible interfaces. In our project we use
adapter in email marketing feature to get data array to list. So we apply adapter here for
insertion of data.
Class customer
Class datastoring
Class cuadapter
Interface Itarget
3) Strategy
According to Gang of Four Definitions, define a family of algorithms, encapsulate
each one, and make them interchangeable. Strategy lets the algorithm vary
independently from clients that use it.
The Strategy Design Pattern is used when we have multiple algorithms
(solutions) for a specific task and the client decides the actual implementation to
be used at runtime. Here we use strategy to solve payment issue where on pos
customer can pay on cash and pay later can handle this process through
strategy.
Interface Ipaymentstrategy
Class creditcardpaymentstartegy
Class cashpaymentstrategy
Class paymentcontext
4) Façade
As per the GOF definition, the Façade Design Pattern states that you need to
provide a unified interface to a set of interfaces in a subsystem. The Façade
Design Pattern defines a higher-level interface that makes the subsystem easier
to use.
In simple words, we can say that the Facade Design Pattern is used to hide the
complexities of a system and provides an easy-to-use interface to the client using
which the client can access the system. The Façade (usually a wrapper) sits on
the top of a group of subsystems and allows them to communicate in a unified
manner. We minimize the complexity of our code and increase function
reusability with façade. Now everywhere when we need to get values of quantity,
unit and amount we just call function product data.
Class quantity
Class unit
Class amount
Class productdata
5) Builder
The Builder Design Pattern builds a complex object using many simple objects
and using a step-by-step approach. The Process of constructing a complex
object should be generic so that the same construction process can be used to
create different representations of the same complex object. In pos we handle
dashboard report management process with builder. We can create any type of
report i.e monthly, daily and annually just adding a function.
Class Report
Abstract Class Reportbuilder
Class instantReport
Class reportdirector
6) SINGLETON
As per the Gang of Four definitions, the singleton Pattern “A singleton refers to a
design pattern in software engineering that restricts the instantiation of a class to
a single object. In other words, it ensures that only one instance of a class is
created and provides a global point of access to that instance. The singleton
pattern is often used when there is a need for a single, shared resource or when
coordinating actions across an application”
In our project we use singleton pattern for data base connectivity.
Class connection_string