1651 - Unit 20 - Assignment Brief 1
1651 - Unit 20 - Assignment Brief 1
Assignment title Examine and design solutions with OOP and Design Patterns
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
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
LO1 Examine the key components related to the object-orientated programming paradigm,
analysing design pattern types
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
Introduction...............................................................................................................1
1. Object-Oriented Programming:..............................................................................1
3. Encapsulation:........................................................................................................2
5. Concept Of Polymorphism:....................................................................................4
6. Interface:...............................................................................................................4
1. Scenario:................................................................................................................5-6
Conclusion.................................................................................................................9
REFERENCES...............................................................................................................10
Introduction
Advance programming is a subject that contain all programming language paradigms and Object-
oriented programming is a programming language model organized around the objects rather than
“action” and data rather than logic. Historically, a program has been viewed as a logical procedure that
takes input data, processes it, and produces output data. In this assignment, I have required to develop
software system for my company; however, before that I have to understand the Advance Programming
principles, be able to design pattens and the object-oriented programming solution. Besides, I am going to
examine the key components related to the object-orientated programming paradigm and analyze design
pattern types. Moreover, I also define and design class diagrams for specific design patterns using a UML
tool.
Finally, I will analyze the relationship between the object-orientated paradigm and design patterns,
show fully the results into my report.
1. Object-Oriented Programming
In this article, I will summarize the basic principles of object-oriented programming to help you get
an overview of OOP and how convenient it is.
When developing applications using OOP, we will define classes (classes) to model actual objects. In
the application these classes will be initialized into objects and during the time the application runs, the
methods of this object will be called.
What is the class that defines the object: include methods and properties. An object is just an
instance of the class. Classes interact with each other by the public API: its set of methods, its public
properties.
1
Abstraction in Java is a non-specific property that only names the problem. It is a process of hiding
the inner activities and only showing the essential features of the object to the user. For example, if a
person uses his phone to send a message, he will enter the text of the message, the recipient's information
and press the send button.
When he started sending the message, he didn't know what was going on during the sending
process but only knew if the result of the message was successfully sent to the recipient. So, in this
example, the process of sending the message has been hidden and only shows the functions that the user
needs is the function of entering the messagecontent, the recipient information, the result of sending the
message successfully or failure. That is abstraction.
− Abstraction allows programmers to eliminate the complexity of an object by only giving the
object's needed attributes and methods in programming, improving the maintainability of the
system.
− Abstraction helps us focus on the essential core of the object rather than being concerned
with how it works.
− Abstraction provides many extended features when used in combination with polymorphism
and inheritance in object-oriented programming.
− Java abstracts through abstract classes and interfaces. In this article, I will guide you to learn
about abstract classes and abstract methods
3. Encapsulation
❖ Definition
- This property does not allow the user to change the intrinsic state of an object. Only the
object's internal methods allow to change its state. In any way, allowing the external environment
to affect the internal data of an object is entirely up to the person writing the code. This is a
property that ensures the integrity of the object. Encapsulation enables a group of properties,
methods, and other members to be considered a single unit or object.
❖ Example
❖ Implementation
2
- Public: Access to all code in the program
❖ Definition
❖ Purpose
- The purpose of inheritance is to reuse common methods and attributes among classes
without recreating them. Reusability of a code enables you to use the same code in different
applications with little or no changes.
❖ Example
- I am presenting an example that is quite familiar to movies viewer. You know in the
“Lion King”, Simba is Mufasa son and in “Lion King 2”, Kiara is Simba daughter, meaning Simba
inherits from Mufasa and Kiara inherits from both Simba and
Mufasa:
3
➢ Protected Access Modifier:
+ Access variables and methods of the base class from the derived class
➢ New keyword:
- The new keyword can either be used as an operator or as a modifier in C#. This allows you to
redefine the inherited methods or variables in the derived class. Since redefining the base class members in
the derived class results in base class members being hidden, the only way you can access these is by using
the base keyword.
5. Concept Of Polymorphism
- Polymorphism in Java is understood in each case, different circumstances, the object has
different morphology depending on the context. The polymorphic object is a special object because
sometimes it becomes another object and sometimes it becomes another object (depending on the
situation). This "role-playing" in different objects makes it possible for the original polymorphic
object to perform different actions of each specific object.
6. Interface
❖ Features of Interface
− The interface always has a modifier: public interface, whether you explicitly specify it or not.
− If there are fields, they are: public static final, whether you specify them.
− Its methods are abstract methods, meaning there is no function body, and all modifiers are:
public abstract, whether you declare it or not.
5
− An interface is not a class. Writing an interface is like writing a class, but they have two
different definitions. A class describes the properties and behavior of an object. An interface
contains the behaviors a class implements.
− Unless an interface implementation class is an abstract class, all of the interface's methods
need to be defined in the class.
− The IDE adds the keyword public abstract before the interface method and public static final
keywords before data members.
− An interface is written in a file in .java format, with the interface name the same as the file name.
− Declaring interfaces in a package, the corresponding bytecode files also have a directory
structure with the same package name.
− An interface cannot contain any fields except those that are both static and final.
1. Scenario
Based on the scenario, we are developing a Student Management System for FPT Academy
International. The system requirement the information below:
6
7
2. Use-Case Diagrams:
To present a brief look at what the system can do, we need to draw out a use-case diagram - a
diagram showing how users in the system can interact with the system via the features. Thus, and
according to the above information, we can have the following use-case diagrams
Management System
− In the above diagram, you can see that User (or Admin) can access 3 main options.
− Choosing “Managing Student”, system will display a Menu allowing user to manage the students via the
functionalities (Add, Search, View, Delete, Update) Choosing “Managing Lecturer”, system will display a
Menu allowing user to manage the lecturers via the functionalities (Add, Search, View, Delete, Update)
8
− Choosing “Exit”, system will end.
− We can briefly imagine how the system would work through the above diagram, now we will take a
closer look on how we can manage the students and the lecturers.
− As you can see, the user will manage the students and lecturers through the functions: Add new Student,
View all the Student, Search the Student, Update Student, Delete the Student and Return to Main Menu.
− In case, we want to stop adjust and examine the target or want to change to the other Managing side.
− As you can see, the user will manage the students and lecturers through the functions: Add new
Lecturer, View all the Lecturer, Search the Lecturer, Update Lecturer, Delete the Lecturer and Return to
Main Menu.
− In case, we want to stop adjust and examine the target or want to change to the other Managing side.
9
10
3. Class Diagrams:
− After knowing the actual functions that will be used to manage the targets, we now need to
determine the classes, the interfaces and their relationship that will be used in the system. And to
determine those, I drew the following Class Diagram - one of the most important diagrams of software
design, it shows the structure and relationship between the components that make up the software.
11
Management System
− As you can see in the diagram, there are 6 classes (Main Menu, Student Menu, Lecturer Menu, Student,
Lecturer, Person) and one interface (Function) that will be used in the system and their relationships are
also clearly defined.
Conclusion
In this assignment, I explained characteristics of Object-oriented programming paradigm by
applying Object-oriented analysis and design on a given (assumed) scenario and examined various
characteristics of OOP (such as: abstraction, encapsulation, inheritance, polymorphism)
Besides, I also introduced some design patterns (including 3 types: creational, structural, and
behavioral) to give real case scenarios, corresponding patterns illustrated by UML class diagrams. In
addition, I analyzed the relationship between the objectorientated paradigm and design patterns.
After all, I have just completed my report and learned a lot of knowledge by doing this assignment
13
REFERENCES
[1] GeeksforGeeks. 2022. C# | Abstract Classes - GeeksforGeeks. [ONLINE] Available at:
https://www.geeksforgeeks.org/c-sharp-abstract-classes/. [Accessed 05 December 2022].
[2] Educative: Interactive Courses for Software Developers. 2022. What is objectoriented programming?
OOP explained in depth. [ONLINE] Available at: https://www.educative.io/blog/object-oriented
programming. [[Accessed 05 December 2022].
[7] WhatIs.com. 2022. What is polymorphism? - Definition from WhatIs.com. [ONLINE] Available at:
https://www.techtarget.com/whatis/definition/polymorphism#:~:text=In%20 object%2Doriented
%20programming%2C%20polymorphism,have%20more%20than%20one%20form.. [Accessed 05
December 2022].
[8] Educative: Interactive Courses for Software Developers. 2022. What is polymorphism? [ONLINE]
Available at: https://www.educative.io/answers/what is-polymorphism. [Accessed 05 December 2022].
[9] Lucidchart. 2022. UML Class Diagram Tutorial | Lucidchart. [ONLINE] Available at:
https://www.lucidchart.com/pages/uml-class-diagram. [Accessed 05 December 2022].
[10] Viblo. 2022. Design Pattern: Class Diagram. [ONLINE] Available at: https://viblo.asia/p/design-pattern-
class-diagram-L4x5xGVYlBM. [Accessed 05 December 2022].
14