You are on page 1of 16

Advanced Programming

Name: Nguyen Anh Khoa


Class: GCS0903B Mentor: Le Ngoc Thanh
ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 20: Advanced Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Nguyen Anh Khoa Student ID GCS190627

Class GCS0903B Assessor name Le Ngoc Thanh

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

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

Grade: Assessor Signature: Date:


Lecturer Signature:
ASSIGNMENT 1 BRIEF
Qualification BTEC Level 5 HND Diploma in Computing

Unit number Unit 20: Advanced Programming

Assignment title Examine and design solutions with OOP and Design Patterns

Academic Year 2018-2019

Unit Tutor Doan Trung Tung

Issue date 25 April 2019 Submission date 7 May 2019

Submission Format:

Format: The submission is in the form of a group written report. 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 D1 Analyse the relationship


the object-orientated paradigm as from each of the creational, between the object-orientated
well as the various class structural and behavioural paradigm and design patterns.
relationships. pattern types.

LO2 Design a series of UML class diagrams

P2 Design and build class diagrams M2 Define class diagrams for D2 Define/refine class
using a UML tool. specific design patterns using a diagrams derived from a given
UML tool. code scenario using a UML tool.
Contents
P1. Examine the characteristics of the object-oriented paradigm as well as the various class
relationships. .................................................................................................................................. 6
I. What are the characteristics of Object-Oriented programming language? .......................... 6

C. Encapsulation: ............................................................................................................... 8

D. Inheritance:................................................................................................................... 9
II. The various class relationships ..................................................................................... 11
P2. Design and build class diagrams using a UML tool. .................................................................. 13
I. Use-case Diagram: ...................................................................................................... 13
II. Class Diagram and Explanation .................................................................................. 14
References: ................................................................................................................................ 15
P1. Examine the characteristics of the object-oriented
paradigm as well as the various class relationships.
I. What are the characteristics of Object-Oriented
programming language?
A. Object / Class:
- In object-oriented programming, a class is a blueprint for creating objects (a particular
data structure), providing initial values for state (member variables or attributes), and
implementations of behavior (member functions or methods).
- The user-defined objects are created using the class keyword. The class is a blueprint that
defines a nature of a future object. An instance is a specific object created from a
particular class. Classes are used to create and manage new objects and
supportinheritance—a key ingredient in object-oriented programming and a mechanism
of reusing code.
-

- The image above shows how a Car object can be the template for many other Car
instances. In the image, there are three instances: polo, mini, and beetle. Here, we will
make a new class called Car, that will structure a Car object to contain information about
the car’s model, the color, how many passengers it can hold, its speed, etc. A class can
define types of operations, or methods, that can be performed on a Car object. For
example, the Car class might specify an accelerate method, which would update the
speed attribute of the car object.
B. Abstraction
- Abstraction is one of the key concepts of object-oriented programming (OOP) languages.
Its main goal is to handle complexity by hiding unnecessary details from the user. That
enables the user to implement more complex logic on top of the provided abstraction
without understanding or even thinking about all the hidden complexity.
- That’s a very generic concept that’s not limited to object-oriented programming. You can
find it everywhere in the real world.
- Objects in an OOP language provide an abstraction that hides the internal
implementation details. Similar to the coffee machine in your kitchen, you just need to
know which methods of the object are available to call and which input parameters are
needed to trigger a specific operation. But you don’t need to understand how this
method is implemented and which kinds of actions it has to perform to create the
expected result.
- Let’s implement the coffee machine example in Java. You do the same in any other
object-oriented programming language. The syntax might be a little bit different, but the
general concept is the same.
- Advantages of Abstraction
• The main benefit of using an Abstraction in Programming is that it allows
you to group several related classes as siblings.
• Abstraction in Object Oriented Programming helps to reduce the complexity of the
design and implementation process of software.
- Implementation
C. Encapsulation:
- Encapsulation Meaning: In object-oriented computer programming languages, the
notion of encapsulation (or OOP Encapsulation) refers to the bundling of data, along with
the methods that operate on that data, into a single unit. Many programming languages
use encapsulation frequently in the form of classes. A class is a program- code-template
that allows developers to create an object that has both variables (data) and behaviors
(functions or methods). A class is an example of encapsulation in computer science in
that it consists of data and methods that have been bundled into a single unit.
- Encapsulation may also refer to a mechanism of restricting the direct access to some
components of an object, such that users cannot access state values for all of the
variables of a particular object. Encapsulation can be used to hide both data members
and data functions or methods associated with an instantiated class or object.
- Implementation :
D. Inheritance:

- Inheritance is one of the core concepts of object-oriented programming


(OOP) languages. It is a mechanism where you can to derive a class from
another class for a hierarchy of classes that share a set of attributes and
methods.
- You can use it to declare different kinds of exceptions, add custom logic to
existing frameworks, and even map your domain model to a database.

- Creating a unique class for every single animal would quickly get very
repetitious because there are some properties and behaviors that apply to
every single animal, from a mouse to an elephant. Shared functions might
include feed( ), hydrate( ), cleanEnclosure( ). Instead of creating these shared
attributes over and over for every animal, we could instead create a parent
Animal class! This parent class would contain the properties and behaviors
universal to all animals and save us from having to create those shared
functions ad infinitum.
- Implementation in C#:
II. The various class relationships
- Code reuse is one of the many benefits of OOP (object-oriented programming).
Reusability is feasible because of the various types of relationships that can be
implemented among classes. This article will demonstrate the types of
relationships (from weak to strong) using Java code samples and the symbols in
the UML (unified modeling language) class diagram.
- Dependency
• Is a relationship when objects of a class work briefly with objects of another
class. Normally, multiplicity doesn’t make sense on a dependency .

- Association
• This relationship transpires when objects of one class know the objects of another
class. The relationship can be one to one, one to many, many to one, or many to
many. Moreover, objects can be created or deleted independently.

- Aggregation
• Is a "has-a" type relationship and is a one-way form of association. This relationship
exists when a class owns but shares a reference to objects of another class.

- Composition
• Is a "part-of" type of relationship, and is a strong type of association. In other words,
composition happens when a class owns & contains objects of another class

- Inheritance
• Is an "is-a" type of relationship. It's a mechanism that permits a class to acquire
the properties and behavior of an existing class (or sometimes more classes, if
the language allows multiple inheritance).

P2. Design and build class diagrams using a UML tool.
I. Use-case Diagram:
II. Class Diagram and Explanation
References:
[1]. Stackify. (2017). OOP Concept for Beginners: What is Abstraction? [online]
Available at: https://stackify.com/oop-concept-
abstraction/#:~:text=Abstraction%20is%20one%20of%20the.

[2]. brilliant.org. (n.d.). Classes (OOP) | Brilliant Math & Science Wiki. [online]
Available at: https://brilliant.org/wiki/classes-
oop/#:~:text=In%20object%2Doriented%20programming%2C%20a.

[3].Sumo Logic. (n.d.). What is Encapsulation in OOP? [online] Available at:


https://www.sumologic.com/glossary/encapsulation/.

[4]. Stackify. (2017). OOP Concept for Beginners: What is Inheritance? [online]
Available at: https://stackify.com/oop-concept
inheritance/#:~:text=Inheritance%20is%20one%20of%20the.

[5] OOP Concepts for Beginners: What is Polymorphism. [online] Stackify. Available at:
https://stackify.com/oop-concept-polymorphism/.
[6]. www.c-sharpcorner.com. (n.d.). Abstract Class In C#. [online] Available at:
https://www.c- sharpcorner.com/UploadFile/annathurai/abstract-class-in-C-
Sharp/

[7]. www.cs.utah.edu.(n.d.).OOP-Interfaces. [online]Available at:


https://www.cs.utah.edu/~germain/PPS/Topics/interfaces.html#:~:text=In%20
Object%20Oriente d%20Programming%2C%20an.

You might also like