1651 GCS210109 Assignment1
1651 GCS210109 Assignment1
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:
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.
3. Design and build class diagrams using a UML tool (P2) ......................................................................... 10
3.1 OOP scenario ............................................................................................................................................. 10
3.1.1 Scenario............................................................................................................................................................................. 10
3.1.2 Use case Diagram .............................................................................................................................................................. 11
3.1.3 Class Diagram .................................................................................................................................................................... 14
4. Conclusion .......................................................................................................................................... 17
REFERENCES ........................................................................................................................................... 18
ASSIGNMENT 1 ANSWERS
1. Introduction
In this assignment, I will specify the properties of the object-oriented programming paradigm by applying
object-oriented research and design to a particular circumstance. Certain OOP traits should be addressed even
though the issue is not urgent. By employing real-world case studies and relevant trends illustrated with UML
class diagrams, the second goal is to inform the audience about some design trends. Last but not least, I'll show
how design patterns and OOP relate to one another.
2. Examine the characteristics of the object-orientated paradigm as well as the various class relationships
(P1)
2.1 Object – Oriented Programming (OOP)
2.1.1 Definition
A programming paradigm known as object-oriented programming arranges software around data or objects
rather than functions and logic. A data field with unique characteristics and behavior is called an object. Mobile
apps as well as manufacturing and design software benefit greatly from this type of development. Different
benefits of OOP incorporate code reusability, adaptability, and proficiency.
P ag e |6
- Polymorphism: OOP permits you to involve similar strategy or property in various ways relying upon the
setting where it is utilized. This is called polymorphism, and it makes it more straightforward to compose
adaptable, reusable code.
2.1.3 Criticism of OOP
- Complexity: OOP can be more complex than other programming paradigms, especially for amateurs. It
presents new ideas like inheritance, polymorphism, and epitome, which can be challenging to comprehend and
apply accurately.
- Overuse of inheritance: Inheritance is a strong element of OOP, yet it can likewise prompt code that is hard
to keep up with and comprehend. Now and again, engineers might overuse inheritance, making complex class
pecking orders that are difficult to explore.
- Tight coupling: OOP can prompt tight coupling between objects, which can make it hard to alter or expand
code. Changes to one piece of the code can have unseen side-effects on different pieces of the code.
- Performance: OOP can be slower than other programming paradigms due to the above of dynamic dispatch
and virtual capability calls.
- Not suitable for all types of problems: OOP isn't generally the best methodology for tackling specific types of
problems, for example, those that don't include information control or require superior performance.
2.2 General concepts of OOP
2.2.1 Object
An object is a true entity that has attributes, conduct, and properties. It is alluded to as an occasion of the class.
It contains part functions, factors that we have characterized in the class. It consumes space in the memory.
Various objects have various states or attributes, and ways of behaving.
In OOP, objects comprise of 2 main components:
- Attributes: are the data and characteristics of the object
- Methods: are the ways of behaving that the object can perform
To make it simpler to envision, we have a genuine illustration of an object that is a cell phone. This object will
have:
- Attributes: variety, memory, operating system, …
- Methods: calling, taking photographs, messaging, recording, ...
2.2.2 Class
Class is an abstraction of the object. Objects with comparable properties are gathered into a class. The class
will likewise incorporate two snippets of data: properties and methods. An object will be treated as an occasion
of the class.
Proceeding with the model in the object segment above, we have a cell phone class comprising of 2 parts:
- Credits: variety, memory, operating system…
- Methods: calling, taking photographs, messaging, recording...
- Objects of this class can be iPhone, Samsung, Oppo, Huawei, and so on.
2.2.3 Encapsulation
Encapsulation is the method involved with concealing the execution subtleties of an object from the rest of the
world. This implies that the object's interior state must be gotten to through an obvious connection point, which
gives a degree of abstraction.
P ag e |7
Figure 2: Example of Encapsulation
(Source: https://www.javatpoint.com/what-is-object-oriented-programming)
2.2.4 Inheritance
The technique of building new classes from old ones is called inheritance. The ability to assign relationships
and subclasses allows developers to reuse similar functionality while yet retaining a distinct hierarchy. This
attribute of OOP speeds up development and provides more accuracy by requiring a more in-depth investigation
of the data.
P ag e |9
methods won't be open from beyond that class. In this realm abstraction makes the code more obvious as it
centers around the core highlights/activities and not on the unimportant subtleties. What's more, it likewise
makes the program simple to keep up with, restricting errors because of unpredictable and wrong data access.
At this level, you can think about Abstraction = Encapsulation + Data Hiding.
- The second realm: In this realm we perform abstraction from the plan stage to the coding stage. In the plan
configuration stage, we will zero in on expressing "what" - what a module or class will do, not on "how" - the
way things are finished. The consequence of this plan step will be a supposed point of interaction. Classes (or
modules) will work with one another through the point of interaction, without knowing one another explicitly.
P a g e | 10
- Add, delete, edit books.
- Print the entire book onto the screen.
- Search for books.
- Borrow books and return books.
Software requirements include:
- Students and faculty can both view information and search for book information.
- Faculty and students can borrow books.
- The librarian will be in charge of returning books as well as adding, deleting, and editing book metadata.
- An intuitive user interface.
- Has crystal-clear transparency, solid security, and the potential for future growth.
3.1.2 Use case Diagram
P a g e | 11
name or book ID. In the wake of entering, the system does the undertaking of looking and yielding book
information according to the id (name) entered.
P a g e | 12
update, the new information will be saved in the program.
Librarian capabilities:
- Librarians can add books.
- Librarians can delete books.
- Librarians can edit book information.
- The librarian carries out the role of returning books back.
- Librarians can search for book information.
- Librarians can view information of accessible books.
Use case:
Use case 1: Main Screen
Scope User Goal
Goal in Context Present a main menu form which one can access the
various functions of the library management system
Primary Actor User and Admin
User: Wants to get a specific book for certain period
of time
Stakeholders
Admin: Wants to keep the record of all books (issued
or returned) and maintains the record
Run Library Management Software and entered
Preconditions password is correct
None
Preconditions
Triggers Admin/User selects Search Books option from the
Books Catalogue menu.
P a g e | 13
Library Management Software shows the
Success Guarantee information of the required Book
Goal in Context Present a form to the admin /user to view all Books
Preconditions None
Admin/User selects View Books option from the
Triggers
Books Catalogue menu.
Library Management Software shows the table that
Success Guarantee contains all Books that are in the library.
P a g e | 14
Figure 8: Class diagram
Explanation:
This library management program includes 5 main classes: Librarian, Book, User, Teacher, and Student.
Class User:
As the parent class of the two classes teacher and students, this class creates a frame for two sub -classes and
provides execution methods for the subclass (using inheritance in object-oriented programming). Two sub-
classes are teachers and students who can overwrite the method showinfo () inside the user class to suit the
subclass's properties (this is known as polymorphic application in object-oriented programming).
P a g e | 15
Figure 9: Class User
P a g e | 16
Figure 12: Class Librarian
4. Conclusion
A suitable and appropriate approach to use for the project of the Greenwich School Library is to apply UML
design of the Use Case Diagram and Class Diagram above as well as the theory of object-oriented
programming. Through this, I was able to improve my capacity to use object-oriented programming for any
project. My evaluation is that the requirements established for the project are fully compatible with the system
design, organizational strategy, and object-oriented programming characteristics.
P a g e | 17
REFERENCES
GILLIS, A. S. 2023. object-oriented programming (OOP) [Online]. Available:
https://www.techtarget.com/searchapparchitecture/definition/object-oriented-programming-OOP [Accessed
19 April 2023].
HALF, R. 2023. 4 Advantages of Object-Oriented Programming [Online]. Available:
https://www.roberthalf.com/blog/salaries-and-skills/4-advantages-of-object-oriented-programming [Accessed
19 April 2023].
HERRITY, K. 2023. What Is Object-Oriented Programming (OOP)? A Complete Guide [Online]. Available:
What Is Object-Oriented Programming (OOP)? A Complete Guide [Accessed 19 April 2023].
JANSSEN, T. 2017. OOP Concept for Beginners: What is Inheritance? [Online]. Available:
https://stackify.com/oop-concept-inheritance/ [Accessed 19 April 2023].
JANSSEN, T. 2021. OOP Concepts for Beginners: What is Polymorphism [Online]. Available:
https://stackify.com/oop-concept-polymorphism/ [Accessed 19 APril 2023].
JANSSEN, T. 2022. OOP Concept for Beginners: What is Encapsulation [Online]. Available:
https://stackify.com/oop-concept-for-beginners-what-is-encapsulation/ [Accessed 19 April 2023].
JANSSEN, T. 2023. OOP Concept for Beginners: What is Abstraction? [Online]. Available:
https://stackify.com/oop-concept-abstraction/ [Accessed 19 April 2023].
TEAM, G. 2023a. Advantages and Disadvantages of OOP [Online]. Available:
https://www.geeksforgeeks.org/benefits-advantages-of-oop/ [Accessed 19 April 2023].
TEAM, G. 2023b. Difference Between Method Overloading and Method Overriding [Online]. Available:
https://www.geeksforgeeks.org/difference-between-method-overloading-and-method-overriding-in-java/
[Accessed 20 April 2023].
TEAM, J. 2023c. What is Object-Oriented Programming? [Online]. Available:
https://www.javatpoint.com/what-is-object-oriented-programming [Accessed 19 April 2023].
P a g e | 18