0% found this document useful (0 votes)
1K views24 pages

Higher Nationals in Computing: Unit 20: Advanced Programming Assignment 1

This document summarizes the key characteristics of object-oriented programming including classes, objects, inheritance, encapsulation, polymorphism, and abstraction. It also examines common class relationships in object-oriented design such as dependency, association, aggregation, and composition. The document provides examples of how these concepts would be applied in a class diagram for a scenario involving designing software for a company's documentation of its in-house software libraries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views24 pages

Higher Nationals in Computing: Unit 20: Advanced Programming Assignment 1

This document summarizes the key characteristics of object-oriented programming including classes, objects, inheritance, encapsulation, polymorphism, and abstraction. It also examines common class relationships in object-oriented design such as dependency, association, aggregation, and composition. The document provides examples of how these concepts would be applied in a class diagram for a scenario involving designing software for a company's documentation of its in-house software libraries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Higher Nationals in Computing

Unit 20: Advanced Programming


ASSIGNMENT 1

Learner’s name: LE HOANG HIEP


ID: GCS190464
Class: GCS0805A_PPT
Subject code: 1651
Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:


ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 20: Advanced Programming

Submission date June 12, 2021 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Lê Hoàng Hiệp Student ID GCS190464

Class GCS0805A_PPT Assessor name Phan Minh Tam

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.

Student’s signature Hiệp

Grading grid
P1 P2 M1 M2 D1 D2
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:

Signature & Date:


ASSIGNMENT 1 BRIEF
Qualification BTEC Level 5 HND Diploma in Business

Unit number Unit 20: Advanced Programming

Assignment title Examine and design solutions with OOP and Design Patterns

Academic Year

Unit Tutor

Issue date Submission date

IV name and date

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.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction


LO1 Examine the key components related to the object-orientated programming paradigm, analysing design
pattern types
P1 Examine the characteristics of M1 Determine a design pattern from D1 Analyse the relationship between
the object-orientated paradigm each of the creational, structural and the object-orientated paradigm and
as well as the various class behavioural pattern types. design patterns.
relationships.

LO2 Design a series of UML class diagrams


P2 Design and build class M2 Define class diagrams for D2 Define/refine class
diagrams using a UML tool. specific design patterns using a diagrams derived from a given
UML tool. code scenario using a UML tool.
Table of Contents
P1 Examine the characteristics of the object-orientated paradigm as well as the various class
relationships ................................................................................................................................... 1
1. Object-Oriented Programming ...................................................................................................... 1
2. Characteristics of Object-Oriented Programming ......................................................................... 2
2.1. Class and Object ....................................................................................................................... 2
2.2. Inheritance ............................................................................................................................... 2
2.3. Encapsulation ........................................................................................................................... 3
2.4. Polymorphism .......................................................................................................................... 3
2.5. Abstraction ............................................................................................................................... 4
3. Object-Oriented class relationships ............................................................................................... 4
3.1. Dependency ............................................................................................................................. 5
3.2. Association ............................................................................................................................... 5
3.3. Aggregation .............................................................................................................................. 6
3.4. Composition ............................................................................................................................. 7
P2 Design and build class diagrams using a UML tool ....................................................................... 7
1. Scenario .......................................................................................................................................... 7
2. Use Case Diagrams ......................................................................................................................... 8
3. Class Diagrams................................................................................................................................ 9
4. Pseudo-codes ............................................................................................................................... 10
5. Activity Diagrams.......................................................................................................................... 13
REFERENCES .................................................................................................................................. 17
ASSIGNMENT 1 ANSWERS
P1 Examine the characteristics of the object-orientated paradigm as well as
the various class relationships.

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

• OOP models complex things as reproducible, simple structures

• Reusable, OOP objects can be used across programs

• Allows for class-specific behavior through polymorphism

• Easier to debug, classes often contain all applicable information to them

• Secure, protects information through encapsulation

Page |1
2. Characteristics of Object-Oriented Programming

2.1. Class and Object

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.

3. Object-Oriented class relationships

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.

For example, consider the same example of a Student-Teacher relationship. Conceptually


speaking, each student can be associated with multiple teachers and each teacher can be associated
with multiple students.

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.

P2 Design and build class diagrams using a UML tool.

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:

• Add new book

• Delete book

• Book Search

• Edit book information

Requirements:

• Any library member can search for books by title or ID.

• Each book will have an ID to make searching and retrieving information easier

• The system should be simple so that everyone can use it

• Allow members to borrow and return books

2. Use Case Diagrams

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

Add book function


Start
Get book that the user wants to add
Check book validity. Is book valid
Yes: Go to next step

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

Delete book function


Start
Get book that the user wants to delete
Get option from user. User want to delete books
Yes: Print deleted book
No: Go back to first step
Stop

Search book function


Start
Display option for search
1. Search by ID
2. Search by book name
Get choose 1 of 2 options

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

If option is search by book name


Get book name from user

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

Display option to search another book


Yes: go to first step
No: go back to main menu
Stop

Update book function


Start
Get book ID to be edited from user
Check ID. Is ID valid
Yes: go to next step
No: go back to first step
Display all information about the book
Get information that the user wants to edit
Get edited information
Display option to edit another book
Yes: go to first step
No: go back to main menu
Stop

5. Activity Diagrams

Activity Diagram for Issue Book in Library :

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

1. Advanced programming with C#


Available at: https://www.codeproject.com/Articles/1094625/Advanced-programming-with-Csharp-
Lecture-Notes-Par
[Accessed June 12, 2021]
2. What is Object Oriented Programming? OOP Explained in Depth
Available at: https://www.educative.io/blog/object-oriented-programming
[Accessed June 12, 2021]
3. Design a Library Management System
Available at: https://www.educative.io/courses/grokking-the-object-oriented-design-
interview/RMlM3NgjAyR
[Accessed June 12, 2021]
4. Object Oriented Programming Using C# .NET
Available at: https://www.c-sharpcorner.com/UploadFile/84c85b/object-oriented-programming-using-
C-Sharp-net/
[Accessed June 12, 2021]
5. Lập trình hướng đối tượng (OOP) trong C#
Available at: https://comdy.vn/c-sharp/lap-trinh-huong-doi-tuong-oop-trong-c-sharp/
[Accessed June 12, 2021]
6. OOP Concepts in C#: Code Examples and How to Create a Class
Available at: https://stackify.com/oop-concepts-c-sharp/
[Accessed June 12, 2021]
7. C# OOP
Available at: https://www.w3schools.com/cs/cs_oop.php
[Accessed June 12, 2021]
8. C# Inheritance with Examples
Available at: https://www.tutlane.com/tutorial/csharp/csharp-inheritance
[Accessed June 12, 2021]
P a g e | 17
9. C# Inheritance with Examples
Available at: https://www.tutlane.com/tutorial/csharp/csharp-encapsulation
[Accessed June 12, 2021]
10. C# Polymorphism with Examples
Available at: https://www.tutlane.com/tutorial/csharp/csharp-polymorphism
[Accessed June 12, 2021]
11. C# Abstraction with Examples
Available at: https://www.tutlane.com/tutorial/csharp/csharp-abstraction
[Accessed June 12, 2021]
12. Types Of Relationships In Object Oriented Programming (OOPS)
Available at: https://www.c-sharpcorner.com/article/types-of-relationships-in-object-oriented-
programming-oops/
[Accessed June 12, 2021]
13. Dependency, Generalization, Association, Aggregation, Composition in Object Oriented
Programming
Available at: https://www.c-sharpcorner.com/UploadFile/b1df45/dependency-generalization-
association-aggregation-compos/
[Accessed June 12, 2021]
14. Class Diagram for Library Management System
Available at: https://www.geeksforgeeks.org/class-diagram-for-library-management-system/
[Accessed June 12, 2021]
15. Use Case Diagram for Library Management System
Available at: https://www.geeksforgeeks.org/use-case-diagram-for-library-management-system/
[Accessed June 12, 2021]

P a g e | 18

You might also like