Higher Nationals in Computing: Unit 20: Advanced Programming Assignment 1
Higher Nationals in Computing: Unit 20: Advanced Programming Assignment 1
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Grading grid
P1 P2 M1 M2 D1 D2
Summative Feedback: Resubmission Feedback:
Assignment title Examine and design solutions with OOP and Design Patterns
Academic Year
Unit Tutor
Submission Format:
Format: The submission is in the form of a group written report and presentation. 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 a bibliography using the Harvard referencing system.
Submission Students are compulsory to submit the assignment in due date and in a way requested by
the Tutors. The form of submission will be a soft copy in PDF posted on corresponding
course of http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student or from
books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style. Make sure that you know how to reference
properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail
Assignment Brief and Guidance:
Scenario: You have recently joined a software development company to help improve their documentation of
their in-houses software libraries which were developed with very poor documentation. As a result, it has been
very difficult for the company to utilise their code in multiple projects due to poor documentation. Your role is to
alleviate this situation by showing the efficient of UML diagrams in OOAD and Design Patterns in usages.
Tasks
You and your team need to explain characteristics of Object-oriented programming paradigm by
applying Object-oriented analysis and design on a given (assumed) scenario. The scenario can be
small but should be able to presents various characteristics of OOP (such as: encapsulation,
inheritance, polymorphism, override, overload, etc.).
The second task is to introduce some design patterns (including 3 types: creational, structural and
behavioral) to audience by giving real case scenarios, corresponding patterns illustrated by UML class
diagrams.
To summarize, you should analyze the relationship between the object-orientated paradigm and
design patterns.
The presentation should be about approximately 20-30 minutes and it should be summarized of the
team report.
1. Object-Oriented Programming:
Object-Oriented Programming (OOP) is the term used to describe a programming approach based
on objects and classes. The object-oriented paradigm allows us to organise software as a collection of
objects that consist of both data and behaviour. This is in contrast to conventional functional
programming practice that only loosely connects data and behaviour.
Since the 1980s the word 'object' has appeared in relation to programming languages, with almost
all languages developed since 1990 having object-oriented features. Some languages have even had
object-oriented features retro-fitted. It is widely accepted that object-oriented programming is the
most important and powerful way of creating software.
Benefits of OOP
Page |1
2. Characteristics of Object-Oriented Programming
A class is a template for objects, and an object is an instance of a class. When the individual objects
are created, they inherit all the variables and methods from the class. Everything in C# is associated
with classes and objects, along with its attributes and methods.
For example: in real life, a car is an object. The car has attributes, such as weight and color, and
methods, such as drive and brake.
2.2. Inheritance
Page |2
Inheritance is the process by which one object acquires the properties of another object. A type
derives from a base type, taking all the base type members fields and functions. Inheritance is most
useful when you need to add functionality to an existing type.
For example all .NET classes inherit from the System.Object class, so a class can include new
functionality as well as use the existing object's class functions and properties as well.
2.3. Encapsulation
Encapsulation binds together code and the data it manipulates and keeps them both safe from
outside interference and misuse. Encapsulation is a protective container that prevents code and data
from being accessed by other code defined outside the container.
2.4. Polymorphism
Polymorphism is a feature that allows one interface to be used for a general class of action. This
concept is often expressed as "one interface, multiple actions". The specific action is determined by
Page |3
the exact nature of circumstances.
2.5. Abstraction
This provides essential features without describing any background details. Abstraction is
important because it can hide unnecessary details from reference objects to names. It is also
necessary for the construction of programs. Instead of showing how an object is represented or how it
works, it focuses on what an object does. Therefore, data abstraction is often used for managing large
and complex programs.
Page |4
3.1. Dependency
Dependency is defined as a relation between two classes, where one class depends on another
class but another class may or not may depend on the first class.So any change in one of the classes
may affect the functionality of the other class, that depends on the first one.
For examle, I have a Customer class and an Order class. When we need to save a new order, I need
to save it corresponding to a customer. In order to do so, my Order class will need a reference to the
Customer class and save its data. So in this case, my Order class is dependent on the Customer class. In
the future, if any change are made to the Customer class, it may result in changes to the Order class.
3.2. Association
Page |5
Association is defined as a structural relationship, that conceptually means that the two
components are linked to each other. This kind of relation is also referred to as a using relationship,
where one class instance uses the other class instance or vice-versa, or both may be using each other.
But the main point is, the lifetime of the instances of the two classes are independent of each other
and there is no ownership between two classes.
3.3. Aggregation:
Aggregation is the same as association but with an additional point that there is an ownership of
the instances, unlike association where there was no ownership of the instances. To understand it
better, let's add another class named Department to our example explained above.
Example: If we talk about the relation between Teacher and Department then conceptually, a
Department can have multiple Teachers associated with it but each Teacher can belong to only one
Department at a time.
Page |6
3.4. Composition:
This is the same as that of aggregation, but with the additional point that the lifetime of the child
instance is dependent on the owner or the parent class instance. To the same code above, let's add
another class named University.
Example: Conceptually, a university can have multiple departments in it. But each department can
belong to a single university only.
1. Scenario
The IT company I am working at has received a project from the library of FPT University.
Page |7
Currently, the library management system of FPT University has become outdated. They wanted to
create a better library management system to replace manual management and help library staff
manage books more efficiently.
I was assigned the task of designing the system and drawing UML diagrams for the library
management system of FPT University.
System functions:
• Delete book
• Book Search
Requirements:
• Each book will have an ID to make searching and retrieving information easier
Page |8
3. Class Diagrams
Page |9
4. Pseudo-codes
Librarian function
Start
Get Librarian name
Get Librarian ID
Check ID. Is ID correct
Yes: go to next step
No: Print wrong ID and go back.
Display menu:
1. Add books
P a g e | 10
2. Delete books
3. Search books
4. Update book information
5. View book list
6. Exit
Get choose 1 of 6 options
Stop
Member function
Start
Get Member name
Get Member ID
Check ID. Is ID correct
Yes: go to next step
No: Print wrong ID and go back.
Display menu:
1. Search books
2. View book information
3. Borrow books
4. Return books
5. Exit
Get choose 1 of 5 options
Stop
P a g e | 11
No: Print book not valid and go back to main menu
Get option form user. User want to add books
Yes: Print add book success
No: Go back to first step
Stop
If option is search by ID
Get book ID from user
Is user input book ID = book ID in system
Yes: Print all information about that book id
No: Print sorry, not found this book
P a g e | 12
Is user input book name = book name in system
Yes: Print all information about that book name
No: Print sorry, not found this book
5. Activity Diagrams
P a g e | 13
Activity Diagram for Return Book in Library:
P a g e | 14
Activity Diagram for searching books in the library
P a g e | 15
P a g e | 16
REFERENCES
P a g e | 18