Assignment 1 Advanced Programming (1651 Distinction)

65 2 0
Assignment 1 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 P1 P2 M1 M2 D1 D2  Summative Feedback: Grade: Lecturer Signature:  Resubmission Feedback: Assessor Signature: Date: Table of Contents INTRODUCTION CHAPTER OOP GENERAL CONCEPTS 10 I Object-oriented programming (OOP) 10 Definition 10 Benefits and drawbacks .10 II Object and class 11 Class 11 1.1 Definition 11 1.2 Class diagram 12 1.3 Code 12 Object 13 2.1 Definition 13 2.2 Code 13 Class and Object Comparison .13 Class 14 Object 14 Class and Object comparison .14 III Encapsulation 14 Definition 14 Advantages and disadvantages 14 UML and code 15 IV Inheritance 17 Definition 17 Advantages and disadvantages 17 Types of inheritance 18 3.1 Single inheritance 18 3.2 Multilevel inheritance 18 3.3 Multiple inheritance 19 3.4 Multipath inheritance 20 3.5 Hierarchical inheritance .20 3.6 Hybrid inheritance 21 Class diagram and code 22 V Polymorphism 24 Definition 24 Advantages and disadvantages 25 Class diagram and code 26 VI Abstraction 28 Definition 28 Types of abstraction 28 2.1 Data abstraction 28 2.1 Process abstraction 29 Advantages and disadvantages 30 Class diagram and code 31 CHAPTER DESIGN AND BUILD CLASS DIAGRAMS USING UML TOOLS 34 I Theory of UML 34 Definition 34 Types of UML diagram 34 II Diagrams 35 Use-Case diagram 35 1.1 Definition 35 1.2 Notations 36 1.3 Advantages and disadvantages 37 1.4 Example .37 Class diagram 39 2.1 Definition 39 2.2 Notations 39 2.3 Advantages and disadvantages 41 2.4 Example .42 Sequence diagram 43 3.1 Definition 43 3.2 Notations 43 3.3 Advantages and disadvantages 44 3.4 Example .45 CHAPTER DESIGN PATTERN 46 I Overview 46 Definition 46 Types of design patterns 47 Advantages and disadvantages of design patterns .47 II Creational patterns 48 Singleton pattern 48 1.1 Definition 48 1.2 Advantages and disadvantages 48 1.3 Class diagram 49 1.4 Code example 49 III Structural patterns 51 Facade pattern .51 1.1 Definition 51 1.2 Advantages and disadvantages 52 1.3 Class diagram 52 1.4 Code example 53 IV Behavioral patterns 54 Command pattern 54 1.1 Definition 54 1.2 Advantages and disadvantages 54 1.3 Class diagram 55 1.4 Code example 55 CHAPTER DESIGN PATTERN AND OOP 58 I Relationship between OOP and Design pattern 58 II Analyzing OOP through design patterns 59 III Analyzing OOP through scenario 61 CONCLUSION 63 REFERENCE LIST 64 Table of Figures Figure OOP abbreviation 10 Figure Class diagram of MobilePhone 12 Figure MobilePhone's code implementation 12 Figure Object's code implementation 13 Figure MobilePhone's class diagram 15 Figure MobilePhone's code implementation 16 Figure Code implementation in Main 16 Figure Single Inheritance illustration 18 Figure Multi-Level inheritance illustration 19 Figure 10 Multiple inheritance illustration 19 Figure 11 Multipath inheritance illustration 20 Figure 12 Hirachical inheritance illustration 21 Figure 13 Hybrid inheritance illustration 21 Figure 14 Inheritance class diagram 22 Figure 15 Parent class code implementation 22 Figure 16 Son class code implementation 23 Figure 17 Object initialization code 23 Figure 18 Result of code 24 Figure 19 Polymorphism concepts 25 Figure 20 Polymorphism class diagram example 26 Figure 21 Code implementation 27 Figure 22 Result of code 27 Figure 23 Data abstraction illustration 29 Figure 24 Process abstraction illustration 29 Figure 25 Abstraction class diagram example 31 Figure 26 Shape abstract class code implementation 31 Figure 27 Circle class code implemetation 32 Figure 28 Rectangle class code implementation 32 Figure 29 Result of code 33 Figure 30 Types of UML diagrams 35 Figure 31 UseCase of Inventory management system 38 Figure 32 Inheritance relationship 39 Figure 33 Association relationship 40 Figure 34 Aggregation relationship 40 Figure 35 Composition relationship 41 Figure 36 Implementation relationship 41 Figure 37 Class diagram example 42 Figure 38 Class diagram example 45 Figure 39 Design pattern 46 Figure 40 Singleton class diagram 49 Figure 41 Singleton class code implementation 50 Figure 42 Result of code 50 Figure 43 Lock code implementation 51 Figure 44 Facade's class diagram 52 Figure 45 Subsystems code implementation 53 Figure 46 Facade code implementation 53 Figure 47 Result of code 54 Figure 48 Command's class diagram 55 Figure 49 Receiver class code implementation 55 Figure 50 ICommand and Concrete code implementation 56 Figure 51 Sender class code implementation 57 Figure 52 Result of code 57 Figure 53 Lego bricks illustration 58 Figure 54 Singleton pattern class diagram 59 Figure 55 Facade pattern class diagram 60 Figure 56 Command pattern class diagram 60 Figure 57 Airplane ticket system's class diagram 61 Table of Tables Table Class and Object Comparison 14 Table Symbols of Use Case diagram 36 Table Relationship in Use Case diagram 36 Table Notations of Sequence diagram 43 INTRODUCTION In this report, I will explore the fundamental elements of the object-oriented programming model (OOP) by applying object-oriented design and analysis to a hypothetical scenario I will enlighten various characteristics of OOP, such as encapsulation, inheritance, polymorphism, and abstraction To gain a deeper understanding of them, I will provide diagrams and code for each aspect The second part of the assignment involves introducing some types of UML diagrams for objectoriented analysis and design These diagrams include use case and class diagrams For each type of diagram, I will offer examples and explanations The final objective is to present various design patterns, which encompass creational, structural, and behavioral patterns These patterns will be illustrated with diagrams, and I will explain how to implement them using class diagrams and the C# language CHAPTER OOP General Concepts I Object-oriented programming (OOP) Definition Object-oriented programming (OOP) is a way of designing computer programs Instead of focusing on functions and rules, it revolves around data and objects An object is like a data container with special traits and actions OOP is useful for big and complex programs that change often It's great for things like making software for manufacturing or mobile apps, even simulating manufacturing systems In OOP, programs are organized in a way that makes it easy for a group of people to work together This approach also promotes reusing code, adapting to different sizes, and being efficient Figure OOP abbreviation Benefits and drawbacks There are several advantages of OOP including:    Modularity: Objects are like self-contained units, making it easier to find and fix problems, and to work together on projects Reusability: You can reuse code, so you don't have to write the same stuff over and over Productivity: You can create new programs faster using pre-made code and libraries

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

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

Tài liệu liên quan