Assignment 2 Advanced Programming (1651 Distinction)

71 4 2
Assignment 2 Advanced Programming (1651 Distinction)

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Học phần này giới thiệu cho sinh viên các khái niệm cốt lõi của lập trình cùng với phần giới thiệu về các thuật toán và đặc điểm của mô hình lập trình. Trong số các chủ đề trong phần này bao gồm: giới thiệu về thuật toán, lập trình hướng đối tượng và hướng sự kiện, các cân nhắc về bảo mật, môi trường phát triển tích hợp và quy trình gỡ lỗi.

ASSIGNMENT FRONT SHEET Qualification BTEC Level 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 Bui Quang Minh Student ID GCD210325 Class GCD1104 Assessor name Nguyen The Nghia 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 P3 Page | P4 M3 M4 D3 D4  Summative Feedback: Grade: Lecturer Signature: Page |  Resubmission Feedback: Assessor Signature: Date: Table of Contents INTRODUCTION CHAPTER SCENARIO ANALYSIS I Scenario II Diagrams Class diagrams UseCase diagrams CHAPTER IMPLEMENTATION 12 I Code 12 Fund class 12 StockBroker class 13 Investor class 15 FundService class 18 StockBrokerService class 19 InvestorService class 21 Data class 22 CheckValid class 22 Main method 24 10 CreateAccountPage class 26 11 BrokerPage class 27 12 InvestorPage class 28 II Program Execution 30 Broker 30 Investor 33 Create Account 35 CHAPTER DISCUSSION 37 I Design patterns 37 Creational patterns 37 1.1 Singleton pattern 37 1.2 Factory method pattern 40 Structural patterns 43 2.1 Faỗade pattern 43 Page | 2.2 Composite pattern 46 Behavioral patterns 49 3.1 Command pattern 49 3.2 Observer pattern 53 II Similar design patterns 56 Sington and Factory method patterns 56 1.1 Singleton pattern 56 1.2 Factory method pattern 58 Observer and Composite patterns 61 2.1 Observer pattern 61 2.2 Composite pattern 63 Detailed explaination 63 3.1 Singleton and Factory method patterns 63 3.2 Observer and composite patterns 64 III Usage of my design pattern 66 Observer design pattern 66 Singleton pattern 66 CONCLUSION 67 REFERENCE LIST 70 Page | INTRODUCTION In the previous assignment, I discussed the OOP, UML, and some crucial design patterns that I have learnt in class In this report, I will start by examining a hypothetical scenario We'll break it down using diagrams, which are like visual aids to help me understand better I will create two types of diagrams: class diagrams and use case diagrams Next, I will dive into the technical side of things We'll look at the code, which is like the instructions that make software work Then, we'll see how these instructions come to life through program execution In this last chapter, I will discuss design patterns, which are like problem-solving techniques for software Also, explore different design patterns and talk about how they can be used Finally, I will look at the advantages and disadvantages of the design pattern I chose Page | CHAPTER SCENARIO ANALYSIS I Scenario "Have you ever wondered how to make investing in funds easier, especially for people who don't have much experience in this complex world? That's the puzzle I'm tackling with the 'MB Capital Fund Management System.' Investing can be like putting together a big puzzle There are lots of pieces to consider, from choosing the right funds to managing your money and ensuring everything goes smoothly People often struggle with these parts, and that's where our system comes in Now, let me introduce you to the 'MB Capital Fund Management System.' It's like a helpful tool we're building to make investing simpler I'm using special techniques to put all these pieces together in a neat and organized way I'll also create easy-to-understand drawings to map out how the software works By the end of this project, I'll have real experience in building software that solves these investment puzzles, making it easier for everyone It's like learning to build with building blocks while solving real-life challenges So, let's dive into the MB Capital Fund Management System!" Figure Capital Fund illustration Source: salesforce, 2016 Page | II Diagrams Class diagrams Figure Class Diagram (1) Investor Class: Attributes:      Name: This represents the name of the investor Gmail: The Gmail address is used as a unique identifier for login purposes Password: The password is also used for secure login Pin: A personal identification number, which is an additional security measure Balance: This reflects the amount of money available for placing orders Relationships:   An Investor is dependent on a single StockBroker (likely representing a brokerage firm) This relationship signifies that an investor is under the management of a particular stockbroker An Investor can own multiple Funds The connection between an investor and funds indicates the funds in which the investor has invested Methods:  Page | Deposit: This method allows the investor to add money to their balance It ensures that the deposited amount is greater than zero    Withdraw: Investors can withdraw money from their balance, provided the withdrawal amount is both positive and within the available balance PlaceOrder: Investors can use this method to buy new funds The method associates the investor with the purchased fund DisplayFunds: This method displays all the funds owned by the investor Fund Class: Attributes:     Name: The name of the fund Ticket: A code or identifier for the fund, akin to a unique reference InceptionDate: This is the date when the fund was initiated ManagementFee: The management fee associated with the fund  Amount: The amount of money invested in the fund by the investor Relationships:  Funds are associated with one or more Investors, signifying that multiple investors can invest in the same fund StockBroker Class: Attributes:     Name: The name of the stockbroker Gmail: The Gmail address for the stockbroker's login Password: The password used by the stockbroker for secure login isMarketChange: A state variable (likely a boolean) to track changes in the market, used in the Observer pattern Relationships:   StockBroker manages a list of Investors This relationship represents that the stockbroker is responsible for overseeing multiple investors StockBroker is associated with the Observer pattern, which is typically used for monitoring and notifying investors about market changes Methods:    Page | AddToZone: A method used for adding registered investors to the stockbroker's management zone This operation is part of the Observer pattern MarketChange: A method used to trigger changes in the market and notify investors about these changes This operation is also part of the Observer pattern DisplayMyInvestors: This method displays the list of investors that the stockbroker is managing Abstract Observer Class: Methods:   Update: This method is a part of the Observer pattern It allows observers (in this case, investors) to be notified of changes Investor (Inherited from Observer): Figure Class Diagram (2) Each of these services follows the singleton pattern, which ensures that there is only one instance of each service throughout the application FundService: Attributes:  List of Funds: This collection holds all the funds available in the system Methods:     AddFund: Used to add a new fund to the list of funds GetFund: Retrieves a specific fund from the list using a unique identifier, such as the fund's ticket GetFunds: Returns a list of all available funds DisplayFunds: Displays all the funds, which can be helpful for users to view the available investment options InvestorService: Attributes:  Page | List of Investors: This collection contains information about all the investors registered in the system Methods:  CheckAccount: Used for login purposes It verifies the credentials provided by an investor to authenticate their account  AddInvestor: Adds a new investor to the list of registered investors StockBrokerService: Attributes:  List of StockBrokers: This collection maintains information about all the stockbrokers in the system Methods:     CheckAccount: Similar to the CheckAccount method in the InvestorService, this is used for stockbrokers to log in GetBrokers: Returns a list of all stockbrokers GetBroker: Retrieves specific stockbroker information from the list DisplayMyInvestors: Displays the list of investors that a stockbroker is managing UseCase diagrams For the StockBroker: View Funds:  StockBrokers can view the available funds Manage Investors:  StockBrokers can manage the investors who are under their supervision Notify:  StockBrokers have the ability to notify investors when there is a market change or significant event This is a critical use case that involves keeping investors informed and updated about their investments Page |

Ngày đăng: 02/02/2024, 10:27

Tài liệu cùng người dùng

Tài liệu liên quan