You are on page 1of 133

lOMoARcPSD|15607169

1164-1619624869751-40- Advanced Programming Reworded


2021
HND in Computing (ESOFT Metro Campus)

Studocu is not sponsored or endorsed by any college or university


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)

INTERNAL VERIFICATION – ASSESSMENT DECISIONS


Programme title HND in Computing - Application Dev / Software Eng. Pathway

Assessor Internal Verifier


Unit 20 – Advance Programming
Unit(s)

Assignment title
R.M. Dulith Sanjana Ramanayake
Student’s name
List which assessment Pass Merit Distinction
criteria the Assessor has
awarded.
INTERNAL VERIFIER CHECKLIST

Do the assessment criteria awarded


match those shown in the assignment Y/N
brief?
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/
• Linked to relevant assessment criteria? N
• Identifying opportunities for Y/
improved performance? N
• Agreeing actions? Y/
N

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

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Remedial action taken


Give details:
Assessor signature Date

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Higher Nationals - Summative Assignment Feedback Form


Student Name/ID R.M. Dulith Sanjana Ramanayake

Unit Title
Assignment Number Assessor
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,

analysing 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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Pearson Higher Nationals in

Computing
Unit 20 – Advance Programming

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

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

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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 plagiarise 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.

Student’s Signature: Date:


(Provide E-mail ID) (Provide Submission Date)

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Higher National Diploma in Business


Assignment Brief
R.M. Dulith Sanjana Ramanayake
Student Name /ID Number

Unit Number and Title Unit 20 – Advance Programming

Academic Year 2018/19


20021/22

Unit Tutor

Assignment Title

Issue Date

Submission Date

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 penalised for exceeding the
word count.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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).

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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 showAll() 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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Grading Rubric

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

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.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Table of Contents
Chapter 01........................................................................................................................................................24
1.1.1 Advantages of OOPS.......................................................................................................................25
1.1 Class........................................................................................................................................................25
1.1.1 Class diagram Example....................................................................................................................26
1.2 Objects....................................................................................................................................................27
1.2.1 The Difference between Object & Class..........................................................................................28
1.3 Encapsulation..........................................................................................................................................29
1.3.1 Advantages of Encapsulation...........................................................................................................30
1.4 Aggregation............................................................................................................................................32
1.4.1 Define an aggregation relationship between the Student class and the Subject class as follows:...33
1.5 Composition............................................................................................................................................34
Generalization...........................................................................................................................................34
Associative................................................................................................................................................35
1.6 Inheritance..............................................................................................................................................36
1.7 Message..................................................................................................................................................37
1.8 Polymorphism.........................................................................................................................................39
1.9 Determine a design pattern from each of the creational, structural and behavioral patterns.................40
1 Creational Patterns.................................................................................................................................41
2 Structural Patterns:................................................................................................................................42
3. Behavioral Patterns:..............................................................................................................................44
Chapter 02........................................................................................................................................................45
2.1 UML Class Diagram...............................................................................................................................45
2.1.1 Association.................................................................................................................................47
2.1.2 Generalization (Inheritance)............................................................................................................47
2.1.3 Aggregation......................................................................................................................................49
2.1.4 Composition.....................................................................................................................................49
2.2 FDC UML Class Diagram......................................................................................................................50
2.3 Implementation of FDC Class Diagram.................................................................................................52
Chapter 03........................................................................................................................................................81
3.1 Design Patterns.......................................................................................................................................81
3.1.1 Creational.........................................................................................................................................81
3.1.1 Use case of creational design pattern-.............................................................................................82
3.1.3 Benefits of Design Patterns..............................................................................................................84
3.1.3 Structure of a Design Pattern...........................................................................................................85
3.1.4 Design patterns are useful to computer programmers.....................................................................85
3.2 Singleton Design Pattern........................................................................................................................86
3.2.1 Coding Snapshot..............................................................................................................................87
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

3.3 Factory Design Pattern...........................................................................................................................88


3.5 Prototype Pattern....................................................................................................................................91
3.5.1 Advantages of Prototype Pattern......................................................................................................91
3.5.2 Usage of Prototype Pattern..............................................................................................................91
3.6 Structural design patterns.......................................................................................................................92
3.6.1 Types of structural design patterns...................................................................................................92
3.7 Composite Design Pattern......................................................................................................................98
3.8 Behavioral Design Patterns..................................................................................................................104
3.8 Observer Design Pattern.......................................................................................................................105
3.9 Analyze the relationship between object-oriented paradigm and design patterns providing a suitable
example.......................................................................................................................................................108
Relationship between object-oriented paradigm and design pattern..........................................................109
Design pattern object-oriented concepts.....................................................................................................110
Implementing the OO concepts..................................................................................................................111
Design patterns in practice..........................................................................................................................112
Chapter 04......................................................................................................................................................113
Scenario 1...................................................................................................................................................113
4.1.1 Advantages of a Singleton pattern:................................................................................................116
Scenario 2...................................................................................................................................................117
4.2.1 UML...............................................................................................................................................117
Scenario 3...................................................................................................................................................124
4.3.1 Iterator pattern................................................................................................................................125
4.3.2 Iterator...........................................................................................................................................126
4.4 Critically evaluate a range of design patterns against the range of given scenarios with the justification
of your choice.............................................................................................................................................127
4.4.1 Justification...................................................................................................................................128
Gantt Chart.....................................................................................................................................................129
References......................................................................................................................................................130

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figures
Figure 1 OOP (Kaushik, n.d.)..........................................................................................................................25
Figure 2 Class..................................................................................................................................................27
Figure 3 Class Diagram...................................................................................................................................28
Figure 4............................................................................................................................................................28
Figure 5 Objects...............................................................................................................................................29
Figure 6 Difference between Object & Class...................................................................................................30
Figure 7 Dog object.........................................................................................................................................30
Figure 8 Encapsulation....................................................................................................................................30
Figure 9 Encapsulation (S, 2022)....................................................................................................................32
Figure 10 implement Encapsulation in Java....................................................................................................33
Figure 11 Example diagram of Composition (Sudhakaran, 2019)..................................................................35
Figure 12 Example of diagram Generalization (tutorialspoint, n.d.)..............................................................36
Figure 13 Examples diagram of Associative....................................................................................................36
Figure 14 Inheritance.......................................................................................................................................37
Figure 15 Inheritance Diagram (Parson, n.d.)................................................................................................38
Figure 16..........................................................................................................................................................38
Figure 17 Message Passing.............................................................................................................................39
Figure 18 Message Passing Diagram (panonit, n.d.)......................................................................................39
Figure 19 Polymorphism ex.............................................................................................................................41
Figure 20 Design Patterns...............................................................................................................................42
Figure 21 9creational design pattern (Tellmehow, 2019)................................................................................43
Figure 22 Structural Design Pattern (starship-knowledge, n.d.).....................................................................45
Figure 23 Behavioral design pattern (data-flair, n.d.).....................................................................................46
Figure 24 Association Class Diagram (stackoverflow, 2019)..........................................................................48
Figure 25 Generalization Class Diagram........................................................................................................49
Figure 26 Aggregation Class Diagram............................................................................................................50
Figure 27 Composition Class Diagram...........................................................................................................51
Figure 28 UML Class diagrams (diagrams.net, 2022)....................................................................................51
Figure 29 Class Diagram Explain...................................................................................................................52
Figure 30 Singleton Class Diagram (tutorialspoint, n.d.)...............................................................................87
Figure 30 Singleton Class Diagram (tutorialspoint, n.d.)...............................................................................87
Figure 31 Singleton Code ex............................................................................................................................87
Figure 31 Singleton Code ex............................................................................................................................87
Figure 32 Factory coding ex............................................................................................................................88
Figure 32 Factory coding ex............................................................................................................................88
Figure 33 Factory UML diagram (commons.wikimedia, n.d.)........................................................................91
Figure 33 Factory UML diagram (commons.wikimedia, n.d.)........................................................................91
Figure 34 Adapter UML (geeksforgeeks, 2022)...............................................................................................94
Figure 34 Adapter UML (geeksforgeeks, 2022)...............................................................................................94
Figure 35 Bridge UML (geeksforgeeks, 2021).................................................................................................95
Figure 35 Bridge UML (geeksforgeeks, 2021).................................................................................................95
Figure 36 Decorator UML (tutorialspoint, n.d.)..............................................................................................96
Figure 36 Decorator UML (tutorialspoint, n.d.)..............................................................................................96
Figure 37 Facade UML (tutorialspoint, n.d.)..................................................................................................97
Figure 37 Facade UML (tutorialspoint, n.d.)..................................................................................................97
Figure 38 Flyweight pattern UML (tutorialspoint, n.d.)..................................................................................98
Figure 38 Flyweight pattern UML (tutorialspoint, n.d.)..................................................................................98
Figure 39 Proxy Pattern (tutorialspoin, n.d.)................................................................................................104
Figure 39 Proxy Pattern (tutorialspoin, n.d.)................................................................................................104
Figure 40 Observer design pattern (tutorialspoint, n.d.)...............................................................................106
Figure 41 Observer Uml................................................................................................................................106
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Figure 42 Observer Coding ex.......................................................................................................................107


Figure 43 FDC...............................................................................................................................................113
Figure 44 Singleton code Ex..........................................................................................................................114
Figure 45 Singleton code output....................................................................................................................115
Figure 46 Composite UML (Commons.wikimedia, n.d.)................................................................................117
Figure 46 Composite UML (Commons.wikimedia, n.d.)................................................................................117
Figure 47 Composite coding ex......................................................................................................................118
Figure 48 Composite coding ex......................................................................................................................118
Figure 49 Composite coding ex......................................................................................................................119
Figure 50 Composite coding ex......................................................................................................................120
Figure 51 Composite coding ex......................................................................................................................121
Figure 52 Composite coding ex......................................................................................................................121
Figure 53 Composite coding ex......................................................................................................................122
Figure 54 Composite coding ex......................................................................................................................122
Figure 55 Composite coding ex......................................................................................................................123
Figure 56 Composite coding Output..............................................................................................................123
Figure 57 Iterator pattern Class Diagram (researchgate, n.d.).....................................................................126
Figure 57 Iterator pattern Class Diagram (researchgate, n.d.).....................................................................126
Figure 58 Iterator pattern framework (geeksforgeeks, 2022)........................................................................127

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Chapter 01

Examine the characteristics of the object-orientated paradigm as well as the various


class relationships.

The major motivating factor in the invention of object-oriented approach is to remove some of the flaws
encountered in the procedural approach. OOP treats data as a critical element in the program
development and does not allow it to flow freely around the system. It ties data more closely to the
function that operate on it and protects it from accidental modification from outside function. OOP
allows decomposition of a problem into a number of entities called objects and then builds data and
function around these objects.

Figure 1 OOP [ CITATION Gee211 \l 1033 ]

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

1.1.1 Advantages of OOPS

1. OOP offers associates an easy-to-understand and clear standard structure for programs.
2. Objects created for Object-Oriented Programs are reused in alternative programs. therefore it saves
important development prices.
3. Massive programs square measure troublesome to jot down, however if the event and coming up
team follow the OOPS idea then they'll higher style with minimum flaws.

1.1 Class
A class may be a user-defined blueprint or paradigm from that object square measure created. It outlines the
set of properties or strategies that square measure general to all or any objects of 1 kind. In general, category
declarations will incorporate these parts, in order:

 Modifiers: is public or holds the default access  category keyword: class keyword is employed to
come up with a category.

 Class name: The name ought to start with an associate initial letter (capitalized by convention).

 Superclass(if any): The name of the class’s parent (superclass), if any, preceded by the keyword
extends. a category will solely elongate (subclass) one parent.

 Interfaces(if any): A comma-separated list of interfaces enforced by the category, if any, preceded
by the keyword implements. a category will implement quite one interface.

 Body: the category body closed by braces,

Constructors square measure used for initializing new objects. Fields square measure variables that offer the
state of the category and its objects, and strategies square measure wont to implement the behavior of the
category and its objects.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 2 Class

According to the java syntax once we produce a category the primary letter of the category should begin
with associate capital and therefore the name of the java file ought to match the category name.

1.1.1 Class diagram Example

Figure 3 Class Diagram


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Figure 4

1.2 Objects

It is a basic unit of Object-Oriented Programming and depicts real-life entities. A typical Java program
generates several objects, that as you recognize, communicate by invoking strategies. associate object
consists of
 State: it's delineated by attributes of the associate object. It conjointly reveals the properties of the
associate object.
 Behavior: it's pictured by the strategies of the associate objects. It conjointly reflects the response of
associate objects to alternative objects.
 Identity: It offers a singular name to associate objects and permits one object to act with alternative
objects

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 5 Objects

1.2.1 The Difference between Object & Class

 A category may be a blueprint or paradigm that defines the variables and therefore the strategies
(functions) common to all or any objects of an exact kind.

 An object may be a specimen of a category. package objects square measure usually won't to model
real-world objects you discover in the standard of living.

Figure 6 Difference between Object & Class

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 7 Dog object

1.3 Encapsulation

Figure 8 Encapsulation

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Encapsulation is outlined because of the wrapping from information underneath one unit. it's the mechanism
that binds along code and therefore the information it manipulates. differently to deem encapsulation is, it's a
protecting protect that stops the information from being accessed by the code outside this protection.
Technically in encapsulation, the variables or information of square measure hidden from the other category
and might be accessed solely through any member operating of its class during which they're declared.
As in encapsulation, the information in a very category is hidden from alternative categories, thus it's
conjointly called information concealment. Encapsulation is achieved by declaring all the variables within
the category as non-public and writing public strategies within the category to the line and finding the values
of variables exploiting the getter-setter methodology.

To perform encapsulation in Java −

1. Declare the variables of a category as non-public.

2. offer public setter and getter strategies to rework and consider the values of the variables.

1.3.1 Advantages of Encapsulation

The main good thing about exploitation encapsulation is that the security of the information. blessings of
encapsulation include:
1. Encapsulation shields associated objects from unwanted access by purchasers.
2. Encapsulation permits access to the level while not revealing the complicated details below that
level.
3. It decreases human errors.
4. Analyzes the upkeep of the applying

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

5. Makes the application lighter to grasp.

Figure 9 Encapsulation[CITATION Rav \l 1033 ]

1.3.1.1 How to achieve or implement Encapsulation in Java

a) There square measure 2 small print whereby we will reach or implement encapsulation
within the Java program.

b) Declaring the instance variable of the category as non-public. so it can not be accessed
directly by anyone from outside the category.

c) Provide the general public setter and getter strategies within the category to set/modify the
values of the variable/fields.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 10 implement Encapsulation in Java

On on-top of the program, the category Animal is encapsulated because the variables square
measure declared non-public. The get strategies like getName(), get voice(), and getAnimalCat()
square measure set as public, these strategies square measure wont to access these variables. The
setter strategies like setName(), setVoice(), and setAnimalCat()declared as public and are wont to
set the values of the variables.

1.4 Aggregation

Aggregation in Java may be a relationship between 2 categories that are best delineated as a "has-
a" and "whole/part" relationship. it's an additional specialized version of the association
relationship. the mixture category contains a relation to another category and is claimed to own

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

possession of that category. every category documented is taken into account to be part of the
mixture category.

1.4.1 Define an aggregation relationship between the Student class and the Subject
class as follows:

We use aggregation because code reuse is the best achievement by aggregation.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

1.5 Composition

The composition may be a special case of aggregation that's a restricted aggregation referred to as
composition. If the associate object contains another object and the contained object cannot exist while not
the existence of an instrumentation object.

It represents part-of relationship and during this, each entities square measure counting on one another.

Figure 11 Example diagram of Composition [ CITATION Kan19 \l 1033 ]

Generalization

It is a method of exacting shared characteristics from 2 or additional categories and mixing them into a
generalized super category. Generalization is additionally referred to as a “Is A Relationship”.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 12 Example of diagram Generalization [ CITATION tut4 \l 1033 ]

Associative

It is a relationship between 2 objects and it defines the multiplicity between objects.

One to One, several to 1, several to several, and several to 1 of these relationships square measure
associations between objects.

An aggregation may be a special sort of association and composition may be a special sort of aggregation.

Figure 13 Examples diagram of Associative

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

1.6 Inheritance

Inheritance in Java may be a mechanism during which one object acquires all the properties and
behaviors of a parent object. it's a vital part of OOPs (Object adjusted programming systems). The
idea behind inheritance in Java is that you simply will generate new categories that square measure
designed upon enduring categories. after you inherit from the associate existing category, you'll
utilize strategies and fields of the parent category.
Moreover, you'll add new strategies and fields in your current category conjointly. Inheritance
represents the ISA relationship that is additionally called a parent-child relationship.

Figure 14 Inheritance

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 15 Inheritance Diagram [ CITATION Dal \l 1033 ]

Figure 16

1.7 Message

Message Passing in terms of computers is communication between processes. it's a sort of communication
employed in object-oriented programming furthermore as parallel programming. Message passing in Java is
like a causation associate object i.e. message from one thread to a different thread. it's used once threads
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

don't have shared memory and square measure unable to share monitors or semaphores or the other shared
variables to speak.

Figure 17 Message Passing

Figure 18 Message Passing Diagram [ CITATION pan \l 1033 ]

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

1.8 Polymorphism

1. Polymorphism is the ability of associate objects to require several forms. the foremost common
use of polymorphism in OOP happens once a parent category reference is employed to check
with a toddler category object.

2. Any Java object which will pass quite one IS-A take a look at is taken into account to be
polymorphic. In Java, all Java objects square measure polymorphic since any object can pass the
IS-A take look-at for its kind and therefore the category Object.

3. It's necessary to grasp that the solely attainable thanks to access associate objects is thru a
reference variable. A reference variable is of just one kind. Once declared, the kind of reference
variable can not be modified.

4. The reference variable is reassigned to alternative objects as long as it's not declared final.

The type of the reference variable would verify the strategies that it will invoke on the item.

A reference variable will check with any object of its declared kind or any subtype of its declared
kind. A reference variable is declared as a category or interface kind (Anon., 2022)
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Figure 19 Polymorphism ex

1.9 Determine a design pattern from each of the creational, structural and behavioral
patterns

A style pattern may be a resolution approach to a general downside, It ought to be associated with business
customary while not language-dependent package engineering, a style pattern may be a usual repeatable
resolution to a typically occurring downside in package style. A style pattern isn’t a finished style that will
be modified directly into code. it's an illustration or template for the way to unravel a drag which will be
used in many alternative things. There square measure 3 varieties of style patterns and their subtypes.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 20 Design Patterns

1 Creational Patterns

Creational Patterns execute and support the creation of objects. It all concerns the category of mental
representation. This pattern is partitioned into class-creation patterns and object-creational patterns. category
creational patterns use inheritance with efficiency within the mental representation method whereas object-
creation categories use delegation with efficiency to urge the task completed. a number of its patterns
include:

1. Singleton
In the Singleton pattern, solely one instance of a category is formed and enforced with international access
thereto object.

2. Manufacturing plant methodology


Creates instances of assorted families of categories while not exposing mental representation logic to the
shopper Abstract manufacturing plant
Offers an associate interface for generating a family of dependent objects while not processing their concrete
category.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

3. Builder
It Lets subclasses verify that category to instantiate and provides higher management over the development
method. It facilitates additional decipherable object creation and lets the U.S. offer the fields that square
measure expressly needed.

4. Prototype
Uses the cloning methodology to duplicate enduring instances to be used as a paradigm instance for making
new objects. This methodology is applied once the new instance is effective to form and therefore the
needed objects square measure the same as actual objects.

Figure 21 9creational design pattern [ CITATION Tel19 \l 1033 ]

2 Structural Patterns:

Structural Patterns advance to define relationships between objects. Some of its patterns include:

1. Adapter
Works between 2 freelance and incompatible interfaces by reworking the interface into another interface
shopper expect.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

2. Bridge
Represent part-whole hierarchies by composing objects into tree structures. Individual objects and therefore
the composition of objects square measure handled uniformly by the shopper in Bridge.

3. Composite
Treats a bunch of objects as one object. used in tree-like structures wherever the parent node depends on the
kid node.

4. Decorator
The Decorator pattern supports inserting practicality into the associated objects dynamically throughout the
run time.

5. Flyweight
A flyweight pattern is dead if variant objects from one category got to be made wherever the objects square
measure distributed to limit memory overload.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

6. Proxy
In a Proxy pattern, the associate object may be a proxy to one thing else and might regulate it. It permits the
creation and access of something sort of a massive object in memory, file, or alternative resources.

Figure 22 Structural Design Pattern [ CITATION sta1 \l 1033 ]

3. Behavioral Patterns:
Behavioral patterns determine the behavior of the objects. It is involved with the communication
between objects. Some of its patterns include:
1. Chain of responsibility: This pattern illustrates the way for passing requests between a
series of objects.
2. Command: during this pattern, the associate object is employed for encapsulating each
piece of knowledge claimed for playacting associate action or triggering events within the
future.
3. Interpreter: The interpreter pattern specifies an illustration of descriptive linguistics
providing a way to include language attributes within the program.

4. Mediator: Pattern for ascertaining cooperation and communication between categories.


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

5. State: modification associate object's behavior once its state transitions.


6. Memento: This pattern is needed once a particular state of the associate object needs to be
saved for later usage.

7. State: State pattern permits the item to change the inner behavior once the state transitions.
8. Visitor: The visitor pattern enables the developer to add one or more operations in an object
during the run time.

Figure 23 Behavioral design pattern [ CITATION dat2 \l 1033 ]

Chapter 02

Design an in-depth UML category diagram for the Family aid system. Your answer ought to
demonstrate all 3 inter-class relationships, particularly Association, Inheritance, and
Aggregation/composition. The categories ought to embody attributes and strategies. (LO 2)

2.1 UML Class Diagram


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Class Diagram offers the static read of associate application. a category diagram describes the
kinds of objects within the system and also the different kinds of relationships that exist among
them. This modeling technique will run with the majority of Object-Oriented strategies. will seek
advice from another class. a category will have its objects or could inherit from alternative
categories.

UML category Diagram offers a summary of a code by displaying categories, attributes, operations,
and relationships. This Diagram includes the category name, attributes, and operation in separate
selected compartments.

Class Diagram helps construct the code for the computer code application development.

Benefits of sophistication Diagram

1. Category Diagram Illustrates knowledge models for even complicated info systems

2. It provides a summary of how the application is structured before finding out the
particular code. this may simply cut back the upkeep time

3. It helps for a much better understanding of the overall schematics of associate


applications.

4. Permits drawing elaborate charts that highlight code needed to be programmed

5. Useful for developers and alternative stakeholders.

Essential parts of A UML category diagram

1. Class Name

2. Attributes

3. Operations

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

2.1.1 Association

This kind of relationship represents static relationships between categories A and B. For example; a
Doctor works for a Hospital

Here are some rules for Association:

1. Association is generally a verb or a predicate or a noun or phrase.

2. It ought to be named to point the role vie by the category connected at the tip of the
association path.

3. obligatory for reflexive associations

In this example, the connection between doctors and normal Dentists is shown may be a study.

Figure 24 Association Class Diagram[ CITATION sta19 \l 1033 ]

2.1.2 Generalization (Inheritance)

Inheritance is a very important pillar of OOP(Object bound Programming). it's the mechanism in
java in that one category is allowed to inherit the features(fields and methods) of another category.

Important terminology:
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Super Class: whose options are inheritable is thought of as a superclass(or a base class or a parent
class).

Sub Class: that inherits the opposite category is thought of as a subclass(or a derived class,
extended category, or kid class). The taxonomic group will add its fields and strategies in added to
the taxonomic category fields and strategies.

Reusability: Inheritance supports the conception of “reusability”, i.e. after we need to make a brand
new category and there's already a category that features a number of the code that we would like
we can derive our new category from the prevailing category. By doing this, we tend are reusing
the fields and strategies of the prevailing category.

Dentist

Ordinary dentists Consultants Dentist

Figure 25 Generalization Class Diagram

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

2.1.3 Aggregation

Aggregation may be a special sort of association that models a whole-part relationship between a
mixture and its components.

For example, a category Hospital is created of one or additional Doctors. In aggregation, the
contained categories are ne'er completely addicted to the lifecycle of the instrumentality. Here, the
Hospital category can stay though the Doctors don't seem to be on the market.

Patients Hospital

Figure 26 Aggregation Class Diagram

2.1.4 Composition

The composition may be a special sort of aggregation that denotes robust possession between 2
categories once one category may be a part of another category.

For example, if Hospital has composed of categories of Doctors. The Hospital might contain
several Doctors, whereas every doctor belongs to just one Hospital. So, if the Hospital isn't
functioning all the Doctors also are removed.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Room Hospital

Figure 27 Composition Class Diagram

2.2 FDC UML Class Diagram

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 28 UML Class diagrams [ CITATION dia22 \l 1033 ]

UML Class Diagram Explain

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Attributes Class
Aggregation

Composition

Generalization

Operation
Association

Figure 29 Class Diagram Explain

2.3 Implementation of FDC Class Diagram

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

package Code;

public class FamilyDentalCare {

static String name = "Family Dental Care";


static String address ="kandy";
static String phone= "072838399";

public static void main(String[] args) {

System.out.println("----------------Welcome to FDC ---------------");

System.out.println(name);
System.out.println("Address- "+address);
System.out.println("Tele- "+phone);
System.out.println();
System.out.println();
System.out.println();
Receptionist r1 = new Receptionist();
r1.createAppointment();

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

/* *
* @Dulithramanayake
*/
package Code;

public class Staff {

private String empCat;


private String id;
private String name;
private String address;
private int age;
private String nic;
private int contact;
private double basicsalary;

public String getEmpCat() {


return empCat;
}

public void setEmpCat(String empCat) {


this.empCat = empCat;
}

public String getId() {


return id;
}

public void setId(String id) {


this.id = id;
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public String getAddress() {


return address;

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

public void setAddress(String address) {


this.address = address;
}

public int getAge() {


return age;
}

public void setAge(int age) {


this.age = age;
}

public String getNic() {


return nic;
}

public void setNic(String nic) {


this.nic = nic;
}

public int getContact() {


return contact;
}

public void setContact(int contact) {


this.contact = contact;
}

public double getSalary() {


return basicsalary;
}

public void setSalary(double salary) {


this.basicsalary = salary;
}

public void setDetails() {

System.out.println("has to work hard");

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

public static void main(String[] args) {

Manager Class

/*
*
* @Dulithramanayake
*/
package Code;

public class Manager extends Staff {

public void managing() {

public static void main(String[] args) {

Nurse manager = new Nurse();

manager.setEmpCat("Manager");
manager.setName("Dulith");
manager.setAge(18);
manager.setAddress("Kuliyapitiya Embawa");
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

manager.setId("88972");
manager.setContact(762755725);
manager.setNic("36502686");
manager.setSalary(115000.00);
manager.setDetails();

System.out.println("_____________ Family Dental Care Hospital_______________");


System.out.println("*"+manager.getName() +"Details *");
System.out.println("* Address:" +manager.getAddress()+ "*");
System.out.println("* Age:" +manager.getAge()+ "*");
System.out.println("* ID" +manager.getId()+ "*");
System.out.println("*Contact No:" +manager.getId()+ "*");

System.out.println("*NIC:" +manager.getNic()+"*");

System.out.println("*Basic Salary:" +manager.getSalary()+ "*");


}

/*
*
* @Dulithramanayake
*/
package Code;

public class Nurse extends Staff {

double allowance;
int workhours;

public double getAllowance() {


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

return allowance;
}

public void setAllowance(double allowance) {


this.allowance = allowance;
}

public int getWorkhours() {


return workhours;
}

public void setWorkhours(int workhours) {


this.workhours = workhours;
}

public void nursing() {

public static void main(String[] args) {

Nurse nurse1 = new Nurse();

nurse1.setEmpCat("Nurse");
nurse1.setName("Dulith");
nurse1.setAge(18);
nurse1.setAddress("Kuliyapitiya Embawa");
nurse1.setId("88972");
nurse1.setContact(762755725);
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

nurse1.setNic("36502686");
nurse1.setSalary(45000.00);
nurse1.setDetails();

nurse1.setAllowance(22000);
nurse1.setWorkhours(8);

Rooms room1 =new Rooms();

room1.setActivation("Active");
room1.setNumberofBed(2);
room1.setRoomNo(1);

System.out.println("_____________ Family Dental Care Hospital_______________");


System.out.println("*"+nurse1.getName() +"Details *");
System.out.println("* Address:" +nurse1.getAddress()+ "*");
System.out.println("* Age:" +nurse1.getAge()+ "*");
System.out.println("* ID" +nurse1.getId()+ "*");
System.out.println("*Contact No:" +nurse1.getId()+ "*");

System.out.println("*NIC:" +nurse1.getNic()+"*");

System.out.println("*Basic Salary:" +nurse1.getSalary()+ "*");


System.out.println("*Allowances:");
System.out.println("*Working in No:" +room1.getRoomNo()+ " Room*");
System.out.println("____________________________________________________________");

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

/*
*
* @Dulithramanayake
*/

package Code;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;

import javax.swing.text.html.HTMLDocument.Iterator;

public class Receptionist extends Staff {

public void createAppointment() {

Collection<Patients> c = new ArrayList<Patients>();


Scanner s = new Scanner(System.in);
Scanner string = new Scanner(System.in);
int ch;

do {
System.out.println("1. Register Patient");
System.out.println("2. Create Appointment");

ch=s.nextInt();

switch (ch) {
case 1:
System. out.print("Enter Patient ID : ");
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

int id = s.nextInt();

System.out.print("Enter Patient Name : ");


String name = sstring.nextLine();

System.out.print("Enter Patient Address : ");


String address = sstring.nextLine();

System.out.print("Enter Patient Age : ");


int age = s.nextInt();

System.out.print("Enter Patient NIC : ");


String nic = sstring.nextLine();

System.out.print("Enter Patient Contact : ");


int contact = s.nextInt();

c.add(new Patients (id, name, address, age, nic, contact)); //new object will be added to the
collection
break;

case 2:
System.out.println("_________________________________________________________");
System.out.println(c);

break;

case 3:

} while (ch!=0);

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

public void genarateBill() {

public static void main(String[] args) {

package Code;

public class Appointment {

public String appoid;


public String appodate;
public String appotime;

public String getAppoid() {


return appoid;
}

public void setAppoid(String appoid) {


this.appoid = appoid;
}

public String getAppodate() {


return appodate;
}
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

public void setAppodate(String appodate) {


this.appodate = appodate;
}

public String getAppotime() {


return appotime;
}

public void setAppotime(String appotime) {


this.appotime = appotime;
}

public static void setappointment() {

System.out.println("----------------Patient Appointed------------------");
}

public static void main(String[] args) {

Receptionist r1 = new Receptionist();


r1.createAppointment();
setappointment();

package Code;

public class Dentists {

private String name;


private String address;
private int age;
private String nic;
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

private int contact;


private String Role;
private double salary;

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public String getAddress() {


return address;
}

public void setAddress(String address) {


this.address = address;
}

public int getAge() {


return age;
}

public void setAge(int age) {


this.age = age;
}

public String getNic() {


return nic;
}

public void setNic(String nic) {


this.nic = nic;
}

public int getContact() {


return contact;
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

public void setContact(int contact) {


this.contact = contact;
}

public String getRole() {


return Role;
}

public void setRole(String role) {


Role = role;
}

public double getSalary() {


return salary;
}

public void setSalary(double salary) {


this.salary = salary;
}

public void register() {

public void OperateScanner() {

}
public static void main (String args []) {
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

/*
*
* @Dulithramanayake
*/
package Code;

public class ConsultentDentists extends Dentists {


String qualification;

public String getQualification() {


return qualification;
}

public void setQualification(String qualification) {


this.qualification = qualification;
}

public static void main(String[] args) {

ConsultentDentists cddoc1 = new ConsultentDentists();


cddoc1.setName("Dulith");
cddoc1.setAge(18);

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

cddoc1.setNic("26502686");
cddoc1.setAddress("Kuliyapitiya Embawa ");
cddoc1.setContact(762755725);
cddoc1.setSalary(125000);
cddoc1.setRole("Consultant Dentist and Dental Scanner Operator");

cddoc1.setQualification("BSc Hons,Phd in Dental Science");

System.out.println("_____________ Family Dental Care Hospital_______________");

System.out.println("");
System.out.println("");
System.out.println("*Doctor " +cddoc1.getName() +" Details *");
System.out.println("* Address: " +cddoc1.getAddress()+ "*");
System.out.println("* Age: " +cddoc1.getAge()+ "*");
System.out.println("* ID " +cddoc1.getNic()+ "*");
System.out.println("*Contact No: " +cddoc1.getContact()+ "*");

System.out.println("*Basic Salary: " +cddoc1.getSalary()+ "*");


System.out.println("*Qualifiacation: " +cddoc1.getQualification()+ "");
System.out.println("*Doctor Role: " +cddoc1.getRole()+ "");

System.out.println("___________________________________________________________");

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

/*
*
* @Dulithramanayake
*/
package Code;

public class OrdinaryDentists extends Dentists {

String experiance;

public String getExperiance() {


return experiance;
}

public void setExperiance(String experiance) {


this.experiance = experiance;
}

public static void main(String[] args) {


OrdinaryDentists orddoc1 = new OrdinaryDentists();

orddoc1.setName("Dulith");
orddoc1.setAge(18);
orddoc1.setNic("86502686");
orddoc1.setAddress("Kuliyapitiya Embawa ");
orddoc1.setContact(762755725);
orddoc1.setSalary(125000);
orddoc1.setRole("Consultant Dentist and Dental Scanner Operator");
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

orddoc1.setExperiance("10 Years");

System.out.println("_____________ Family Dental Care Hospital_______________");

System.out.println("");
System.out.println("");
System.out.println("*Doctor " +orddoc1.getName() +" Details *");
System.out.println("* Address: " +orddoc1.getAddress()+ "*");
System.out.println("* Age: " +orddoc1.getAge()+ "*");
System.out.println("* ID " +orddoc1.getNic()+ "*");
System.out.println("*Contact No: " +orddoc1.getContact()+ "*");

System.out.println("*Basic Salary: " +orddoc1.getSalary()+ "*");


System.out.println("*Qualifiacation: " +orddoc1.getExperiance()+ "");
System.out.println("*Doctor Role: " +orddoc1.getRole()+ "");

System.out.println("___________________________________________________________");
}

/*
*
* @Dulithramanayake
*/
package Code;

public class Patients {

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

private int id;


private String name ;
private String address;
private int age ;
private String nic ;
private int contact;

public Patients(int id,String name,String address,int age ,String nic,int contact) {

this.id=id;
this.name=name;
this.address=address;
this.age=age;
this.nic=nic;
this.contact=contact;
}

public int getId() {


return id;
}

public String getName() {


return name;
}

public String getAddress() {


return address;
}

public int getAge() {


return age;
}

public String getNic() {


return nic;
}

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

public int getContact() {


return contact;
}

public String toString() {


return id+ " " +name+ " " +address+ " " +age+ " " +nic+ " " +contact;
}

public void register() {

System.out.println("Thank You for Registeringto FDC");

/*
*
* @Dulithramanayake
*/

package Code;

public abstract class Treatments {

abstract void printcost();

public static void main(String[] args) {

Treatments nf = new Nervefillings("Nervefillings Treatment costs 3000.00");

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Treatments mfs= new Maxillofacialsurgeries("Maxillofacialsurgeries cost 10000.00");

Treatments tet= new Toothextractions("Toothextractions Treatment costs 2000.00");

Treatments sdit = new SDimplants ("SDimplants Surgury costs 25000.00");

nf.printcost();
mfs.printcost();
tet.printcost();
sdit.printcost();

/*
*
* @Dulithramanayake
*/
package Code;

public class Toothextractions extends Treatments{


Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

String status;

public Toothextractions(String s) {

status = s;

public void printcost() {

System.out.println("--------Toothextractions Treatment-------");
System.out.println();

System.out.println(status);
System.out.println("________________________________________");
}

/*
*
* @Dulithramanayake
*/
package Code;

public class SDimplants extends Treatments{

String status;

public SDimplants(String s) {

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

status = s;

public void printcost() {

System.out.println("--------SDimplants Treatment-------");
System.out.println();

System.out.println(status);
System.out.println("________________________________________");

/*
*
* @Dulithramanayake
*/
package Code;

public class Maxillofacialsurgeries extends Treatments{

String status;

public Maxillofacialsurgeries(String s) {

status = s;

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

public void printcost() {

System.out.println("--------Maxillofacialsurgeries Treatment-------");
System.out.println();

System.out.println(status);
System.out.println("________________________________________");

/*
*
* @Dulithramanayake
*/
package Code;

public class Nervefillings extends Treatments{

String status;

public Nervefillings (String s) {

status = s;

public void printcost() {

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

System.out.println("--------Nervefillings Treatment-------");
System.out.println();

System.out.println(status);
System.out.println("________________________________________");

/*
*
* @Dulithramanayake
*/
package Code;

public class Rooms {


int roomNo;
int numberofBed;
String activation;

public int getRoomNo() {


return roomNo;
}
public void setRoomNo(int roomNo) {
this.roomNo = roomNo;
}
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

public int getNumberofBed() {


return numberofBed;
}
public void setNumberofBed(int numberofBed) {
this.numberofBed = numberofBed;
}
public String getActivation() {
return activation;
}
public void setActivation(String activation) {
this.activation = activation;
}

public static void main(String[] args) {

Rooms room1 = new Rooms();


room1.setActivation("Active with a nurse");
room1.setNumberofBed(2);
room1.setRoomNo(1);

Nurse nurse1 = new Nurse();


nurse1.setName("Dushani");

System.out.println("_____________ Family Dental Care Hospital_______________");

System.out.println("Room No: " +room1.getRoomNo());

System.out.println("Room No of Bed: " +room1.getNumberofBed());


System.out.println("Room Activation: " +room1.getActivation());
System.out.println("Room NO " +room1.getRoomNo()+ "Active Nurse : " +nurse1.getName()+ "" );

System.out.println("____________________________________________________________");

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

package Code;

public class ScanRoom extends Rooms {

public void scaning() {

package Code;

public class SurgeryRooms extends Rooms {

public void surgery() {

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

/*
* Dulithramanayake
*/

package Code;

public class Scanner {

private String name, serialno, brand, origin;


private double cost;
private static int count=0;

private Scanner(String name, String serialNo, String brand, String origin, double cost) {

this.name=name;
this.serialno= serialNo;
this.brand = brand;
this.origin = origin;
this.cost = cost;
}
public void setDetails() {

System.out.println("Name: " +name);


System.out.println("Serial NO: " +serialno);
System.out.println("Brand: " + brand);
System.out.println("Origin: " +origin);
System.out.println("Cost: " +cost);

public static Scanner getScanner(String name, String serialno, String brand, String origin, double cost) {
if(count ==1) {
System.out.println("Dental Scanner is already created!");
return null;
}else {
Scanner ds1instance = new Scanner(name,serialno, brand,origin, cost);
count++;
return ds1instance;
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

/*
*
* @Dulithramanayake
*/

package Code;

import java.io.BufferedReader;
import java.io.IOException;

import java.io.InputStreamReader;

public class ScannerMain {

public static void main(String[] args) throws IOException{


BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String name, serialno, brand, origin;


int cost;

System.out.println("Enter Device Name: " );


name = br.readLine();

System.out.println("Enter Serial No: " );


serialno = br.readLine();

System.out.println("Enter Brand: " );


brand = br.readLine();

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

System.out.println("Enter Origin: " );


origin = br.readLine();

System.out.println("Enter Device Cost: " );


cost = br.read();

Scanner ds1 = Scanner.getScanner(name, serialno, brand, origin, cost);


ds1.setDetails();

//if tried d second time

Scanner ds2 = Scanner.getScanner(name, serialno, brand, origin, cost);


ds1.setDetails();

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Chapter 03

Determine and shortly discuss the variety of style patterns and describe a minimum of one
style pattern from the 3 on the market kinds of style patterns. offer appropriate UML
diagrams for the given patterns and analyze the connection between object-oriented
paradigms and style patterns by providing an appropriate example.

3.1 Design Patterns

A style pattern provides a general reusable answer for the common issues that occur in computer
code style. The patterns usually show relationships and interactions between categories or objects.
the concept is to hurry up the event method by providing well tested, well-tried
development/design paradigm. style patterns are programming language-independent ways of
determining a typical downside. which means a style pattern represents a thought, not a selected
implementation. By victimization the planning patterns you'll be able to build your code additional
versatile, reusable, and rectifiable.
It’s not obligatory to implement style patterns during a project continuously. style patterns don't
seem to be meant for project development. style patterns are meant for common problem-solving.
Whenever there's a requirement, you have got to implement an appropriate pattern to avoid such
issues in the future. seek out that pattern to use. you only have to be compelled to attempt to
perceive the planning patterns and their functions. solely by then, you'll be ready to choose the
correct one.

Design patterns are applied to stipulate a number of the simplest practices adopted by older object-
oriented computer code developers. A style pattern orderly titles drives and explains a general style
that inscribes a continual style downside in object-oriented systems. It illustrates the matter, the
explication, once to implement the answer and its importance.

3.1.1 Creational

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

These style patterns all concerned the category of mental representation or object creation. These patterns
are classified into Class-creational patterns and object-creational patterns. whereas category-creation
patterns use inheritance effectively within the mental representation method, object-creation patterns use
delegation effectively to urge the work done.

Creational style patterns are the industrial plant technique, Abstract industrial plant, Builder, Singleton,
Object Pool, and paradigm.

3.1.1 Use case of creational design pattern-

Suppose a developer needs to make an easy DBConnection category to attach to info and desires to access
the info at multiple locations from code, typically what the developer can do is produce an associate instance
of the DBConnection category and use it for doing info operations where needed. This ends up in making
multiple affiliations from the info as every instance of the DBConnection category can have a separate
connection to the info. To upset it, we tend to produce the DBConnection category as a singleton category,
so that just one instance of DBConnection is formed and one affiliation is established. as a result we can
manage dB affiliation via one instance thus, we can manage load balance, gratuitous connections, etc.

Suppose you would like to make multiple instances of an analogous kind and need to attain loose coupling
then you'll be able to choose an industrial plant pattern. a category implementing an industrial plant style
pattern works as a bridge between multiple categories. contemplate the associate example of victimization of
multiple info servers like SQL Server and Oracle. If you're developing associate application victimization
SQL Server info because of the back side, however within the future got to modifier the info to the oracle,
you'll get to modify all of your code, thus as industrial plant style patterns maintain loose coupling and
simple implementation we must always choose the industrial plant for achieving loose coupling and creation
of comparable quite object.

3.1.1.1 Structural

These style patterns are concerned with organizing different categories and objects to make larger structures
and supply new practicality.

Structural style patterns are Adapter, Bridge, Composite, Decorator, Facade, Flyweight, non-public category
knowledge, and Proxy.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

3.1.1.2 Use Case of Structural Design Pattern-

The templet pattern defines the skeleton of the associate formula in associate operation deferring some steps
to sub-classes, The templet technique lets subclasses redefine sure steps of the associate formula while not
dynamic the formula structure. say as an example in your project you would like the behavior of the module
to be extended, specified we can build the module to behave in new and other ways because of the needs of
the applying modification or to fulfill the wants of the latest applications. However, nobody is allowed to
create ASCII text file changes thereto. it means that add however can’t modify the structure in those
eventualities a developer can approach templet style patterns.

3.1.1.3 Behavioral

Behavioral patterns are concerning distinctive common communication patterns between objects and
realizing these patterns.

Behavioral patterns are Chain of responsibility, Command, Interpreter, Iterator, Mediator,

Memento, Null Object, Observer, State, Strategy, templet technique, Visitor

3.1.1.3.1 Use Case of Behavioral Design Pattern-

The templet pattern defines the skeleton of the associate formula in associate operation deferring some steps
to sub-classes, The templet technique lets subclasses redefine sure steps of the associate formula while not
dynamic the formula structure. say as an example in your project you would like the behavior of the module
to be extended, specified we can build the module to behave in new and other ways because of the needs of
the applying modification or to fulfill the wants of the latest applications. However, nobody is allowed to
create ASCII text file changes thereto. it means that add however can’t modify the structure in those
eventualities a developer can approach templet style patterns.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

3.1.3 Benefits of Design Patterns

Design patterns have 2 major advantages. First, they supply you with a way to unravel problems associated
with computer code development by employing a well-tried answer. the answer facilitates the event of
extremely cohesive modules with minimal coupling. They isolate the variability that will exist within the
system's needs, creating the system easier to grasp and maintain. Second, style patterns build
communication between designers additionally economically. computer code professionals will forthwith
image the high-level style in their heads once they seek advice from the name of the pattern wont to solve a
selected issue once discussing system style.

3.1.3 Structure of a Design Pattern

Design pattern documentation is very structured. The patterns are documented from a template that identifies
the data required to grasp the computer code downside and also the answer in terms of the relationships
between the categories and objects necessary to implement the answer. there's no uniform agreement at
intervals between the planning pattern community on a way to describe a pattern templet. authors like
different designs for their pattern templates. Some authors be more communicatory and less structured,
whereas others like their pattern template to be additional precise and have high grain in structure. we'll use
the templet 1st delineated by the authors of style Patterns as an instance of a templeate

Term Describes

Pattern Name Describes the essence of the pattern in a short, but expressive, name

Intent Describes what the pattern does

Also Known As List any synonyms for the pattern

Motivation Provides an example of a problem and how the pattern solves that problem

Applicability Lists the situations where the pattern is applicable

Structure Set of diagrams of the classes and objects that depict the pattern

Participants Describe the classes and objects that participate in the design pattern and their
responsibilities

Collaborations Describe how the participants collaborate to carry out their responsibilities
Table 1 Structure of a Design Pattern

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

3.1.4 Design patterns are useful to computer programmers

A style pattern may be a common style answer to a typical style downside. a group of style patterns for a
connected field or domain is termed a pattern language. Note that there also are patterns at alternative levels:
code, concurrency, design, interaction style …

In computer code engineering, a computer code style pattern may be a general reusable answer to an
ordinarily occurring downside at intervals in a given context in computer code style. it's not a finished style
that will be remodeled directly into a supply or computer code. it's an outline or template for a way to
unravel a tangle that will be utilized in many alternative things. style patterns are formalized best practices
that the computer programmer will use to unravel common issues once coming up with an associated
application or system.

Object-oriented style patterns usually show relationships and interactions between categories or objects,
while not specifying the ultimate application categories or objects that square measure concerned. Patterns
that imply changeable states could also be incompatible with purposeful programming languages, some
patterns may be rendered spare in languages that have constitutional support for resolving the matter they're
making an attempt to unravel, and object-oriented patterns don't seem to be essentially appropriate for non-
object-oriented languages.

Design patterns could also be viewed as a structured approach to programming intermediate between the
amount of a programming paradigm and a concrete algorithmic program..

3.2 Singleton Design Pattern

In Java, the Singleton pattern will ensure that there is only one instance of a class is created in the
Java Virtual Machine. It is used to provide a global point of access to the object. In terms of

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

practical use, Singleton patterns are used in logging, caches, thread pools, configuration settings,
and device driver objects.

Figure 30 Singleton Class Diagram [ CITATION tut5 \l


1033 ]

Figure 31 Singleton Class Diagram [ CITATION tut5 \l


1033 ]

3.2.1 Coding Snapshot

Figure 32 Singleton Code ex


Downloaded by peter hakam (hakammohamed12345@gmail.com)
Figure 33 Singleton Code ex
lOMoARcPSD|15607169

3.3 Factory Design Pattern


Factory pattern is one of the foremost used style patterns in Java. this sort of style pattern comes beneath a
creational pattern as this pattern provides one of the most effective ways to make associated objects.

In the plant pattern, we tend to produce associate objects while not exposing the creation logic to the
shopper and talking over the newly created object employing a common interface.

Figure 34 Factory coding ex

Figure 35 Factory coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

3.5 Prototype Pattern

Prototype Pattern says that biological research associate actual object rather than making a brand
new one that may be tailor-made as per the need. This pattern ought to be followed if the value of
generating a brand-new object is pricey and resource-intensive.

3.5.1 Advantages of Prototype Pattern

 The main blessings of the model pattern square measure as follows:


 It diminishes the requirement for sub-classing.
 It obscures the complexities of making objects.
 The shoppers will get new objects while not understanding which sort of
object they're going to be.
 It permits you to add or exclude objects at runtime.

Figure 36 Factory UML diagram [ CITATION com \l 1033 ]

Figure 37 Factory UML diagram [ CITATION com \l 1033 ]

3.5.2 Usage of Prototype Pattern

 When the categories square measure initiated at runtime.


 When the value of generating associate object is pricey or sophisticated.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

 When you would like to stay the number of categories in the associate
application at a minimum.
 When the shopper application has to be oblivious to object creation and
illustration.

3.6 Structural design patterns

Structural style patterns square measure regarded with however categories and objects may be
composed, to make larger structures. The structural style patterns analyze the structure by
recognizing the relationships.

3.6.1 Types of structural design patterns

3.6.1.1 Adapter Pattern

An Adapter Pattern says that simply "convert the interface of a category into another interface that a
shopper requires" .In alternative words, to implement the interface in keeping with shopper necessities

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

whereas mistreatment of the services of a category with a distinct interface. The Adapter Pattern is
additionally recognized as Wrapper.

Advantages of Adapter Pattern


 It allows 2 or additional antecedently incompatible objects to move.

 It provides the reusability of existing practicality.

Usage of Adapter pattern:


It is applied:

 When an associate object needs to use an associate existent category with the associate
incompatible interface.
 When you would like to create a reusable category that assists with categories that do not
have compatible interfaces.
 When you would like to get a reusable category that supports categories that do not have
compatible interfaces.

UML for Adapter Pattern


There are certain specifications for the adapter pattern:

 Target Interface: this can be the invited interface category that may be used by the shoppers.
 Adapter category: This category may be a wrapper category that implements the required target
interface and changes the particular request accessible from the Adapter class.
 Adapter category: this can be the category that's used by the Adapter class to employ the present
practicality and alter them for the required use.
 Client: This category can communicate with the Adapter category.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 38 Adapter UML [CITATION www2212 \l 1033 ]

Figure 39 Adapter UML [CITATION www2212 \l 1033 ]

3.6.1.2 Bridge Pattern

A Bridge Pattern states that simply "decouple the purposeful abstraction from the
implementation so that the 2 will diversify autonomously".The Bridge Pattern is additionally
acknowledged as a Handle or Body.

Advantages of Bridge Pattern


 It facilitates the detachment of implementation from the interface.
 It develops extensibility.
 It allows the concealment of implementation specifications from the shopper.

Usage of Bridge Pattern


 When you do not need a stable binding between the purposeful abstraction and its
implementation.
 When each purposeful abstraction and its implementation square measure needed to
elongate mistreatment sub-classes.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

 It is usually employed in those places wherever changes square measure created within the
implementation that doesn't influence the shoppers.

Figure 40 Bridge UML [CITATION www211 \l 1033 ]

Figure 41 Bridge UML [CITATION www211 \l 1033 ]

3.6.1.3 Decorator Pattern

A Decorator Pattern states that simply "connect versatile further charges to associate object
dynamically". In alternative terms, The Decorator Pattern utilizes composition rather than inheritance to
prolong the practicality of the associate objects at runtime. The Decorator Pattern is additionally recognized
as Wrapper.

Advantages of Decorator Pattern

a. It affords exceptional flexibility than static inheritance.


b. It improves the extensibility of the thing as a result of modifications square measure created
by secret writing new categories.
c. It analyzes the secret writing by permitting you to develop a series of practicality from
targeted categories instead of secret writing all of the behavior into the thing. Usage
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

d. When you would like to transparently and dynamically append competencies to things while
not modifying alternative objects.
e. When you would like to connect responsibilities to associate objects that you simply might
want to develop within the future.
f. Elongating practicality by sub-classing isn't any longer sensible

Figure 42 Decorator UML [ CITATION tut6 \l 1033 ]

Figure 43 Decorator UML [ CITATION tut6 \l 1033 ]

3.6.1.4 Façade Pattern

A Facade Pattern says that simply "just implement a unified and simplified interface to a
collection of interfaces in an exceedingly scheme, thus it covers the complexities of the scheme

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

from the client". In alternative words, the Facade Pattern represents a higher-level interface that
creates the scheme more leisurely to use.

Advantages of Facade Pattern


a) It covers the shoppers from the complexities of the sub-system parts.

b) It supports loose coupling between subsystems and their shoppers.

Usage of Facade Pattern:


It is used:

a) When you would like to implement a straightforward interface to a fancy sub-system.


b) When varied dependencies exist between shoppers and also the implementation categories of
associate abstraction.

Figure 44 Facade UML [ CITATION tut7 \l 1033 ]

Figure 45 Facade UML [ CITATION tut7 \l 1033 ]

3.6.1.5 Flyweight pattern

A Flyweight Pattern states that simply "to employ already enduring similar reasonably objects by
accumulating them and generate a brand new object once no matching object is detected".

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Advantages of Flyweight Pattern


a) It lessens the number of objects.
b) It decreases the number of memory and storage devices claimed if the objects
square measure endured

c) When associate application utilizes a variety of objects

d) When the storage price is crucial due to the number of objects. When the application
doesn't rely on object identity.

Figure 46 Flyweight pattern UML [ CITATION tut8 \l 1033 ]

Figure 47 Flyweight pattern UML [ CITATION tut8 \l 1033 ]

3.7 Composite Design Pattern

A composite pattern may be a partitioning style pattern and describes a gaggle of objects that square
measure treated constant means as one instance of the constant style of object. A composite intends to
“compose” objects into tree structures to represent part-whole hierarchies. It permits you to own a tree
structure and raise every node within the tree structure to perform a task.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

As represented by God, “Compose objects into a tree structure to represent part-whole hierarchies.
Composite lets shopper treat individual objects and compositions of objects uniformly”.

When coping with Tree-structured knowledge, programmers typically ought to discriminate between a leaf
node and a branch. This makes code additional advanced, and thus, fallible. is an interface that permits
treating advanced and primitive objects uniformly.

In object-oriented programming, a composite is an associate object designed as a composition of 1 or


additional similar objects, all exhibiting similar practicality. this can be called a “has-a” relationship
between objects.

The key thought is that you simply will manipulate one instance of the thing even as you'd manipulate a
gaggle of them. The operations you'll be able to perform on all the composite objects typically have the
smallest amount of common divisor relationships

The Composite Pattern has four participants:

1. Part – The part declares the interface for objects within the composition and for accessing and
managing its kid parts. It additionally implements default behavior for the interface common
to any or all categories as applicable.

2. Leaf – Leaf defines behavior for primitive objects within the composition. It represents leaf
objects within the composition.

3. Composite – Composite stores kid parts and implements child-related operations within the
part interface.

4. Shopper – The shopper manipulates the objects within the composition through the part
interface.

The shopper uses the part category interface to move with objects within the composition structure. If the
recipient may be a leaf then the request is handled directly. If the recipient may be a composite, then it
always forwards requests to its kid parts, presumably activity further operations before and when
forwarding.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Proxy Pattern

Simply, a proxy indicates an associate object portrayal of another object. in keeping with GoF, a Proxy
Pattern "implements the management for accessing the initial object".So, we can complete several
operations like concealment of the knowledge of the initial object, on-demand loading, etc. A proxy pattern
is additionally called a Surrogate or Placeholder.

Usage of Proxy Pattern:


It is used:

a) It may be employed in a Virtual Proxy state of affairs Considering a state of affairs


wherever there square measure multiple info calls to disengage huge-size pictures. the
$64000 object gets generated only a shopper 1st requests/accesses the thing and
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

subsequently, we can simply talk over with the proxy to employ the thing. This circumvents
duplication of the thing and thence maintains memory.
b) It may be employed in the protecting Proxy situation. It operates as an associate
authorization layer to prove whether or not the particular user has access to the relevant
content or not. for example, a proxy server that has limitations on web access within the
workplace. solely the websites and contents that square measure original are approved and
also the remaining ones are blocked.
c) It may be employed in the Remote Proxy situation. a far-off proxy may be considered
because of the stub within the RPC decision. The remote proxy implements a neighborhood
illustration of the thing that is gifted within completely different address locations. Another
example may be providing an associate interface for remote resources like net service or
REST resources.
d) It may be employed in the good Proxy situation a wise proxy provides a further layer of
security by interposing specific actions once the thing is accessed. as an example, to
envision whether or not the $64000 object is secured or not before accessing it so that no
alternative objects will modification it

Figure 48 Proxy Pattern [ CITATION tut9 \l 1033 ]

Figure 49 Proxy Pattern [ CITATION tut9 \l 1033 ]

3.8 Behavioral Design Patterns

Behavioral is, however, somebody acts i.e., it consists of the tasks that one executes to move in
associated surroundings. In object-oriented software package development, the behavior of various
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

objects determines the connection between them and additionally determines their ability to
perform an exact task.

The ability of associate object-oriented software package applications to accomplish a task depends
upon the interaction of assorted objects and categories. to create an economical object-oriented
software package, we must always follow some tips that describe how completely different objects
and categories send messages to every alternative to form things happen. this can be wherever
activity style Patterns inherit the image. it's a group of templates that revolve around planning the
interaction between objects and categories.

Behavioral patterns follow the principle that the objects in associate object-oriented applications
ought to be interconnected in such a way that tough secret writing may be avoided and also the user
input may be well handled. For this principle, the activity style patterns create the use of loose
coupling techniques to confirm a versatile and effective flow of data.

Loosely coupled object-oriented software package systems square measure those within which the
parts (classes and objects) square measure sapless related to one another. because of this weak
association between the parts, the thing interactions in loosely coupled systems don't seem to be as
effective as that in tightly coupled systems. But, objects in an exceedingly loosely coupled system
square measure additional independent and are reusable as any changes created in one part have the
lowest result on the existence or the performance of another part. [ CITATION Sca \l 1033 ]

3.8 Observer Design Pattern

The observer pattern is employed once there's a one-to-many relationship between objects if one
object is changed, its dependent object's area unit is to be notified mechanically. The observer
pattern falls underneath the behavioral pattern class.

The observer style pattern is beneficial after you Associate in Nursing interest} within the state of
an object and need to urge notified whenever there's any modification. within the observer pattern,
the thing that watches the state of another object is termed the Observer, and therefore the object
that's being watched is termed the topic.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 50 Observer design pattern [ CITATION tut10 \l 1033 ]

Figure 51 Observer Uml

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 52 Observer Coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

3.9 Analyze the relationship between object-oriented paradigm and design patterns
providing a suitable example.

Design patterns define the most effective practices adopted by full-fledged object-oriented software
package developers. style patterns area unit explications of general issues that software package
developers encountered throughout software package development. These solutions were non
heritable by trial and error by varied software package developers over quite a substantial amount.
particularly for any industry-level project, wherever it's traditional to figure with dozens or maybe
many developers; the collaboration method implies that there have to be compelled to be some
standards and rules to create the code additional elegant and convertible to modifications. that's
why we've object-oriented programming (OOP) and software package framework tools. A style
pattern is somewhat corresponding to OOP, however, it goes any by examining changes as a part of
the natural development method. the planning pattern leverages some concepts from OOP, like
abstractions and interfaces, however, concentrates on the method of change.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Relationship between object-oriented paradigm and design pattern

Design patterns area unit supported sensible solutions that are with success enforced over and once more.
style patterns represent a method of transition from analysis/design to design/implementation. A style pattern
is AN abstraction from a concrete continual answer that solves a drag during a bound context

The main relationship between object-oriented paradigms {and style|and style} patterns is that if we wish to
use oop in programming for effective code we'll use design patterns. style patterns facilitate to
implementation of the characteristics of the object-oriented paradigm.

In software package development, the effectiveness and correction of code area units are vital for that
purpose we tend to use style patterns to implement the codes smartly and effectively. Patterns offer solutions
to issues in a neater manner

Design patterns area unit nothing, however {an answer|an answer} to a continual downside and therefore the
solution is strong, scalable, readable, and versatile. they'll exist for different programming paradigms too

Object-Oriented Programming may be a programming methodology or conception of programming that


makes code into objects and relationships of objects. style Patterns would counsel proven-successful ways of
constructing types/objects to unravel an explicit situation during a program. Object-Oriented Programming
(OOP) pattern consists of an outline of many objects and categories in conjunction with the attributes and
dependencies of the category. It conjointly implements the overall purpose of resolving the matter. So,
patterns area unit reusable solutions to usually occurring issues that area unit confronted repeatedly. what is
more, style patterns speed up the event method by providing a tested and evidenced development paradigm.
It became widespread once it came during a kindalized form. For the primary time patterns were publicized
with C++ and Smalltalk code samples. style Patterns will be enforced in any programing language and are
extremely fashionable in Java and C#. Similarly, style patterns implement higher software package
interaction by belongings developers to communicate exploitation of well-understood and illustrious names.
Object-oriented style patterns generally show relationships and interactions between categories or objects,
while not specifying the ultimate application categories or objects that area unit concerned. Patterns that
imply a changeable state could also be mismated for purposeful programming languages. Some patterns will
be rendered reserved in languages that have intrinsical support for determining the matter they're attempting

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

to unravel, and object-oriented patterns don't seem to be essentially appropriate for non-object-oriented
languages.

Design patterns embody some object-oriented ideas, with object arrangements to unravel general software
package development style issues. Implementing style patterns to your style and development can enhance
your object employ and permit for easier program changes.

Reusability and extensibility area unit the centers of the planning pattern, very like different object-oriented
practices. style patterns area unit quite primary information structures like arrays, connected lists, and binary
trees. Like information structures, a style pattern name apprehends a basic plan. in contrast to information
structures, style patterns verify the behavior of teams of objects.

The C# and Java Frameworks area unit is peppered with style patterns and ideas. several of the objects you
use during a framework develop a style pattern. a standard style pattern follow is to incorporate the name of
the pattern being enforced within the name of the thing or object. If you've got used objects during a
framework that incorporated words like a proxy, adapter, iterator, visitor, and command within the name of
the thing, possibly you've got utilized a style pattern. Understanding style patterns can develop your
understanding of the assorted C++, C#, and Java libraries and frameworks.

Aside from supplying you with AN under-the-hood perception of your development tools, applying style
patterns can enhance your software package style, development, and most vital, reusability. style patterns
area unit quite simply specifications for software package style solutions. AN object-oriented approach to
software package development is the foundation for all style patterns. acquiescence the objected-oriented
style approach of style patterns is that the commencement in understanding however style patterns can
enhance your software package development.

Design pattern object-oriented concepts

It's tough to jot down Java or C# while not some perception of object-oriented style and development.
Understanding style patterns entails understanding basic object-oriented ideas. If you've got done
enhancements with Java, C++, or C#, you will be acquainted with the following concepts:

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Decomposition is the method of dividing a drag into shorter items, in different words, divide and conquer.
Break your program into objects, everyone with distinct responsibilities. Reusability is commonly the result
of fine decomposition.
Encapsulation conceals the inner construction of AN object. Objects are units accessed through their
interface. So, for example, encapsulation concedes AN object to vary its internal behavior while not
dynamically the approaching different objects move with it.
Polymorphism provides objects with a standard base category or interfaces to be managed similarly. AN
object "A" will move with object "B" while not being wholly awake to the thing "B's" true kind.
Inheritance is the concept of prolonging the behavior of AN object. Inheritance has 2 forms: a concrete
category ANd an abstract base category or interface inheritance. other than grammar discrepancies, the
fundamental distinction between the 2 styles of inheritance is that the quantity of practicality is dead within
the base category. AN abstract category performs no practicality within the base category, whereas a
concrete category can have some practicality within the base category.
Loosely coupled objects area unit additional freelance of every different instead of subordinate to 1 another.
Loose coupling makes it additionally appears to change AN object with very little understanding of the
larger system during which the thing resides.

Implementing the OO concepts

Utilizing the object-oriented ideas printed higher than, style patterns solve issues by implementing these
ideas in the following ways:

The design pattern philosophy emphasizes that it's additionally obvious to vary or add AN object
implementing AN interface instead of assuming all future practicality of AN object. stress is placed on the
employment of abstract base categories, instead of on inheritance from a concrete base category. For a C#,
VB.NET, or Java developer, this means interface inheritance.

Design patterns facilitate support for easier program changes and object reusability. Loosely coupled objects
area unit additional apparent to employ and alter. Keeping objects little and specialized supports loose
coupling. style patterns area unit engineered with several little specialized objects. purposeful liabilities area
unit postponed to the thing within the system serving the perform that's being utilized. Objects delegate
responsibility to smaller specialized objects. Objects differ slightly in practicality area units comprised of
smaller objects instead of implementing most of the practicality during a common base category.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Design patterns in practice

In software package style, you need to typically ascertain what forms of objects you would like in
your style. Many times, the objects you would like for your answer don't seem to be attainable
within the necessities. If the specifications exhibit AN interaction that's resolved by a style pattern,
you'll implement the pattern.

A design pattern incorporates a list of common objects and a description of how the objects
interrelate. Some common programming dilemmas are outlined below, along with the design
pattern for solving the dilemma. The examples are implemented to give you an idea of the type of
problems design patterns can determine.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Chapter 04

Scenario 1

FDC owns a costly, state-of-the-art dental scan machine (a device so much superior to a standard
dental X-ray machine) factory-made by Toshiba, Japan. FDC is own only one such machine within the
predictable future. once modeling and implementing the FDC system in the software package, you
need to make sure that only 1 instance of that machine is formed. You may embody appropriate
attributes for the machine like serial variety, make, country of origin, and value. Implementation
ought to permit the user to enter details of the dental scanner and build the only real instance of that
machine.8

Figure 53 FDC

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 54 Singleton code Ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Output

Figure 55 Singleton code output

In the higher situation, the learner had enforced the Singleton style pattern. The singleton is taken into
account as one in every one of the kinds that fall underneath the class of creational style pattern. As
expressed within the situation, once implementing the FDC system it's strictly needed to make one instance
of that machine. it's mandated to facilitate the user to input details of the dental scanner which includes
attributes like serial variety, make, country of origin, and cost. The situation merely corresponds to the
singleton style pattern wherever the category is outlined in such a way that only 1 instance of the category is
formed within the complete execution of a program or project.

It is used wherever solely one instance of a category is needed to manage the action throughout the
execution. A singleton category shouldn’t have innumerable instances in any case and at any value. the most
goal of the singleton category is to manage object creation, limiting the number of objects to only 1. The
singleton provides only 1 entry purpose to make the new instance of the category.

Since there's only 1 Singleton instance, any instance fields of a Singleton can happen just once per category,
similar to static fields. Singletons area unit typically helpful once we have to be compelled to manage the
resources, like information connections or sockets.

An implementation of a singleton category for the given situation ought to possess the subsequent
properties:

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

1. It ought to possess only 1 instance: this can be done by implementing AN instance of the
category from at intervals the category. Outer categories or subclasses ought to be restricted
to get the instance. done by creating the creator personal in java so none of the categories
can access the creator and thence cannot instantiate it.

2. The instance ought to be globally accessible: The instance of the singleton category ought
to stay globally accessible so every category will utilize it. In Java, it's performed by
creating the access intellectual of the instance public.

The Singleton may be a style Pattern for allowing only 1 instance of your category, however, common
mistakes will unknowingly permit quite one instance to be created.

Singleton's purpose is to manage object creation, limiting the amount to 1 but providing the flexibility to
make additional objects if true changes. Since there's only 1 Singleton instance, any instance fields of a
Singleton can occur just once per category, similar to static fields.

Singletons typically regulate access to resources like information connections or sockets. as an example, if
you've got a license for less than one association for your information or your JDBC driver has to bother
with multithreading, the Singleton gets positive that only 1 association is created or that only 1 thread will
access the association at a time. If you add information connections or use a JDBC driver that supports
multithreading, the Singleton will be simply changed to supply additional connections.

4.1.1 Advantages of a Singleton pattern:

1. Singleton patterns will be dead interfaces.

2. It will be conjointly inheritable from different categories.

3. It will be lazy-loaded.

4. It's Static data format.

5. It will be prolonged into an industrial plant pattern.

6. It helps thereto cowl dependencies.

7. It implements one purpose of access to a specific instance, thus it's simple to keep up.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Scenario 2

Develop a system to show the main points of all staff and your system ought to show that a worker is
functioning beneath that worker.

4.2.1 UML

Figure 56 Composite UML [ CITATION Com1 \l 1033 ]

Figure 57 Composite UML [ CITATION Com1 \l 1033 ]

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 58 Composite coding ex

Figure 59 Composite coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 60 Composite coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 61 Composite coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 62 Composite coding ex

Figure 63 Composite coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 64 Composite coding ex

Figure 65 Composite coding ex

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Figure 66 Composite coding ex

Figure 67 Composite coding Output

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

In the above scenario, the learner had enforced a composite style pattern since the Composite style
Pattern could be a style pattern that befalls within the class of structural patterns. Such patterns are
involved however categories and objects are organized to create larger structures. Composite
Pattern describes one such approach of building a category hierarchy created from categories for 2
varied styles of objects (composite and primitive). One purpose of code engineering is to manage
high cohesion between modules and therefore the difference to decrease coupling. A composite
style pattern offers a style hierarchy, within which nodes with youngsters disagree with nodes
while not youngsters. The composite style pattern lets the consumer manage individual objects and
compositions uniformly. The core factor to stay in mind is the tree structure when administering
this style pattern.
The solution lies within the composite style pattern. The pattern consists of 2 categories mainly:

1. The part - It provides a layer of abstraction for all categories within the hierarchy.

2. The Composite – The composite contains an assortment of elements that extends the part
category.

Composite style patterns describe teams of objects which will be treated within the same approach as
one instance of constant object sort. The composite pattern permits America to "compose" objects into
tree structures to represent part-whole hierarchies. this can be referred to as a “has-a” relationship
between objects.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Scenario 3

Patients UN agency would like dental scans to be unbroken in a very initial in the initial Out queue.
Assume that you simply have found associate already developed Queue instrumentation in a very code
library. It provides commonplace queue operations to insert and take away knowledge (known as
enqueue and deque respectively). However, you wish some specific operations like search() to seem up
a specific patient and showAll() to list all the patients within the queue. These further operations
aren't provided by the library unit.

For each of the on top of scenarios:

For the on-top of the state of affairs, it's doable to use an associate observer pattern since The
observer pattern illustrates a one-to-many dependency between objects so that once one object
changes state, all of its dependents are notified and updated mechanically. however supported this
on top of the question, the patient's UN agency would like a tooth doctor to scan, their details are
unbroken in a very queue that is figured beneath the (first in first out) principle. It unremarkably
has 2 basic operations enqueue and dequeue. however, during this case, the FDC asks for a few
special forms of operation for specific functions like Search() to seem up a specific patient's details
and show () operations to list all the patients within the queue. To develop these specific
operations, we've to seek out the proper methodology to implement. to resolve this drawback or
challenge we can use the Java Iterator style Pattern. This style pattern provides a mechanism to get
further operations to traverse and access instrumentation objects’ contents while not exposing their
cognitive content. An associate iterator is an associate interface that belongs to a set framework. It
permits to traverse of the gathering, accesses the information component, and removes the
information parts of the gathering. it's conjointly thought of as a Universal iterator as we can apply
it to any assortment object. By exploiting the associate Iterator, we can perform each browse and
take away operation. this can be an associate improved version of Enumeration with the extra
functionalities of the remove-ability of the part. So, exploiting this style pattern we tend to build
our operation to the queue. the subsequent section explains the idea of the Iterator pattern.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

4.3.1 Iterator pattern

The iterator pattern could be an unremarkably used style pattern in Java and .Net programming
environments. This pattern is employed to urge away to access the weather of a set object in a very serial
manner with none got to apprehend its underlying illustration.

The iterator pattern falls beneath the activity pattern class.

Implementation

Figure 68 Iterator pattern Class Diagram [ CITATION res1 \l 1033 ]

Figure 69 Iterator pattern Class Diagram [ CITATION res1 \l 1033 ]

We're progressing to produce an associate Iterator interface that narrates the navigation methodology and an
instrumentation interface that returns the iterator. Concrete categories implementing the instrumentation
interface are going to be accountable to implement the Iterator interface and use it

IteratorPatternDemo, our demo category can use NamesRepository, a concrete category implementation to
print Names keep as a set in NamesRepository.
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

4.3.2 Iterator

An iterator is an associate interface that's utilized in place of Enumerations within the Java assortment
Framework. Moreover, associate iterator differs from the enumerations in 2 ways:

1. The iterator permits the caller to get rid of the given parts from the required assortment throughout
the iteration of the weather.

2. Methodology names are increased.

The iterator interface could be a member connected with Java Collections Framework.

Figure 70 Iterator pattern framework [ CITATION gee224 \l 1033 ]

Methods Description
forEachRemaining(Cons Performs the given action on each of the element umer<? super
E>action) until and unless all the elements have been processed or unless an exception is
thrown by the action.
hasNext() Returns a true value if the more number of elements are encountered during
iteration.
Next() Returns a true value if the more number of elements are encountered during iteration.
Remove() Removes the last element from the collection
Table 2 Iterator pattern Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

4.4 Critically evaluate a range of design patterns against the range of given scenarios
with the justification of your choice.

To put it merely, a style pattern could be an approach for developing code or apps. each style pattern
describes an answer to a particular drawback or set of challenges. Given the variability of situations declared
on top, we would be ready to leverage these style patterns to assist the sight and address those difficulties.
it's troublesome to create object-oriented code, and it's even tougher to provide code that's helpful and
reusable. to provide high-quality code, we tend should determine objects, reason them at the right level of
coarseness, style category interfaces, and link them along.

Our software's design ought to be pliable enough to handle modifications and unforeseen challenges. this
means that, whereas there's no ideal code style, will develop it in such a way that it can solve the majority of
probable future issues.

When fixing a drag, wonderful creator seldom follows the initial set of instructions; instead, they devolve
into earlier accomplishments. we can see revenant patterns within the interactions between categories. once
applied to the said instances, these patterns increased the underlying notion of object-oriented systems and
created them a lot of versatile, elegant, and reusable. What exactly could be a style pattern currently that
we've outlined it? It describes communication objects and categories that are altered to fulfill a broad style
issue in a very specific context.

A style pattern is formed from the subsequent components:

1) the next result


2) 2)Problems
3) 3)Solution

Object-oriented styles will solve tons of their issues with the help of design patterns.

Any object's size is subject to variation. they're capable of commutation something, as well as hardware and
code. So, however, can we decide what's an associate object? This drawback may be solved by exploitation
style patterns. enable the American state to supply some basic vocabulary associated with object-oriented

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

style during this context. for every action outlined by the associate object, the name, the objects needed as
arguments, and therefore the comeback worth are all declared. this can be mentioned within the operation's
signature. The interface to associate objects is the assortment of all signatures outlined by the operations of
that object. the entire set of inquiries that will be conducted on an associate object is decided by its interface.

4.4.1 Justification
In addition to exploiting style patterns to make code, it's important to know and analyze circumstances
within which specific patterns could also be utilized.
The requirement for extensibility in our code could be an important condition within which style patterns are
used. If we wish to more and more add new options or capabilities, we tend to could amendment the
prevailing code. to attain extensibility in our program, we tend may have to use style patterns just like the
industrial plant and image patterns, which permit for the dynamic generation of objects or the ever-changing
of their options. style patterns are ofttimes helpful once there are many strategies to hold out an associate
activity or attain a definite goal. we would be ready to use a range of techniques. style patterns are usually
helpful once there are many strategies to hold out an associate activity or attain a definite goal. we would be
ready to use several style patterns, as an example, to manage events or mistakes in our programs.

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

Gantt Chart

Gantt Chart
10/17/2022 10/22/2022 10/27/2022 11/1/2022 11/6/2022 11/11/2022 11/16/2022

Identifying the Assignment


Gathering Information
Completion of task 01
Completion of task 02
Completion of task 03
Completion of task 04
Review the Task
Modify
Do nessasary Modification
Finalize the Project
Subbmit Project

Downloaded by peter hakam (hakammohamed12345@gmail.com)


lOMoARcPSD|15607169

References
commons.wikimedia, n.d. commons.wikimedia.org. [Online]
Available at: https://commons.wikimedia.org/wiki/File:Factory_Method_UML_class_diagram.svg
Commons.wikimedia, n.d. commons.wikimedia.org. [Online]
Available at: https://commons.wikimedia.org/wiki/File:Composite_UML_class_diagram_%28fixed%29.svg
data-flair, n.d. data-flair.training. [Online]
Available at: https://data-flair.training/blogs/wp-content/uploads/sites/2/2018/06/Behavioral-Design-
Patterns.png
diagrams.net, 2022. www.diagrams.ne. [Online]
Available at: https://www.diagrams.net/blog/uml-class-diagrams
geeksforgeeks, 2021. www.geeksforgeeks.org. [Online]
Available at: https://www.geeksforgeeks.org/bridge-design-pattern/
geeksforgeeks, 2022. www.geeksforgeeks.org. [Online]
Available at: https://www.geeksforgeeks.org/adapter-pattern/
geeksforgeeks, 2022. www.geeksforgeeks.org. [Online]
Available at: https://www.geeksforgeeks.org/iterator-pattern/
Kaushik, G., n.d. geetikakaushik2020.medium.com. [Online]
Available at: https://geetikakaushik2020.medium.com/what-is-object-oriented-programming-7f14c5147ee5
[Accessed 24 September 2021].
panonit, n.d. panonit.com. [Online]
Available at: https://panonit.com/blog/overview-message-passing-object-oriented-programming
Parson, D. E., n.d. www.researchgate.net. [Online]
Available at: https://www.researchgate.net/figure/UML-class-diagram-showing-inheritance-and-
association_fig1_327544987
researchgate, n.d. www.researchgate.net. [Online]
Available at: https://www.researchgate.net/figure/Class-diagram-of-iterator-pattern_fig1_3267606
Scaler, n.d. www.scaler.com. [Online]
Available at: https://www.scaler.com/topics/design-patterns/behavioral-pattern/
S, R. A., 2022. www.simplilearn.com. [Online]
Available at: https://www.simplilearn.com/tutorials/java-tutorial/java-encapsulation
stackoverflow, 2019. stackoverflow.com. [Online]
Available at: https://stackoverflow.com/questions/58295799/association-class-attributes-in-domain-model-
class-diagram
starship-knowledge, n.d. starship-knowledge.com. [Online]
Available at: https://starship-knowledge.com/software-design-patterns
Downloaded by peter hakam (hakammohamed12345@gmail.com)
lOMoARcPSD|15607169

Sudhakaran, K., 2019. www.c-sharpcorner.com. [Online]


Available at: https://www.c-sharpcorner.com/UploadFile/b7dc95/composition-vs-aggregation-in-java/
Tellmehow, 2019. www.tellmehow.co. [Online]
Available at: http://www.tellmehow.co/factory-method-creational-design-patterns/
tutorialspoin, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/proxy_pattern.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/dbms/dbms_generalization_aggregation.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/singleton_pattern.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/decorator_pattern.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/facade_pattern.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/flyweight_pattern.htm
tutorialspoint, n.d. www.tutorialspoint.com. [Online]
Available at: https://www.tutorialspoint.com/design_pattern/observer_pattern.htm

Downloaded by peter hakam (hakammohamed12345@gmail.com)

You might also like