Object-Oriented Library Management System: A Case Study, Assignments of Advanced Algorithms

Scenario: (continued from Assignment 1) Your team has shown the efficient of UML diagrams in OOAD and introduction of some Design Patterns in usages. The next tasks are giving a demonstration of using OOAD and DP in a small problem, as well as advanced discussion of range of design patterns.

Typology: Assignments

2021/2022

Uploaded on 12/28/2022

ng-n-minh-anh
ng-n-minh-anh 🇻🇳

4.8

(26)

34 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Nationals in Computing
Unit 20: Advanced Programming
ASSIGNMENT 1
Learner’s name: NGUYEN GIA HUY
ID: GCS200801
Class: GCS0905C
Subject code: 1651
Assessor name: LE NGOC THANH
Assignment due: Assignment submitted:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Object-Oriented Library Management System: A Case Study and more Assignments Advanced Algorithms in PDF only on Docsity!

Higher Nationals in Computing

Unit 20: Advanced Programming

ASSIGNMENT 1

Learner’s name: NGUYEN GIA HUY

ID: GCS 200801

Class: GCS0905C

Subject code: 1651

Assessor name: LE NGOC THANH

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^06 Dec^2022 Date Received 1st submission Re-submission Date 13 Dec 2022 0 Student Name NGUYEN GIA HUY Student ID GCS Class GCS0905C 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 HUY Grading grid P1 P2 M1 M2 D1 D

 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 2021 - 2022 Unit Tutor LE NGOC THANH Issue date 06 Dec 2022 Submission date 06 Dec 2022 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

P2 Design and build class diagrams using a UML tool. M2 Define class diagrams for specific design patterns using a UML tool. D2 Define/refine class diagrams derived from a given code scenario using a UML tool.

Table of Contents

  • Unit 20: Advanced Programming ASSIGNMENT
      1. Introduce OOP
      1. General concepts of OOP (need references / citations here)
      • 2.1. Object/Class
      • 2.2. Abstraction
      • 2.3. Encapsulation
      • 2.4. Inheritance
      • 2.5. Polymorphism (Overloading and Overriding)
      • 2.6. Abstract classes
      • 2.7. Interfaces
  • OOP SCENARIO
      1. Scenario
      1. Usecase Diagram
      1. Class Diagram
  • CONCLUSION
  • REFERENCES

To make it easier to imagine, we have a real-life example of an object that is a smartphone. This object will have:

  • Attributes: color, memory, operating system…
  • Methods: calling, taking photos, texting, recording... Class Class is an abstraction of the object. Objects with similar properties are grouped into a class. The class will also include two pieces of information: properties and methods. An object will be treated as an instance of the class. Continuing the example in the object section above, we have a smartphone class consisting of 2 components: - Attributes: color, memory, operating system… - Methods: calling, taking photos, texting, recording... - Objects of this class can be iPhone, Samsung, Oppo, Huawei, etc. 2.2. Abstraction Abstraction is one of the four important characteristics of object-oriented programming languages (OOP). Its main goal is to reduce complexity by hiding details that are not directly related to the user (the user here is not the end user but the programmer). That allows the user to still perform the necessary work based on a provided abstract entity without understanding or even thinking about all the complexity lurking within.

In OOP, Abstraction can be divided into 2 levels (2 realms)

  • The first realm: Data and some methods (methods) that are not needed to be exposed outside will be included in the class and specify the access specification as private (or protected). Those data or methods will not be accessible from outside of that class. In this realm abstraction makes the code easier to understand as it focuses on the core features/actions and not on the petty details. In addition, it also makes the program easy to maintain, limiting errors due to indiscriminate and wrong data access. At this level, you can consider Abstraction = Encapsulation + Data Hiding.
  • The second realm: In this realm we perform abstraction from the design stage to the coding stage. In the design-design phase we will focus on stating “what” – what a module or class will do, not on “how” – how it is done. The result of this design step will be a so-called interface. Classes (or modules) will work with each other through the interface, without knowing each other specifically. 2.3. Encapsulation Encapsulation means simply that data and related functions/methods are "packaged" into classes for ease of management and use.

The image above shows that when applying inheritance, we only need to write the other methods in the parent class once and let the subclasses inherit again. This will avoid errors when editing and increase reusability. For example, if you want to add a class MayMac , you just need to declare it to inherit from Class Mayvitin to be able to use the above properties and methods already. 2.5. Polymorphism (Overloading and Overriding) Polymorphism (polymorphism) is a word of Greek origin, translated into Vietnamese meaning "a name with many different forms and shapes". In other words, an object has many forms or a name with many different functions. "Poly" means many and "morph" means forms. Polymorphism provides the ability to execute multiple classes with the same name. As mentioned above, polymorphism in C# deals with multiple classes with the same name, which are related to each other. This is an important concept in object-oriented programming after encapsulation and inheritance. Polymorphic Types in C# There are basically 2 types of polymorphism in C#, including:

  • Static polymorphism / Compile Time.
  • Dynamic/Runtime polymorphism. Static Polymorphism in C# (Or Compile Time)

Static polymorphism (or Compile Time) in C# is also known as Early Binding. Method overloading is a good example of static polymorphism. In overloading, the method/function has the same name but different signature. It is also known as compile time polymorphism because the decision on which method is called is done at compile time. Overloading is a concept where methods have the same name as different sets of parameters. Here the compiler checks the number of parameters passed and the type of the parameters, and then makes a decision on which method to call. In case if no method is found, it will throw an error. Dynamic Polymorphism in C# (Or Runtime Polymorphism) Dynamic Polymorphism or Runtime Polymorphism is also known as Late Binding. Where method name and method signature (number of parameters and parameter type should be same, but may have different implementation). Overriding is a good example of dynamic polymorphism. Overriding can be done using inheritance. With overriding method, base class and derived class can have same method name and some other things. The compiler is not aware of the method available to override the function, so it will not return an error when compiling. The compiler will decide which method to call at runtime and if no method is found it will throw an error. 2.6. Abstract classes

  • An abstract class is a class used to define common properties and behaviors of other classes. In other words: An abstract class is a class used to declare properties and methods for other classes to use. (Abstract class does not allow parameter initialization, only declarations).
  • An abstract class is used as a base class of classes of the same nature.

OOP SCENARIO

1. Scenario The library of the University of Greenwich Vietnam has imported a large number of books of all genres. The school's library has always controlled and managed books by manual human resources, now they decided to build an effective book management software and I am the programmer assigned to do this task. For this project of the library, I decided to choose an object-oriented programming solution combined with the C# programming language to support software implementation. The reason for this choice of mine is because: Object-oriented programming has outstanding advantages in the software development process such as security, ease of management and development, and optimization in many situations. The C# programming language is one of the most popular object-oriented programming languages in the world. With the backing from Microsoft, C# will be the trusted language in software development that I choose. The software will include the following main functions: - Add, delete, edit books. - Print the entire book to the screen. - Search for books. - Borrow books and return books. Software requirements include:

  • Both faculty and students can view information and find book information.
  • Both faculty and students can borrow books.
  • The librarian will be the one to add books, delete books and edit book information as well as perform the function of returning books.
  • User-friendly interface.
  • Features clear transparency, good security as well as the ability to develop in the future. 2. Usecase Diagram Diagram: Explanation:

Target specification: Librarians can search books by name or Id. Description: The librarian selects the book search item; the search message panel appears asking to enter the name or book ID. After entering, the system does the task of searching and outputting book information according to the id (name) entered.

  • Specification Name: View Full Book (Librarian). Specification goal: Allow librarians to view all existing books in the library. Description: librarian selects to view all books in the program, all the details of the book will be displayed on the screen for the librarian.
  • Specification name: Add book (Librarian). Specification Objective: Allow librarians to add new books to the library. Description: The librarian chooses to add a new book in the program, then adds the necessary information of the book and clicks save. Once saved, the book will be added and will be displayed if needed.
  • Specification name: Delete book (Librarian). Specification Objective: Allow librarians to delete existing books in the library. Description: librarian chooses to delete books in the program and enter the book id to delete, then press delete. The program will find the correct books entered by the librarian and delete them and then notify them that they have been deleted.
  • Specification name: Edit book information (Librarian). Specification goal: Allow librarians to edit information about books already in the library. Description: librarians choose to edit book information in the program, then pass in the book id to edit. The book information that matches the input id will jump out and the librarian can correct it, then press update, the new information will be saved in the program.Librarian functions:
  • Librarians can add books.
  • Librarians can delete books.
  • Librarians can edit book information.
  • The librarian performs the function of returning books.
  • Librarians can search for book information.
  • Librarians can view information of available books. 3. Class Diagram Diagram