Design Patterns in Software Engineering - Prof. Le Ngoc, Thesis of Data Acquisition

An overview of various design patterns in software engineering, including creational, structural, and behavioral patterns. It covers the key components of object-oriented programming, the purpose and benefits of using design patterns, and examples of specific patterns such as the factory, abstract factory, builder, singleton, adapter, composite, and command patterns. When and why these patterns are useful, and how they can be implemented using uml class diagrams and code examples. It aims to help software developers and architects understand the role of design patterns in creating flexible, reusable, and maintainable software systems.

Typology: Thesis

2021/2022

Uploaded on 12/28/2022

khang-djao-1
khang-djao-1 🇻🇳

5

(4)

5 documents

1 / 65

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Nationals in Computing
Unit 19:
ASSIGNMENT 2
Advanced Programming (1651)
Assessor name: LE NGOC THANH
Learner’s name: Đàonh Khang
ID: GCS200222
Class: GCS0905B
Subject code: 1651
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
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41

Partial preview of the text

Download Design Patterns in Software Engineering - Prof. Le Ngoc and more Thesis Data Acquisition in PDF only on Docsity!

Higher Nationals in Computing

Unit 19:

ASSIGNMENT 2

Advanced Programming (1651)

Assessor name: LE NGOC THANH

Learner’s name: Đào Vĩnh Khang

ID: GCS

Class: GCS0905B

Subject code: 1651

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 14 - 02 - 2022 Date Received 1st submission 14 - 02 - 2022 Re-submission Date Date Received 2nd submission Student Name DAO VINH KHANG Student ID GCS Class GCS0905B 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 KHANG Grading grid P1 P2 M1 M2 D1 D

ASSIGNMENT 2 BRIEF

Qualification BTEC Level 5 HND Diploma in Business 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 28 November 2022 Submission date IV name and date 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.

Learning Outcomes and Assessment Criteria Pass Merit Distinction LO1 Examine the key components related to the object-orientated programming paradigm, analysing design pattern types P3 Build an application derived from UML class diagrams.. M1 Determine a design pattern from each of the creational, structural and behavioural pattern types. D1 Analyse the relationship between the object-orientated paradigm and design patterns. LO2 Design a series of UML class diagrams P4 Discuss a range of design patterns with relevant examples of creational, structural 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.

I. Introduction Based on the class diagram created in assignment 1, in this assignment I will build an application derived from that UML class diagram. Then, I will cover a series of design patterns with relevant examples of creative, structural, and behavioral patterns. My report includes two parts: ÷ Build an application derived from UML class diagram. ÷ Design patterns. II. Build an application derived from UML class diagrams.

**1. Characteristics of the object-orientated paradigm

  • Object/Class:**

Explanation:

  • Here you can see the Object class at the top of the type hierarchy. Type 1 and Type 2 are reference types. Class 1 inherits the Object class while Class 2 inherits it directly using Class 1. Struct1 is a value type that implicitly inherits the Object class through the System.ValueType type. Result:

4 Result:

  • Encapsulation : Explanation:

5

  • In the above program the class Inheritance is encapsulated as the variables are declared as private. To access these private variables we are using the Name and Age accessors which contains the get and set method to retrieve and set the values of private fields. Accessors are defined as public so that they can access in other class. Result:

7 Explantion :

  • Here we are using labrador to access Name and display() then Inheritance. This can happen because the derived class inherits all the fields and methods of the base class. Also, we have access to the Field Name inside Inheritance class method.
    • Result:

Polymorphism :

Explaintion:

  • think of a base class called Animal that has a method called animalSound(). Derived classes of Animals could be Pigs, Cats, Dogs, Birds - And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.)::

Abstract Class: This is the way to achieve the abstraction in C#. An Abstract class is never intended to be instantiated directly. An abstract class can also be created without any abstract methods, We can mark a class abstract even if doesn’t have any abstract method. The Abstract classes are typically used to define a base class in the class hierarchy. Or in other words, an abstract class is an incomplete class or a special class we can’t be instantiated. The purpose of an abstract class is to provide a blueprint for derived classes and set some rules that the derived classes must implement when they inherit an abstract class. We can use an abstract class as a base class and all derived classes must implement abstract definitions.

  • Result: Interfaces:

Explaintion :

  • To access the interface methods, the interface must be "implemented" (kinda like inherited) by another class. To implement an interface, use the : symbol (just like with inheritance). The body of the interface method is provided by the "implement" class. Note that you do not have to use the override keyword when implementing an interface:Another way to achieve abstraction in C#, is with interfaces. An interface is a completely "abstract class", which can only contain abstract methods and properties (with empty bodies)
    • **Result:
  1. Coding Managing School System:** I have just signed a contract with FPT Greenwich University and am about to be appointed as a project leader for a group of programmers to develop the company's Product Management System. In this Product Management System, I was asked to create an application to store product listings and product listings. With the system, users can enter information about students and lecturers such as id, name, industry, & into the system, correct the information if it is wrong or completely delete the information of the product. See a list of all system9s objects. To create this system, I used C# language. My Product Management System includes the following features:
    1. Add an object
    2. Show object list
    3. Update object
  • Edit(): The first is to print out the information of the found ward, then print it, call the ShowMenu() method to print the value to be changed, and then call the DoTask() method to make that change and assign the return value of DoTask()a for choice. All this processing is placed in the while(true) loop if choice equal 0 will stop the loop. Menu():To print the value to be changed.
  • DoTask: ask the user to enter a selection each choice I use Switch-case to correspond to a function. Option 1,2,3 will call the Save() method and pass in that method a message as shown in the figure. Case 0 will print "Back to meu" and choices other than 0.1,2,3 will print "Invalid choice please try again!!!".
  • Save():Takes parameters from DoTask() passed in to perform the corresponding function, the purpose of this function is to ask the user if he is sure to change the data. MyObserver.cs
  • Have a Subject
  • Abstract class includes two attributes, name and, subject, with an access level of protected.
  • Constructor that assigns values to two attributes.
  • Abstract method Update() Overridden method ToString() to provide externally Observer's name

Analyst.cs