Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Advanced computer programing 1651, Exercises of Advanced Computer Programming

Advanced computer programing 1651

Typology: Exercises

2022/2023

Uploaded on 01/24/2024

cuong-djang
cuong-djang 🇻🇳

7 documents

1 / 44

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Nationals in Computing
Unit 20: Advanced Programming
Assignment 2
Learner’s name:
ID:
Class:
Subject code: 1651
Assessor name: PHAN MINH TAM
Assignment due: Assignment submitted:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c

Partial preview of the text

Download Advanced computer programing 1651 and more Exercises Advanced Computer Programming in PDF only on Docsity!

Higher Nationals in Computing

Unit 20: Advanced Programming

Assignment 2

Learner’s name:

ID:

Class:

Subject code: 1651

Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:

ASSIGNMENT 2 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 Student ID

Class 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

Grading grid

P 3 P 4 M 3 M 4 D3 D 4

ASSIGNMENT 2 BRIEF

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 2 : Advanced Programming

Assignment title Application development with class diagram and design patterns

Academic Year

Unit Tutor

Issue date Submission date

Submission Format:

Format: The submission is in the form of an individual 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/ together with zipped project files.

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 : (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. Tasks: Your team is now separated and perform similar tasks in parallel. You will choose one of the real scenarios that your team introduced about DP in previous phase, then implement that scenario based

on the corresponding class diagram your team created. You may need to amend the diagram if it is needed for your implementation. In additional, you should discuss a range of DPs related / similar to your DP, evaluate them against your scenario and justify your choice. In the end, you need to write a report with the following content:  A final version of the class diagram based on chosen scenario which has potential of using DP.  Result of a small program implemented based on the class diagram, explain how you translate from design diagram to code.  Discussion of a range of DPs related / similar to your DP, evaluate them against your scenario and justify your choice (why your DP is the most appropriate in that case). The working application must also be demonstrated. Learning Outcomes and Assessment Criteria Pass Merit Distinction LO 3 Implement code applying design patterns P3 Build an application derived from UML class diagrams. M3 Develop code that implements a design pattern for a given purpose. D3 Evaluate the use of design patterns for the given purpose specified in M3. LO4 Investigate scenarios with respect to design patterns P4 Discuss a range of design patterns with relevant examples of creational, structural and behavioral pattern types. M4 Reconcile the most appropriate design pattern from a range with a series of given scenarios. D4 Critically evaluate a range of design patterns against the range of given scenarios with justification of your choices.

  • Unit 20: Advanced Programming Assignment
  • P3. Build an application derived from UML class diagrams.................................................................
      1. Class diagram/ Update UML Class diagram from P2
      1. Explanation
      1. Code
      1. Solution Explorer in visual studio....................................................................................................................
      1. Application Screenshot
  • types........................................................................................................................................................................ P4 Discuss a range of design patterns with relevant examples of creational, structural and behavioral pattern
    • 1: Design patterns
      • 1.1 Definition
      • 1.2 Purpose of Design patterns.......................................................................................................................
      • 1.3 Type of design patterns
      1. Creational Design Pattern
      • 2.1 Singleton Design Patterns
      • 2.2 Factory Method Design Pattern................................................................................................................
      • 2.3 Abstract Factory Design Patterns
      • 2.4 Builder
      • 2.5 Prototype
      1. Structural Design Pattern................................................................................................................................
      • 3.1 Adapter
      • 3.2 Bridge
      • 3.3 Composite
      • 3.4 Decorator
      • 3.5 Façade
      • 3.6 Flyweight
      • 3.7 Proxy
    • 4: Behavioral Design Pattern
      • 4.1 Chain of Responsibility
      • 4.2 Command
      • 4.3 Iterator
      • 4.4 Mediator
      • 4.5 Memento
    • 4.6 Observer....................................................................................................................................................
    • 4.7 State
    • 4.8 Strategy
    • 4.9 Template Method
    • 4.10 Visitor
  • References

P3. Build an application derived from UML class diagrams.

  1. Class diagram/ Update UML Class diagram from P Figure 1 Class Diagram when update
  2. Explanation

Class diagram - Library management system:

Person : Class representing a person, be it a reader or a librarian.

Book : Class represents a book.

Borrower: Class represents one time of borrowing a book.

Figure 4 Borrower Class Class called Borrower. This class inherits from the Persons class. It has 5 public properties: ID, Name, and Phone, Address and TypeOfPosition. TypeOfPosition: An integer that identifies the borrower's location type. Figure 5 Librarian Class The Librarian class has two public properties, this class inherits from the Persons class WorkHour: An integer specifying the librarian's working hours. LibrarianRole: A string that identifies the librarian's role.

Figure 6 BookManager Class “BookManager”

 ListBooks: A list of Book objects.

 AddBook(): Method to add a Book object to the ListBooks list.

 ShowAllBooks(): Method that displays all Book objects in the ListBooks list.

 SearchBook(): Method to search for a Book object in the ListBooks list by title.

 RemoveBook(): Method to remove a Book object from the ListBooks list by title.

Figure 8 Client Menu Figure 9 Switch Case 1 - 4

Figure 10 Switch Case 5 - 9

  1. Solution Explorer in visual studio Figure 11 Solution AssignmentAP

Case 2: Show all Person

Figure 15 Show all Person

Case 3: Show Borrower

Figure 16 Show Borrower

Case 4: Search Person by ID

Figure 17 Search Person by ID

Case 5: Add a New Book

Figure 18 Add a New Book Figure 19 Add a new Book

Case 6: Show All Book

Figure 20 Show All Book

P4 Discuss a range of design patterns with relevant

examples of creational, structural and behavioral

pattern types.

1: Design patterns

1.1 Definition

Design patterns are basically defined as reusable solutions to the common problems that arise during software design and development. They are general templates or best practices that guide developers in creating well- structured, maintainable, and efficient code. (Geekforgeek, 2023) Figure 26 Design patterns in C#

1.2 Purpose of Design patterns

Reusability:

Design patterns promote the reuse of successful designs and solutions. Once a pattern is identified

and documented, it can be applied in different parts of a system or even across multiple projects.

Scalability:

Design patterns contribute to scalable and maintainable code. They provide a consistent way of

solving problems, making it easier to scale a software system by adding new features or components.

Abstraction:

Design patterns help abstract complex systems into more understandable and manageable

components. They provide a high-level view of the system architecture, allowing developers to focus

on specific areas without being overwhelmed by details.

Maintainability:

Using design patterns can improve the maintainability of code. When developers follow well-known

patterns, it becomes easier for others (or even the original developers) to understand, maintain, and

enhance the system.

1.3 Type of design patterns

There are three types of Design Patterns,

 Creational Design Pattern

 Structural Design Pattern

 Behavioral Design Pattern

1.3.1 Creational Design Pattern

Definition: Creational Design Pattern abstract the instantiation process. They help in making a system

independent of how its objects are created, composed and represented. (GeekforGeek, 2023)

There are 5 type of Creational Design Pattern:

Figure 27 type of Creational Design Pattern