Giáo Trình Công Nghệ Phần Mềm: Phân Tích và Thiết Kế Hướng Đối Tượng Với UML

Giáo trình kỹ thuật về công nghệ phần mềm, biên soạn theo chương trình đào tạo chuẩn, hệ thống hóa kiến thức từ cơ bản đến nâng cao.

Trường đại học

Trường Đại Học

Chuyên ngành

Công Nghệ Phần Mềm

Người đăng

Ẩn danh

Thể loại

Tài Liệu Hướng Dẫn

2023

123
2
0

Phí lưu trữ

35 Point

Mục lục chi tiết

Contents

1. Chapter 1: An Introduction to the UML

1.1. What is the UML?

1.2. A Common Language

1.3. Summary

2. Chapter 2: The UML within a Development Process

2.1. The UML as a Notation

2.2. The Waterfall Model

2.3. The Spiral Model

2.4. Iterative, Incremental Frameworks

2.5. Inception

2.6. Elaboration

2.7. Construction

2.8. Transition

2.9. How Many Iterations? How Long Should They Be?

2.10. Time Boxing

2.11. Typical Project Timings

2.12. The Rational Unified Process

2.13. Summary

3. OBJECT ORIENTATION

3.1. Structured Programming

3.2. The Object Orientated Approach

3.3. Encapsulation

3.4. Objects

3.5. Terminology

3.6. The Object Oriented Strategy

3.7. Summary

4. AN OVERVIEW OF THE UML

4.1. The Use Case Diagram

4.2. The Class Diagram

4.3. Collaboration Diagrams

4.4. Sequence Diagram

4.5. State Diagrams

4.6. Package Diagrams

4.7. Component Diagrams

4.8. Deployment Diagrams

4.9. Summary

5. THE INCEPTION PHASE

6. THE ELABORATION PHASE

6.1. Deliverables

6.2. Summary

7. USE CASE MODELLING

7.1. Actors

7.2. The Purpose of Use Cases

7.3. Use Case Granularity

7.4. Use Case Descriptions

7.5. Use Cases at the Elaboration Phase

7.6. Finding Use Cases

7.7. Joint Requirements Planning Workshops (JRP)

7.8. Brainstorming Advice

7.9. Summary

8. CONCEPTUAL MODELLING

8.1. Finding Concepts

8.2. Extracting Concepts From Requirements

8.3. The Conceptual Model in the UML

8.4. Finding Attributes

8.5. Guidelines for Finding Attributes

8.6. Associations

8.7. Possible Cardinalities

8.8. Building the Complete Model

8.9. Summary

9. RANKING USE CASES

9.1. Summary

10. THE CONSTRUCTION PHASE

10.1. Construction

10.2. Summary

11. THE CONSTRUCTION PHASE : ANALYSIS

11.1. Back to the Use Cases

11.2. Main Flow

11.3. Alternate Flows

11.4. Exception Flows

11.5. The Complete Use Case

11.6. The UML Sequence Diagram

11.7. Summary

12. THE CONSTRUCTION PHASE : DESIGN

12.1. Design - Introduction

12.2. Collaboration of Objects in Real Life

12.3. Collaboration Diagrams

12.4. Collaboration Syntax : The Basics

12.5. Collaboration Diagrams : Looping

12.6. Collaboration Diagrams : Creating new objects

12.7. Message Numbering

12.8. Collaboration Diagrams : Worked Example

12.9. Some Guidelines For Collaboration Diagrams

12.10. Chapter Summary

13. DESIGN CLASS DIAGRAMS

13.1. Crediting and Debiting Accounts

13.2. Step 1 : Add Operations

13.3. Step 2 : Add Navigability

13.4. Step 3 : Enhance Attributes

13.5. Step 4 : Determine Visibility

13.6. Aggregation

13.7. Composition

13.8. Finding Aggregation and Composition

13.9. Summary

14. RESPONSIBILITY ASSIGNMENT PATTERNS

14.1. The GRASP Patterns

14.2. What is a pattern?

14.3. Grasp 1 : Expert

14.4. Grasp 2 : Creator

14.5. Grasp 3 : High Cohesion

14.6. Grasp 4 : Low Coupling

14.7. Grasp 5 : Controller

14.8. Summary

15. INHERITANCE

15.1. Inheritance – the basics

15.2. Inheritance is White Box Reuse

15.3. The 100% Rule

15.4. Substitutability

15.5. The Is-A-Kind-Of Rule

15.6. Example - Reusing queues through inheritance

15.7. Problems With Inheritance

15.8. Visibility of Attributes

15.9. Polymorphism

15.10. Abstract Classes

15.11. The Power of Polymorphism

15.12. Summary

16. SYSTEM ARCHITECTURE - LARGE AND COMPLEX SYSTEMS

16.1. The UML Package Diagram

16.2. Elements Inside a Package

16.3. Why Packaging?

16.4. Some Packaging Heuristics

16.5. Expert

16.6. High Cohesion

16.7. Loose Coupling

16.8. Handling Cross Package Communication

16.9. The Facade Pattern

16.10. Architecture-Centric Development

16.11. Example

16.12. Handling Large Use Cases

16.13. The Construction Phase

16.14. Summary

17. MODELLING STATES

17.1. Example Statechart

17.2. State Diagram Syntax

17.3. Substates

17.4. Entry/Exit Events

17.5. Send Events

17.6. Guards

17.7. History States

17.8. Other Uses for State Diagrams

17.9. Summary

18. TRANSITION TO CODE

18.1. Synchronising Artifacts

18.2. Mapping Designs to Code

18.3. Defining the Methods

18.4. Step 1

18.5. Step 2

18.6. Step 3

18.7. Step 4

18.8. Mapping Packages into Code

18.9. In Java

18.10. In C++

18.11. The UML Component Model

18.12. Ada Components

18.13. Summary

BIBLIOGRAPHY

Tóm tắt

I. Hướng Dẫn Toàn Diện Về Công Nghệ Phần Mềm và UML

Công nghệ phần mềm và mô hình UML là hai khái niệm quan trọng trong lĩnh vực phát triển phần mềm. Công nghệ phần mềm bao gồm các phương pháp, công cụ và quy trình để phát triển, triển khai và bảo trì phần mềm. Trong khi đó, UML (Unified Modeling Language) là một ngôn ngữ mô hình hóa đồ họa giúp mô tả các thành phần của hệ thống phần mềm. Bài viết này sẽ cung cấp cái nhìn tổng quan về công nghệ phần mềm và cách mà UML hỗ trợ trong quá trình phát triển phần mềm.

1.1. Tổng Quan Về Công Nghệ Phần Mềm

Công nghệ phần mềm bao gồm các phương pháp và công cụ để phát triển phần mềm hiệu quả. Các quy trình như phân tích yêu cầu, thiết kế phần mềm, và kiểm thử phần mềm là những bước quan trọng trong quy trình phát triển. Việc áp dụng các phương pháp hiện đại như Agile giúp tăng cường khả năng thích ứng và cải tiến quy trình phát triển.

1.2. Giới Thiệu Về Mô Hình UML

Mô hình UML là một ngôn ngữ tiêu chuẩn trong phát triển phần mềm, giúp các nhà phát triển giao tiếp và mô tả hệ thống một cách rõ ràng. UML cung cấp nhiều loại biểu đồ như biểu đồ lớp, biểu đồ tuần tự, và biểu đồ trạng thái để mô tả các khía cạnh khác nhau của hệ thống phần mềm.

II. Những Thách Thức Trong Phát Triển Phần Mềm và UML

Phát triển phần mềm không phải là một nhiệm vụ dễ dàng. Các thách thức như quản lý yêu cầu, thay đổi công nghệ, và khó khăn trong giao tiếp giữa các bên liên quan thường xuyên xảy ra. UML có thể giúp giải quyết những vấn đề này bằng cách cung cấp một ngôn ngữ chung cho tất cả các bên liên quan.

2.1. Vấn Đề Quản Lý Yêu Cầu

Quản lý yêu cầu là một trong những thách thức lớn nhất trong phát triển phần mềm. Việc không hiểu rõ yêu cầu của khách hàng có thể dẫn đến sản phẩm không đáp ứng được mong đợi. UML giúp mô tả yêu cầu thông qua biểu đồ use case, giúp các bên liên quan hiểu rõ hơn về chức năng của hệ thống.

2.2. Khó Khăn Trong Giao Tiếp

Giao tiếp giữa các thành viên trong nhóm phát triển và khách hàng có thể gặp khó khăn. UML cung cấp một ngôn ngữ hình ảnh giúp giảm thiểu sự hiểu lầm và tăng cường khả năng giao tiếp. Các biểu đồ UML giúp minh họa rõ ràng các khía cạnh của hệ thống, từ đó cải thiện sự hiểu biết chung.

III. Phương Pháp Phát Triển Phần Mềm Hiệu Quả Với UML

Để phát triển phần mềm hiệu quả, việc áp dụng các phương pháp như AgileScrum kết hợp với UML là rất cần thiết. Những phương pháp này giúp tăng cường khả năng phản hồi và cải tiến quy trình phát triển phần mềm.

3.1. Phương Pháp Agile Trong Phát Triển Phần Mềm

Phương pháp Agile tập trung vào việc phát triển phần mềm theo từng giai đoạn ngắn, cho phép phản hồi nhanh chóng từ khách hàng. UML có thể được sử dụng để mô tả các yêu cầu và quy trình trong từng giai đoạn, giúp đảm bảo rằng sản phẩm cuối cùng đáp ứng được mong đợi.

3.2. Sử Dụng UML Trong Quy Trình Scrum

Trong quy trình Scrum, UML có thể được sử dụng để tạo ra các biểu đồ mô tả các vai trò, nhiệm vụ và quy trình làm việc. Điều này giúp các thành viên trong nhóm hiểu rõ hơn về công việc của nhau và cải thiện hiệu suất làm việc.

IV. Ứng Dụng Thực Tiễn Của UML Trong Phát Triển Phần Mềm

UML không chỉ là lý thuyết mà còn có nhiều ứng dụng thực tiễn trong phát triển phần mềm. Các công ty lớn đã áp dụng UML để cải thiện quy trình phát triển và tăng cường chất lượng sản phẩm.

4.1. Các Công Ty Sử Dụng UML Thành Công

Nhiều công ty công nghệ lớn như Microsoft và IBM đã áp dụng UML trong quy trình phát triển phần mềm của họ. Việc sử dụng UML giúp họ cải thiện khả năng giao tiếp và giảm thiểu rủi ro trong phát triển sản phẩm.

4.2. Kết Quả Nghiên Cứu Về UML

Nghiên cứu cho thấy rằng việc sử dụng UML trong phát triển phần mềm giúp tăng cường hiệu quả và giảm thiểu lỗi. Các biểu đồ UML giúp các nhà phát triển dễ dàng hình dung và hiểu rõ hơn về hệ thống, từ đó cải thiện chất lượng sản phẩm.

V. Kết Luận Về Công Nghệ Phần Mềm và UML

Công nghệ phần mềm và UML đóng vai trò quan trọng trong việc phát triển sản phẩm chất lượng cao. Việc áp dụng UML giúp cải thiện quy trình phát triển và tăng cường khả năng giao tiếp giữa các bên liên quan. Tương lai của công nghệ phần mềm sẽ tiếp tục phát triển với sự hỗ trợ của các công cụ và phương pháp hiện đại.

5.1. Tương Lai Của Công Nghệ Phần Mềm

Công nghệ phần mềm sẽ tiếp tục phát triển với sự xuất hiện của các công nghệ mới như trí tuệ nhân tạo và học máy. UML sẽ cần được cập nhật để phù hợp với các xu hướng mới này.

5.2. Tầm Quan Trọng Của UML Trong Tương Lai

UML sẽ vẫn giữ vai trò quan trọng trong việc mô hình hóa và phát triển phần mềm. Việc cải tiến và phát triển UML sẽ giúp các nhà phát triển dễ dàng hơn trong việc giao tiếp và mô tả hệ thống phần mềm.

27/07/2025

Trích đoạn nội dung tài liệu

OOAD with UML Object Oriented Analysis and Design Using the UML 2 UML Applied - Object Oriented Analysis and Design using the UML 3 UML Applied - Object Oriented Analysis and Design using the UML Contents AN INTRODUCTION TO THE UML 7 What is the UML? 7 A Common Language 7 Summary 9 THE UML WITHIN A DEVELOPMENT PROCESS 10 The UML as a Notation 10 The Waterfall Model 10 The Spiral Model 12 Iterative, Incremental Frameworks 13 Inception 13 Elaboration 14 Construction 14 Transition 15 How Many Iterations? How Long Should They Be? 15 Time Boxing 16 Typical Project Timings 16 The Rational Unified Process 17 Summary 18 OBJECT ORIENTATION 19 Structured Programming 19 The Object Orientated Approach 22 Encapsulation 23 Objects 23 Terminology 24 The Object Oriented Strategy 24 Summary 25 AN OVERVIEW OF THE UML 26 The Use Case Diagram 27 The Class Diagram 28 Collaboration Diagrams 29 Sequence Diagram 30 State Diagrams 31 Package Diagrams 32 Component Diagrams 33 Deployment Diagrams 34 Summary 34 THE INCEPTION PHASE 35 4 UML Applied - Object Oriented Analysis and Design using the UML THE ELABORATION PHASE 37 Deliverables 37 Summary 38 USE CASE MODELLING 39 Actors 39 The Purpose of Use Cases 40 Use Case Granularity 41 Use Case Descriptions 43 Use Cases at the Elaboration Phase 43 Finding Use Cases 44 Joint Requirements Planning Workshops (JRP) 44 Brainstorming Advice 45 Summary 45 CONCEPTUAL MODELLING 46 Finding Concepts 47 Extracting Concepts From Requirements 47 The Conceptual Model in the UML 48 Finding Attributes 49 Guidelines for Finding Attributes 50 Associations 50 Possible Cardinalities 51 Building the Complete Model 51 Summary 53 RANKING USE CASES 54 Summary 55 THE CONSTRUCTION PHASE 56 Construction 56 Summary 57 THE CONSTRUCTION PHASE : ANALYSIS 58 Back to the Use Cases 58 1. Main Flow 59 Alternate Flows 60 Exception Flows 60 The Complete Use Case 61 The UML Sequence Diagram 61 Summary 63 5 UML Applied - Object Oriented Analysis and Design using the UML THE CONSTRUCTION PHASE : DESIGN 64 Design - Introduction 64 Collaboration of Objects in Real Life 65 Collaboration Diagrams 66 Collaboration Syntax : The Basics 66 Collaboration Diagrams : Looping 68 Collaboration Diagrams : Creating new objects 68 Message Numbering 68 Collaboration Diagrams : Worked Example 69 Some Guidelines For Collaboration Diagrams 72 Chapter Summary 73 DESIGN CLASS DIAGRAMS 74 Crediting and Debiting Accounts 74 Step 1 : Add Operations 75 Step 2 : Add Navigability 75 Step 3 : Enhance Attributes 75 Step 4 : Determine Visibility 76 Aggregation 76 Composition 77 Finding Aggregation and Composition 77 Summary 77 RESPONSIBILITY ASSIGNMENT PATTERNS 78 The GRASP Patterns 78 What is a pattern? 78 Grasp 1 : Expert 78 Grasp 2 : Creator 80 Grasp 3 : High Cohesion 81 Grasp 4 : Low Coupling 83 Grasp 5 : Controller 86 Summary 87 INHERITANCE 88 Inheritance – the basics 88 Inheritance is White Box Reuse 90 The 100% Rule 91 Substitutability 91 The Is-A-Kind-Of Rule 92 Example - Reusing queues through inheritance 92 Problems With Inheritance 94 Visibility of Attributes 95 Polymorphism 96 Abstract Classes 97 The Power of Polymorphism 98 Summary 99 6 UML Applied - Object Oriented Analysis and Design using the UML SYSTEM ARCHITECTURE - LARGE AND COMPLEX SYSTEMS 100 The UML Package Diagram 100 Elements Inside a Package 101 Why Packaging? 101 Some Packaging Heuristics 102 Expert 102 High Cohesion 102 Loose Coupling 102 Handling Cross Package Communication 102 The Facade Pattern 104 Architecture-Centric Development 105 Example 105 Handling Large Use Cases 106 The Construction Phase 107 Summary 107 MODELLING STATES 108 Example Statechart 108 State Diagram Syntax 109 Substates 110 Entry/Exit Events 111 Send Events 111 Guards 111 History States 112 Other Uses for State Diagrams 112 Summary 113 TRANSITION TO CODE 114 Synchronising Artifacts 114 Mapping Designs to Code 115 Defining the Methods 117 Step 1 118 Step 2 118 Step 3 119 Step 4 119 Mapping Packages into Code 119 In Java 119 In C++ 120 The UML Component Model 120 Ada Components 121 Summary 121 BIBLIOGRAPHY 123 7 UML Applied - Object Oriented Analysis and Design using the UML Chapter 1 An Introduction to the UML What is the UML? The Unified Modelling Language, or the UML, is a graphical modelling language that provides us with a syntax for describing the major elements (called artifacts in the UML) of software systems. In this course, we will explore the main aspects of the UML, and describe how the UML can be applied to software development projects. Through to its core, UML leans towards object oriented software development, so in this course, we will also explore some of the important principles of object orientation.

In this short chapter, we’ll look at the origins of the UML, and we’ll discuss the need for a common language in the software industry. Then we will start to look at how to exploit the UML on a software project. A Common Language Other industries have languages and notations, which are understood by every member of that particular field. Figure 1 - A Mathematical Integral Although the picture above is a fairly simple drawing (a stylised "S" figure), mathematicians the world over recognise instantly that I am representing an integral.

Although this notation is simple, it masks a very deep and complicated topic (though perhaps not as deep as the concept represented by the figure of eight on its side!) So the notation is simple, but the payoff is that mathematicians all around the world can clearly and unambiguously communicate their ideas using this, and a small collection 8 UML Applied - Object Oriented Analysis and Design using the UML of other symbols. Mathematicians have a common language. So do musicians, electronic engineers, and many other disciplines and professions. To date, Software Engineering has lacked such a notation.

Between 1989 and 1994, a period referred to as the “method wars”, more than 50 software modelling languages were in common use – each of them carrying their own notations! Each language contained syntax peculiar to itself, whilst at the same time, each language had elements which bore striking similarities to the other languages. To add to the confusion, no one language was complete, in the sense that very few software practitioners found complete satisfaction from a single language! In the mid 1990’s, three methods emerged as the strongest. These three methods had begun to converge, with each containing elements of the other two. Each method had its own particular strengths: • Booch was excellent for design and implementation.

Grady Booch had worked extensively with the Ada language, and had been a major player in the development of Object Oriented techniques for the language. Although the Booch method was strong, the notation was less well received (lots of cloud shapes dominated his models - not very pretty!) • OMT (Object Modelling Technique) was best for analysis and data-intensive information systems. • OOSE (Object Oriented Software Engineering) featured a model known as Use Cases. Use Cases are a powerful technique for understanding the behaviour of an entire system (an area where OO has traditionally been weak).

In 1994, Jim Rumbaugh, the creator of OMT, stunned the software world when he left General Electric and joined Grady Booch at Rational Corp. The aim of the partnership was to merge their ideas into a single, unified method (the working title for the method was indeed the "Unified Method"). By 1995, the creator of OOSE, Ivar Jacobson, had also joined Rational, and his ideas (particularly the concept of "Use Cases") were fed into the new Unified Method - now called the Unified Modelling Language1. The team of Rumbaugh, Booch and Jacobson are affectionately known as the "Three Amigos".

Despite some initial wars and arguments, the new method began to find favour amongst the software industry, and a UML consortium was formed. Heavyweight corporations were part of the consortium, including Hewlett-Packard, Microsoft and Oracle. The UML was adopted by the OMG2 in 1997, and since then the OMG have owned and maintained the language. Therefore, the UML is effectively a public, non- proprietary language.

1 Officially, the spelling is "modeling", but I favour the English spelling 2 The OMG are the Object Management Group, an industry wide, non profit making standards body.org for full details. 9 UML Applied - Object Oriented Analysis and Design using the UML Summary The UML is a graphical language for capturing the artifacts of software developments. The language provides us with the notations to produce models. The UML is gaining adoption as a single, industry wide language.

The UML was originally designed by the Three Amigos at Rational Corp. The language is very rich, and carries with it many aspects of Software Engineering best practice. 10 UML Applied - Object Oriented Analysis and Design using the UML Chapter 2 The UML within a Development Process The UML as a Notation The Three Amigos, when developing the UML, made a very clear decision to remove any process based issues from the language. This was because processes are very contentious - what works for company A might be a disaster for company B.

A defence company requires much more documentation, quality and testing than (say) an e-commerce company. So the UML is a generic, broad language enabling the key aspects of a software development to be captured on "paper". In other words, the UML is simply a language, a notation, a syntax, whatever you want to call it. Crucially, it does not tell you how to develop software.

To learn how to use the UML effectively, however, we will follow a simple process on this course, and try to understand how the UML helps at each stage. To start with, let's have a look at some common software processes. The Waterfall Model Figure 2 - The traditional “Waterfall” model 11 UML Applied - Object Oriented Analysis and Design using the UML The waterfall model prescribes that each stage must be complete before the next stage can commence. This simplistic (and easy to manage) process begins to break down as the complexity and size of the project increases.

The main problems are: • Even large systems must be fully understood and analysed before progress can be made to the design stage. The complexity increases, and becomes overwhelming for the developers. • Risk is pushed forward. Major problems often emerge at the latter stages of the process – especially during system integration.

Ironically, the cost to rectify errors increase exponentially as time progresses. • On large projects, each stage will run for extremely long periods. A two-year long testing stage is not necessarily a good recipe for staff retention! Figure 3 –Over time on the waterfall, both the risks and the cost to rectify errors increase Also, as the analysis phase is performed in a short burst at the outset of the project, we run a serious risk of failing to understand the customer’s requirements. Even if we follow a rigid requirements management procedure and sign off requirements with the customer, the chances are that by the end of Design, Coding, Integration and Testing, the final product will not necessarily be what the customer wanted.

Having said all the above, there is nothing wrong with a waterfall model, providing the project is small enough. The definition of "small enough" is subjective, but essentially, if the project can be tackled by a small team of people, with each person able to understand every aspect of the system, and if the lifecycle is short (a few 12 UML Applied - Object Oriented Analysis and Design using the UML months), then the waterfall is a valuable process. It is much better than chaotic hacking! In summary, the waterfall model is easy to understand and simple to manage. But the advantages of the model begin to break down once the complexity of the project increases.

The Spiral Model An alternative approach is the spiral model.

Nội dung được bảo vệ bản quyền — Tải xuống đầy đủ