100% found this document useful (2 votes)
1K views

1164-1619624869751-40 - Advanced Programming - Reworded - 2021

The document provides details of an internal verification of assessment decisions for a student named S. Kevin Jeroshan enrolled in the HND in Computing – Advanced Programming / Software Engineering Pathway program. It includes an assessment checklist completed by the internal verifier confirming that the assessor's evaluation of the student's assignment against the assessment criteria is accurate and justified. The internal verifier has signed off on the assessment decision.

Uploaded by

Kevin Jerom
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
1K views

1164-1619624869751-40 - Advanced Programming - Reworded - 2021

The document provides details of an internal verification of assessment decisions for a student named S. Kevin Jeroshan enrolled in the HND in Computing – Advanced Programming / Software Engineering Pathway program. It includes an assessment checklist completed by the internal verifier confirming that the assessor's evaluation of the student's assignment against the assessment criteria is accurate and justified. The internal verifier has signed off on the assessment decision.

Uploaded by

Kevin Jerom
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 48

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title HND in Computing – Advanced Programming / Software Eng. Pathway

Mr. Tharaka
Assessor Internal Verifier
Unit 20 – Advance Programming
Unit(s)

Assignment title
S. Kevin Jeroshan
Student’s name
List which assessment criteria Pass Merit Distinction
the Assessor has awarded.

INTERNAL VERIFIER CHECKLIST

Do the assessment criteria awarded match


those shown in the assignment brief? Y/N

Is the Pass/Merit/Distinction grade awarded


justified by the assessor’s comments on the Y/N
Student work?
Has the work been assessed
Y/N
accurately?
Is the feedback to the student:
Give details:
• Constructive? Y/N
• Linked to relevant assessment criteria? Y/N
• Identifying opportunities for Y/N
improved performance?
• Agreeing actions? Y/N
Does the assessment decision need
Y/N
amending?

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date

Confirm action completed


Remedial action taken
Give details:

Assessor signature Date


Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID S. Kevin Jeroshan
COL/E- 008889
Unit Title
Assignment Number Assessor
10/08/2021 Date Received 1st
Submission Date submission
Date Received 2nd
Re-submission Date submission
Assessor Feedback:

LO1. Examine the key components related to the object orientated programming paradigm,

Analyzing design pattern types.


Pass, Merit & Distinction Descripts P1
M1
D1

LO2. Design a series of UML class diagrams

Pass, Merit & Distinction Descripts P2


M2
D2

LO3. Implement code applying design patterns

Pass, Merit & Distinction Descripts P3


M3
D3

LO4. Investigate scenarios with respect to design patterns

Pass, Merit & Distinction Descripts P4


M4
D4

Grade: Assessor Signature: Date:


Resubmission Feedback:

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

Signature & Date:

* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and grades decisions have
been agreed at the assessment board.
Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature
Pearson Higher Nationals in
Computing
Unit 20 – Advance Programming
General Guidelines

1. A Cover page or title page – You should always attach a title page to your assignment. Use
previous page as your cover sheet and make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.
4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom, right margins and 1.25” for the left margin of each page.

Word Processing Rules

1. The font size should be 12 point, and should be in the style of Time New Roman.
2. Use 1.5 line spacing. Left justify all paragraphs.
3. Ensure that all the headings are consistent in terms of the font size and font style.
4. Use footer function in the word processor to insert Your Name, Subject, Assignment No,
and Page Number on each page. This is useful if individual sheets become detached for any
reason.
5. Use word processing application spell check and grammar check function to help editing
your assignment.

Important Points:

1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your
work.
2. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. If you are unable to hand in your assignment on time and have valid reasons such as illness,
you may apply (in writing) for an extension.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation
and a reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course
Student Declaration

I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present
it as my own without attributing the sources in the correct form. I further understand what it
means to copy another’s work.

1. I know that plagiarism is a punishable offence because it constitutes theft.


2. I understand the plagiarism and copying policy of Edexcel UK.
3. I know what the consequences will be if I plagiarize or copy another’s work in any of the
Assignments for this program.
4. I declare therefore that all work presented by me for every aspect of my program, will be my
own, and where I have made use of another’s work, I will attribute the source in the correct
way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding
agreement between myself and Pearson, UK.
6. I understand that my assignment will not be considered as submitted if this document is not
attached to the assignment.

[email protected]
Student’s Signature: Date:10/08/2021
(Provide E-mail ID) (Provide Submission Date)
Higher National Diploma in Business
Assignment Brief
Student Name /ID Number S. Kevin Jeroshan
COL/E- 008889

Unit Number and Title Unit 20 – Advance Programming


2018/1
Academic Year 2021/22

Unit Tutor Mr. Tharaka

Assignment Title

Issue Date

Submission Date 10/08/2021

IV Name & Date

Submission format

The submission is in the form of an individual written report about. This should be written in a
concise, formal business style using single spacing and font size 12. You are required to make use
of headings, paragraphs and subsections as appropriate, and all work must be supported with
research and referenced using the Harvard referencing system. Please also provide an end list of
references using the Harvard referencing system. Please note that this is an activity-based
assessment where your document submission should include evidences of activities carried out
and of team working. To carry out activities given on the brief, you are required to form groups,
comprising not exceeding 15 individuals.

The recommended word count is 4,000–4,500 words for the report excluding annexures. Note
that word counts are indicative only and you would not be penalized for exceeding the word
count.
Unit Learning Outcomes:

Learning Outcomes
By the end of this unit students will be able to:
LO1. Examine the key components related to the object-orientated programming
paradigm, analysing design pattern types.
LO2. Design a series of UML class diagrams.
LO3. Implement code applying design patterns.
LO4 Investigate scenarios with respect to design patterns.
Assignment Brief and Guidance:

BOC Software solutions is leading software company in Kandy as system analyst you have to build
an application for Family Dental Care (FDC) considering given scenario.

Family Dental Care (FDC) is a leading up market dental surgery located in Kandy. It provides all
types of dental treatments to patients which include extractions, nerve fillings, maxillofacial
surgeries (i.e. surgeries involving jaw bone) and sophisticated dental implants. It is visited by
prominent dentists and dental consultants with post graduate qualifications, some of whom are
working at the Faculty of Dental Science at the University of Peradeniya.
Patients consult doctors by appointment. On their first visit, patients are required to register by
entering their personal details such as name, address, national identity card number and
contact number. A small fee is charged from the patient during registration. A separate fee is
charged for each treatment given.
Doctors too must get registered at FDC by providing personal details such as name, address,
date of birth, national ID number and contact number. In addition, consultants must provide the
name of their post graduate qualification along with the country of the University that granted it
and ordinary dentists should indicate the number of years of experience.
FDC consists of four fully equipped surgery rooms so that four patients can be accommodated at
any given time. FDC also contains a dental scan room which can be attended by one patient at a
time. The dental scan machine is operated by one of the dentists of the FDC facility. Normally, a
dentist without appointments for a given time slot (say, between 5 PM and 6 PM) is assigned to
the machine by the manager. When that time slot finishes, another doctor who is free will be
assigned.
The staff of FDC is made up of a manager, four nurses (one for each of the four surgery rooms)
and a receptionist who handles registrations and appointments.
An information system is required to keep track of patients, doctors, appointments, treatments
given to patients and payments. The system must also maintain information about the staff. It
has been decided to use an object oriented approach to design and implement the system.
Task 1

Examine the Object oriented concepts given below. Provide diagrams and code snippets from
suitable specific programming language to supplement your explanations.
i) Class
ii) Object
iii) Message
iv) Encapsulation
v) Inheritance
vi) Polymorphism
vii) Aggregation/composition

Task 2
Design and build the detailed UML class diagram for the Family Dental Care system. Your
solution should demonstrate all inter-class relationships namely Association, Inheritance and
Aggregation/composition. The classes should include attributes and methods needed.
Draw the class diagram for the explained system. Including all notations and details and ensure
that the diagram has the required functionalities. Analyze the class diagram provided above and
derive code scenarios related to the UML diagram.

Task 3
Determine and briefly discuss the range of design patterns and describe at
least one design pattern from the three available types of design pattern.
Provide suitable UML diagrams for the given patterns and analyze the
relationship between object-oriented paradigm and design patterns providing
a suitable example.
Task 4

Scenario 1

FDC owns a very expensive, state of the art dental scan machine (a device far superior to a
traditional dental X-ray machine) manufactured by Toshiba, Japan. FDC will be own just
one such machine in the foreseeable future. When modeling and implementing FDC
system in software, you must ensure that only one instance of that machine is created.
You may include suitable attributes for the machine such as serial number, make, country
of origin and cost. Implementation should allow the user to enter details of the dental
scanner and create the sole instance of that machine.

Scenario 02
Below table provides the hierarchy of the Employees and their monthly salary in FDC.

Emp Id Name Position Salary


A001 Anton Director 1,000,000 LKR
A002 Chamod Dentist 600,000 LKR
A003 Supuni Dentist 600,000 LKR
A004 Madhavi Dentist 600,000 LKR
A005 Piyal Nurse 200,000 LKR
A006 Kamal Nurse 200,000 LKR
A007 Kapila Nurse 200,000 LKR

All the Nurses are working under the Dentists and Chamod (Dentist) is working under the Supuni
(Dentist) and Madhavi (Dentist) is working under the Anton (Director).
Develop a system to display the details of all employees and your system should display which employee is
working under which employee clearly.

Scenario 03
Patients who need dental scans are kept in a First in First Out queue. Assume that you
have found an already developed Queue container in a software library. It provides
standard queue operations to insert and remove data (known as enqueue and deque
respectively). However, you need some specific operations such as search () to look up
a particular patient and show All () to list all the patients in the queue. These additional
operations are not provided by the library unit.
For each of the above scenarios:

Select and Justify the most appropriate design pattern for each of the above given scenarios then Define
and Draw class diagrams for above mentioned design patterns and develop code for the above scenarios
(except for the 3rd Scenario) using an appropriate programming language. Critically evaluate why you
selected the above design patterns and compare your answer with the range of design patterns
available.
Grading Rubric
Grading Criteria Achieve d Feedback

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.
M1 Determine a design pattern from
each of the creational, structural and
behavioral pattern
types.

D1 Analyse the relationship between the


object-orientated paradigm and design
patterns.

LO2 Design a series of UML class


diagrams
P2 Design and build class diagrams using
a UML tool.
M2 Define class diagrams for specific
design patterns using a UML tool.
D2 Analyse how class diagrams can be
derived from a given code scenario using a
UML tool.

LO3 Implement code applying design


patterns
P3 Build an application derived from UML
class diagrams.

M3 Develop code that implements a


design pattern for a given purpose.
D3 Evaluate the use of design patterns
for the given purpose specified in M3.
LO4 Investigate scenarios with respect to
design Patterns
P4 Discuss a range of design patterns
with relevant examples of creational,
structure and behavioral pattern types.

M4 Reconcile the most appropriate


design
pattern from a range with a series of
given scenarios.
D4 Critically evaluate a range of design
patterns against the range of given
scenarios with justification of your
choices.
Acknowledgement

First of all, I would like to thank my parents for their unrestrained contribution to study Higher
National Diploma (HND) in Esoft. And Esoft metro campus who gave us this valuable course from
Pearson UK. The last but not the least my Advanced Programming Lecturer Mr. Tharaka Sir for all
his support that he has given us from the HND session.

S. Kevin Jeroshan
Task 1

Examine the Object oriented concepts given below. Provide diagrams and code snippets from
suitable specific programming language to supplement your explanations.
i) Class
ii) Object
iii) Message
iv) Encapsulation
v) Inheritance
vi) Polymorphism
vii) Aggregation/composition

Class

A class is a client-defined plan or model from which objects are created. It is concerned with the
organization of qualities or techniques that are common to all objects of the same type.

Constructors are used to introduce new items. Fields are factors that provide information on the
state of the class and its items, and methods are used to carry out the class's and its articles'
operations. There are several types of classes that are used in continuous applications, for example,
fixed classes, unknown classes, and lambda articulations.

A class should
 Provide a well-defined interface - like the remote of the television.
 Represent a transparent concept - like the concept of a television.
 Be complete and well-documented - the television should have a plug and will have a
manual that documents all features.
 The code should be robust - it shouldn't crash, just like the television.
Classes allow us how to represent complex structures within a programing language.
They need two components:

 States - (or data) are the values that the thing has.
 Methods - (or behavior) are the ways during which the thing can interact with its data,

A Java class can hold or many java methods. We use java classes in order to hold java
methods.
The following diagram is an example of a Loan Accounts. It describes a particular aspect
of the entire application.

Figure 1: Class Diagram Figure 2: Class Code

Object

A Java object is a collection of information and methods that work their way through the
available information. An object has a state and a behavior.
The state of an item is saved in fields (factors), whereas strategies (capabilities) demonstrate
the behavior. Articles are created using forms known as classes.

An item is a state and behavior element, such as a seat, bicycle, marker, pen, table, car, and
so on. It might be physical or constant (substantial and immaterial). The financial framework
is an example of an immaterial object. An object has three characteristics;

1. State: addresses the information (worth) of an article.


2. Conduct: addresses the conduct (usefulness) of an article like store, pull out, and so on
3. Personality: An item character is normally carried out by means of a novel ID. 7
The worth of the ID isn't noticeable to the outside client.
Nonetheless, it is utilized inside by the JVM to distinguish each item exceptionally.

Objects are often concrete (a real-world object, a file on a computer) or might be conceptual
(such as a database structure) each with its own individual identity.

Figure 3: Object Diagram

Figure 4: Object Code


Message

Message passing is communication between measurements as far as PCs are concerned. It is a


form of correspondence used in both object-oriented and equal programming. Message passing
in Java is analogous to transmitting an item, such as a message, beginning with one string and
progressing to the next string. It is used when strings do not have shared memory and cannot
share screens, semaphores, or other common elements. Assume we consider an example of a
manufacturer and a consumer; similarly to what the producer will give, the buyer will desire to
devour it as it were. To carry out correspondence between strings, we mostly utilize Queue.

Figure 5: Message Passing

Figure 6: Message Code


Encapsulation

One of the four critical OOP concepts is epitome. Legacy, polymorphism, and contemplation
are the other three. In Java, an epitome is a system that wraps information (factors) and code
that follows up on the information (techniques) into a single unit. In embodiment, the
components of a class are stored away from other classes and can only be accessed via the
procedures for their current class. As a result, it is also known as information concealment.

To accomplish exemplification in Java


1. Pronounce the factors of a class as private.
2. Give public setter and getter strategies to adjust and see the factors esteems.

Encapsulation is protecting data and highlighting data.

Benefits of Encapsulation

 The fields of a class can be made perused just or compose as it were.


 A class can have all out authority over what is put away in its fields.

Figure 7: Encapsulation
Figure 8: Encapsulation Code

Figure 9: Encapsulation Code


Inheritance

Inheritance is defined as the relationship in which one class obtains the attributes (techniques
and fields) of another. The data is made reasonable in a variety of tiered requests by the use of
legacy.
The class that gets the properties of another is known as the subclass (inferred class, kid
class), and the class that obtains the properties is known as the superclass (base class, parent
class).
Inheritance is the transfer of attributions and behaviors from the parent class to the child class.

Terms used in Inheritance

 Class: A class is an assortment of items which have normal properties.


 Derived Class/Sub-class: Derived class is a class that acquires from a base class. It is
otherwise called subclass or kid class.
 Base Class/Superclass: The base class is the fundamental class where inferred classes
acquire the highlights. It is otherwise called the superclass or parent class.
 Reusability: The name itself says reuse the rehashed code in the projects. It is an instrument
to reuse existing code when you are making new classes.

Figure 10:
Inheritance
diagram
Figure 11: Inheritance code

Polymorphism

Polymorphism refers to an item's ability to take on many structures. The most well-known
application of polymorphism in OOP occurs when a parent class reference is used to refer to a
child class object. Polymorphism is defined as any Java object that can pass more than one IS-
A test. All Java objects are polymorphic in the sense that they will complete the IS-An
evaluation for their own type as well as the class Object.
Recognize that the only way to access to an article is via a reference variable. A reference
variable can only be of one type. The type of a reference variable cannot be altered while it is
spoken.

If the reference variable is not declared last, it might be reassigned to various articles. The
kind of reference variable determines the techniques that may be summoned on the article.

A reference variable can refer to any object of its declared kind or any subtype of its declared
kind. A reference variable can be declared as a type of class or interface.

In light of this, polymorphism can be arranged into two kinds:


1. Static or Compile-Time Polymorphism
2. Dynamic Polymorphism

Static or Compile-Time Polymorphism


Static or Compile-Time Polymorphism in java is otherwise called Static Polymorphism. In this cycle,
the call to the strategy is settled at gather time. Order Time polymorphism is accomplished through
Method Overloading. This kind of polymorphism can likewise be accomplished through Operator
Overloading. Nonetheless, Java doesn't uphold Operator Overloading.

Technique Overloading is the point at which a class has various strategies with a similar name,
however the number, types and request of boundaries and the return sort of the strategies are unique.
Java permits the client opportunity to utilize similar name for different capacities as long as it can
recognize them by the sort and number of boundaries
Dynamic Polymorphism

Dynamic Polymorphism in java is otherwise called Dynamic Binding or Dynamic Method Dispatch.
In this interaction, the call to an abrogated strategy is settled progressively at runtime instead of at
aggregate time. Runtime polymorphism is accomplished through Method Overriding.
Technique Overriding is done when a kid or a subclass has a strategy with a similar name,
boundaries and return type as the parent or the superclass, then, at that point that capacity abrogates
the capacity in the superclass. In less difficult terms, if the subclass gives its definition to a strategy
effectively present in the superclass, then, at that point that capacity in the base class is supp
regarding the strategy it abrogates, the superseding technique should observe adhering to compulsory
principles:
1. It should have a comparable technique name.
2. It should have an identical contention.
3. It should have an identical bring type back.
4. It should not have a more prohibitive access modifiers to be superseded.

Figure 12: Polymorphism Diagram

Figure 13:
Polymorphism Code

Figure 14:
Polymorphism Code

Aggregation and Composition

Aggregation
Affiliation is a link between two distinct classes that develops via their Objects. Affiliation might be
one-to-many, one-to-many, or many-to-many. In Object-Oriented programming, an Object
communicates to another Object in order for that item's usefulness and administrations to be used.
The two forms of affiliation are structure and aggregation.
It has a connection. It's a one-sided romance. Both cases can live on their own.

Figure 15: Aggregation Diagram

Figure 16: Aggregation Code

Figure 17: Aggregation Code

Composition

One form of association is composition. Synthesis is defined as a connection in which one class
includes another class, and the contained class is dependent on the containing class in order to exist
independently.
We've already seen an illustration with a connection. We have a car item with a motor in that. This is
a representation of a layout. A motor cannot exist without a vehicle in this scenario. When compared
to Aggregation, the synthesis is more constrained. There isn't a Java inclusion in this work. It is
mostly regarded as a planning technique.

Composition is a restricted from of aggregation and it says two entities are highly depend on each
other.
1. In composition are both the entities are depend on each other.
2. When there is a composition between two entities, the component object cannot exsist
without the other object.
Figure 18: Composition Diagram

Figure 19: Composition Code


Task 2

Design and build the detailed UML class diagram for the Family Dental Care system. Your
solution should demonstrate all inter-class relationships namely Association, Inheritance and
Aggregation/composition. The classes should include attributes and methods needed.
Draw the class diagram for the explained system. Including all notations and details and ensure that
the diagram has the required functionalities. Analyze the class diagram provided above and derive
code scenarios related to the UML diagram.

Figure 20: UML Diagram for the Scenario


Figure 21: UML Diagram Code
Figure 22: UML Diagram Code
Figure 23: UML Diagram Code
Figure 24: UML Diagram Code
Figure 25: UML Diagram Code
Figure 26: UML Diagram Code
Task 3

Determine and briefly discuss the range of design patterns and describe at least one
design pattern from the three available types of design pattern. Provide suitable
UML diagrams for the given patterns and analyze the relationship between object-
oriented paradigm and design patterns providing a suitable example.

Design Patterns

A design pattern is a general, repeatable solution to a frequently occurring problem in


programming. A plan design isn't the same as a finished plan that can be easily translated into
code. It is a representation or framework for dealing with a problem that may be used in a variety
of situations.

The simplest methods used by experienced object-oriented software engineers are design patterns.
Design patterns are answers to common issues that software engineers confront while developing
software. These answers were discovered via trial and error by a number of software engineers
over a long period of time.

Reason to implicit Design Patterns

Design patterns can help to speed up the development process by providing tried and true
improved ideal models. Viable programming configuration necessitates taking into account
difficulties that may not become apparent until later in the execution. Reusing configuration
designs helps to avoid minor errors that might cause significant problems and improves code
readability for coders and draftsmen who are familiar with the examples.

Individuals frequently only perceive how to apply certain product plan methods to specific
challenges. These techniques are difficult to adapt to a broader range of situations.
Configuration designs are generic arrangements that are documented in a company that does not
require points of interest associated with a specific issue.
Engineers may also communicate using well-known, well-known names for programming
collaborations thanks to designs. After some time, ordinary plan examples can be improved,
making them more powerful than specifically designed plans.

Types of Design Patterns

Design patterns can be classified based on multiple criteria, the most common of which is the basic
underlying problem they solve. According to this criterion, design patterns can be classified into
various types, some of which are:
 Creational Patterns
 Structural Patterns
 Behavioral Patterns

Creational Design Patterns

Creational design patterns are configuration designs that arrangement with object creation systems,
attempting to make objects in a way appropriate to the circumstance. The essential type of article
creation could bring about plan issues or added intricacy to the plan. Creational configuration
designs tackle this issue by some way or another controlling this article creation.
Creational Design Patterns address this issue by decoupling the client entirely from the particular
initialization process.
In this document, we'll discuss two types of Creational Design Pattern:
 Singleton – Ensures that at most only one instance of an object exists throughout application.
 Abstract Factory – Creates families of related dependent objects.

Singleton Design Patterns

Singleton: a solitary individual or thing of the sort viable.


The singleton configuration design is a creational configuration design. It alludes to a class that has just
one example in presence at some random time. On the off chance that we attempt to launch a second
occurrence of the singleton class, the new factor will likewise highlight the main example that was
made before. We should investigate the execution of this example and afterward talk about certain
issues it can help settle.
The principal configuration design analyzed in this course is the Singleton Design Pattern. The
Singleton Design Pattern is utilized when there ought to just be one occurrence of a given class. It
utilizes static, class techniques and private constructors to stringently control making of new examples
of the class.
 In this module, you will learn:
 The ten components that recognize an example
 The expectation of the Singleton design
 When to utilize the Singleton design
 The design of the Singleton design
 How the Singleton design is utilized in reality

A singleton class is a class that has a solitary article and that novel item establishes a worldwide
office for all customers. For instance, consider a program with different classes that need to create
irregular numbers. It's anything but a smart thought to develop numerous free irregular number
generators. The arrangement of numbers that an arbitrary number generator makes are not really
irregular but rather the consequence of a deterministic computation. Thus, PC created irregular
numbers ought to truly be called pseudo-arbitrary numbers. In many calculations for creating a
succession of pseudo-arbitrary numbers, you start with a seed esteem and change it to get the
primary worth of the grouping. Then, at that point you apply the change again for the following
worth, etc.
The Singleton pattern involves one class which is responsible to make an object while ensuring that
only single object gets created. This class provides how to access its only object which may be
accessed directly without got to instantiate the thing of the category.

A class using the singleton contains:


 A personal static variable, holding the sole instance of the category.
 A personal constructor, so it can't be instantiated anywhere else.
 A public static method, to return the only instance of the category.

Figure 27: Singleton Design Patterns Diagram


Figure 28: Singleton Design Patterns code

Figure 29: Singleton Design Patterns Code


Figure 30: Singleton Design Patterns Code

Structural Patterns

Structural patterns are worried about how classes and articles can be masterminded to shape bigger
constructions. Structural class patterns use legacy to form interfaces or various executions. For instance,
different legacy can be utilized to join highlights from at least two classes into a solitary class. This
permits at least two freely created class libraries to cooperate.
Structural object patterns determine an approach to make new items to acknowledge new usefulness. The
adaptability of item arrangement permits us to change the creation at run-time, which is inconceivable
with static class structure.
Structural design patterns are worried about how classes and items can be made, to shape bigger
structures. The underlying model examples works on the construction by recognizing the relationships.
These designs center around, how the classes acquire from one another and how they are formed from
different classes.
These patterns specialize in, how the classes inherit from one another and the way they're composed from
other classes. Structural patterns use inheritance to compose interface or implementations. Structural
object patterns describe ways to compose objects to understand new functionality
In this document, we'll discuss two sorts of Structural Design Pattern:
 Adaptor – Adapting an interface into another consistent with client expectation.
 Composite– Allowing clients to work on hierarchy of objects
Composite Design Pattern

Composite pattern is utilized where we need to treat a gathering of articles in comparative manner as a
solitary item. Composite example makes objects in term out of a tree construction to address part just as
entire progressive system. This sort of configuration design goes under underlying example as this
example makes a tree construction of gathering of articles.

This example makes a class that contains gathering of its own items. This class gives approaches to
adjust its gathering of same items. We are exhibiting utilization of composite example through after
model in which we will show representatives chain of command of an association.
As portrayed by Goff, "Create objects into tree construction to address part-entire chains of command.
Composite allows customer to treat singular items and syntheses of articles consistently".
When managing Tree-organized information, software engineers frequently need to separate between a
leaf-hub and a branch. This makes code more intricate, and accordingly, mistake inclined. The
arrangement is an interface that permits treating perplexing and crude items consistently. In object-
arranged programming, a composite is an item planned as a creation of at least one comparative articles,
all showing comparative usefulness. This is known as a "has-a" connection between objects.

Figure 31: Composite Design Pattern Diagram


Figure 32: Composite Design Pattern Code
Figure 33: Composite Design Pattern Code
Behavioral Design Patterns

Standards of conduct are worried about giving arrangements in regards to protest cooperation - how they
convey, how are some reliant upon others, and how to isolate them to be both reliant and free and give
both adaptability and testing capacities.
Behavioral patterns standards portray associations among items and spotlight on how articles speak with
one another. They can decrease complex stream diagrams to simple interconnections between objects of
different classes. Standards of conduct are additionally used to make the calculation that a class utilizes
just another boundary that is movable at runtime.
Standards of conduct are worried about calculations and the task of duties between objects. Standards of
conduct depict examples of items or classes as well as the examples of correspondence between them.
These examples describe complex control stream that is hard to follow at run-time. They shift your
concentrate away from the progression of control to allow you to focus simply in transit objects are
interconnected. Social class designs use legacy to disperse conduct between classes.
The Template Method is the less complex and more normal of the two. A layout strategy is a theoretical
meaning of a calculation. It characterizes the calculation bit by bit. Each progression summons either a
theoretical activity or a crude activity. A subclass fleshes out the calculation by characterizing the
theoretical activities. The other social class design is Interpreter design, which addresses a language as a
class pecking order and executes a mediator as a procedure on occurrences of these classes. In this
document, we'll discuss two sorts of Behavioral Design Pattern:
 Iterator – allows you to traverse elements of a set without exposing its underlying representation.
 Observer– allows you to define a subscription mechanism to notify multiple objects about any
events that happen to the thing they’re observing.
Observer Design Pattern

Observer pattern characterizes a one-to-numerous reliance between objects with the goal that when one
article changes express, every one of its wards are told and refreshed consequently. It is likewise
alluded to as the distribute buy in design. In onlooker design, there are numerous spectators (supporter
protests) that are noticing a specific subject (distributer object). Onlookers register themselves to a
subject to get a notice when there is a change made inside that subject.

A spectator item can enroll or unregister from subject anytime of time. It helps is making the items
protests approximately coupled. Observer pattern is used when there is one-to-many relationship
between objects such as if one object is modified, its dependent objects are to be notified automatically.
Observer pattern falls under behavioral pattern category Observer pattern defines a one-to-many
dependency between objects so that when one object changes state, all its dependents are notified and
updated automatically. It is also referred to as publish-subscribe pattern. Observers register themselves
to a subject to get a notification when there is a change made inside that subject.

Define a one-to-many dependency between objects so that when one object changes state, all its
dependents are notified and updated automatically. An abstraction has two aspects, one dependent on
the other encapsulating these aspects in separate objects let you vary and reuse them independently. A
change to one object requires changing others, and also when you don’t know how many objects have
to change. Observer pattern utilizes three entertainer classes. Subject, Observer and Client. Subject is an
item having strategies to append and segregate onlookers to a customer object. We have made a
theoretical class Observer and a substantial class Subject that is expanding class Observer.

Observer Pattern Demo, our demo class, will utilize Subject and substantial class object to show
eyewitness design in real life.
Figure 34: Observer Design Pattern Diagram

Figure 35: Observer Design Pattern Code


Figure 36: Observer Design Pattern Code
Figure 37: Observer Design Pattern Code

Object-Oriented Paradigm

 OO Analysis and Design is revolved around the idea of an article.


 It produces frameworks that are organizations of items teaming up to satisfy the duties (prerequisites)
of the framework.
 Articles are calculated units that consolidate the two information and conduct.
 The information of an article is alluded to by numerous names.
 Ascribes, properties, occurrence factors, and etc.
 The conduct of an article is characterized by its arrangement of strategies.
 Articles intrinsically realize what type they are. It ascribes permits it to Keep track of its state. Its
techniques permit it to work appropriately.

Object-oriented programming (OOP is a programming worldview dependent on objects (having the two
information and techniques) that plans to consolidate the upsides of particularity and reusability. Items,
which are normally examples of classes, are utilized to cooperate with each other to plan applications
and PC programs.
The significant highlights of item arranged writing computer programs are −
1. Granular perspective in program plan.
2. Projects coordinated around objects, gathered in classes.
3. Zero in on information with techniques to work upon article's information.
4. Connection between objects through capacities.
5. Reusability of plan through making of new classes by adding highlights to existing class.

You might also like