PowerPoint 簡報

Download Report

Transcript PowerPoint 簡報

軟體開發概論
第三章、軟體發展程序
Understanding General Software
Development
1
目標領域矩陣
Objective Domain Matrix
Skills/Concepts
Understanding
Application Lifecycle
Management
Understanding Testing
Understanding Data
Structures
Understanding Sorting
Algorithms
MTA Exam Objectives
Understand application lifecycle
management (3.1)
Understand application lifecycle
management (3.1)
Understand algorithms and data
structures (3.3)
Understand algorithms and data
structures (3.3)
2
軟體生命週期管理

應用程式生命週期管理



軟體開發生命週期


Application Lifecycle Management (ALM)
軟體系統從無到有的過程
Software Development Lifecycle (SDLC)
建構管理(Configuration Management, CM)
軟體生命週期
需求
設計
維護
測試
開發
4
需求分析
Requirement Analysis



為什麼需要開發一套新系統?
誰出資?(Sponsor)
誰是專案經理?(Project Manager, PM)








專案核准證明(Project Charter)
誰是系統分析師?(System Analyzer)
誰是需求提供者?(Requirement Provider)
誰是行家?(Domain Expert)
誰是使用者?(User)
誰有決策者權?(Decision Maker)
利害關係人(Stakeholder)
需求規格書(Requirement Specification)

新系統究竟要提供那些功能?長成什麼模樣?具備那些特性?
需求種類
(Types of Requirement)

使用者需求(User Requirements)



以自然語言(Natural Language)和圖表(Diagrams)
說明系統能提供的服務及運作時的限制條件
(Operational Constraints)
使用者需求是專為客戶撰寫的
系統需求(System Requirements)


以結構化文件(Structured Document)更詳細描
述系統服務
系統需求為客戶(Client)與承包商(Contractor)間
的合約
功能性及非功能性需求

功能性需求(Functional Requirements)


非功能需求(Non-Functional Requirements)


說明系統所需提供的服務、系統對特殊的輸入
該如何回應以及系統在特殊情況下的行為等
系統提供之服務及功能的限制條件,例如時間
上的限制、開發程序上的限制和標準等
把需求條列出來(加上編號)

需求規格 => 測試案例 => 驗收項目
設計
Design

建立…

計畫(Plan)


模型(Model)


子系統(Subsystem)、模組(Module)、元件
(Component)、介面(Interface)
參與者(Participants)




雛型(Prototype)
架構(Architecture)


如何按部就班地完成軟體實作(Implementation)
系統分析師(System Analyzer, SA)
系統架構師(Architect)
使用者體驗設計師(User-Experience Designer)
設計規格書(Software Design Specification)
軟體開發/程式設計
Development

按照專案計畫書與設計規格書完成系統實作





參與者






撰寫程式
建立資料庫
單元測試(Unit Test)
整合測試(Integration Test)
開發人員(Developer)
資料庫管理師(Database Administrator, DBA)
技術文件寫手(Technical Writer)
內容開發人員(Content Developer)
交付項目(Deliverable)
發行版管理(Release Management)

版本控制(Version Control)
測試
Testing



品質管理
測試標的和設計文件之間的落差(Gap)
測試計畫書(Test Plan)

測試案例(Test Case)


測試報告(Test Report)




涵蓋度(Coverage)
收斂(Convergent)
臭蟲(Bug)、缺陷(Defect)、問題(Issue)
問題追蹤系統(Issue Tracking System)
參與者

測試人員(Tester)
Why BUG?
11
測試工作的金三角
Validation & Verification (V&V)
產品
Product
驗證
Verification
確認
Validation
需求
Need
確認
Validation
12
規格
Spec.
測試方法

黑箱測試(Black-box Testing)






專注於輸入與輸出
不理會系統的內部結構
確認產出符合需求
猴子測試(Monkey Testing)
壓力測試(Load Testing)
白箱測試(White-box Testing )


依據系統內部結構設計測試
確認介面的正確性


模組、子系統
測試程式(Test Program)
測試的分級

單元測試(Unit Testing)


整合測試(Integration Testing)


整體系統的測試
接受度測試(Acceptance Testing)




確認元件之間介面的正確性
系統測試(System Testing)


檢驗副程式或元件的正確性
使用者/客戶的測試
Alpha:特別選定的一小群使用者
Beta:大規模的一般使用者
迴歸測試(Regression Testing)

確認 Bug Fix 的結果不會影響系統的其他層面
資料結構
Data Structure

程式使用的資料都必須先載入記憶體





如何組織資料?
如何儲存資料?
如何操作資料?
如何存取資料?
Storage Pattern




陣列 Array
佇列 Queue
堆疊 Stack
鏈結串列 Linked List
陣列




同一種資料型別,多筆資料的集合
連續存放
固定容量、固定大小、固定長度
以索引值(Index)存取內容

C# 陣列索引值從 0 開始
陣列的內部呈現方式
陣列操作方法

配置


int[] number = new int[100];
索引存取(indexer)
陣列的處理效率

如果




陣列 A 第一個元素的位址為 𝐴0
每一項元素的大小是 𝑆
則元素 A[n] 的位址為 𝐴𝑛 = 𝐴0 + 𝑛 × 𝑆
存取速度是 𝑂 1


常數時間(Constant Time)
與 n 無關
19
鏈結串列
Linked List

節點(Node)



資料(Data) corresponding to the node
一個指向下一個節點的鏈結(Link)
鏈結串列長度不固定
單向鏈結串列
鍊結串列內部呈現方式

雙向鏈結串列
鏈結串列常用操作



Add: 加入一個新節點
Remove: 移除一個節點
Find: 尋找特定節點
Linked-List::Add
Linked-List::Remove
24
鏈結串列的處理效率

存取速度是 𝑂 𝑛


存取第 n 項元素,必須從頭(Head)開始,先
掠過 n-1 項元素
評比


存取速度:陣列比較快
容量彈性:鏈結串列彈性較高
25
常用 .NET 元件



Arrays 類別提供多種工具,包括排序與搜尋
List 類別,實作鏈結串列。
ArrayList 類別,結合陣列和鏈結串列兩種方
式存取資料。
26
佇列
Queue

先進先出


異質資料結構


First In First Out (FIFO)
Heterogeneous Data Structure
容量(Capacity)


容量可以隨著資料量增長
直到 Heap 空間耗盡
佇列內部呈現方式
28
佇列常用操作




Enqueue: 存入資料(加在尾端)
Dequeue: 取出資料(移除頭端)
Peek: 偷看頭端的資料,不取出
Contains: 尋找資料,判斷佇列內是否包含
特定資料
佇列的實作方式



以陣列實作
以鏈結串列實作
.NET Framework 提供 Queue 類別
30
佇列的實作方式
堆疊
Stack

後進先出


異質資料結構


Last In First Out (LIFO)
Heterogeneous Data Structure
容量(Capacity)


容量可以隨著資料量增長
直到 Heap 空間耗盡
堆疊的內部呈現方式
堆疊常用操作




Push: 存入資料(加在頂端)
Pop: 取出資料(移除頂端)
Peek: 偷看頂端資料,不取出
Contains: 尋找資料,判斷佇列內是否包含
特定資料
堆疊的實作方式



以陣列實作
以鏈結串列實作
.NET Framework 提供 Stack 類別
35
排序演算法


將資料依照『從小到大』的順序排列(升
冪)
不同的演算法在效率上的差異



時間複雜度(Time Complexity)
空間複雜度(Space Complexity)
常見的排序演算法


BubbleSort
QuickSort
BubbleSort

兩兩相鄰比較,順序不對者,交換位置
(Swap)
Visualizing BubbleSort – Pass 1
Step
1
Before
20, 30, 10, 40
After
20, 30, 10, 40
Comments
The algorithm compares the first two elements (20 and 30);
because they are in the correct order, no swap is needed.
2
20, 30, 10, 40
20, 10, 30, 40
The algorithm compares the next two elements (30 and 10);
because they are out of order, the elements are swapped.
3
20, 10, 30, 40
20, 10, 30, 40
The algorithm compares the next two elements (30 and 40);
because they are in the correct order, no swap is needed.
最大的浮出檯面
Visualizing BubbleSort – Pass 2
Step
1
Before
20, 10, 30, 40
After
10, 20, 30, 40
Comments
The algorithm compares the first two elements (20 and 10);
because they are out of order, the elements are swapped.
2
10, 20, 30, 40
10, 20, 30, 40
The algorithm compares the next two elements (20 and 30);
because they are in the correct order, no swap is needed.
3
10, 20, 30, 40
10, 20, 30, 40
The algorithm compares the next two elements (30 and 40);
because they are in the correct order, no swap is needed.
第二大的就定位
Visualizing BubbleSort – Pass 3
Step
1
Before
10, 20, 30, 40
After
10, 20, 30, 40
Comments
The algorithm compares the first two elements (10 and 20);
because they are in the correct order, no swap is needed.
2
10, 20, 30, 40
10, 20, 30, 40
The algorithm compares the next two elements (20 and 30);
because they are in the correct order, no swap is needed.
3
10, 20, 30, 40
10, 20, 30, 40
The algorithm compares the next two elements (30 and 40);
because they are in the correct order, no swap is needed.
第三大的也就定位
N 筆資料要做 N-1 個回合,每回合比較與交換
N-i 比資料,時間複雜度𝑂 𝑁 2
QuickSort

分而擊之


遞迴


Divide-and-Conquer
Recursive
演算法

取一個標竿值(Pivot)把資料分兩邊



左邊的都比標竿值小,右邊的都大於等於標竿值
以 QuickSort 把左半邊排序
以 QuickSort 把右半邊排序
Visualizing QuickSort
Step
Data to be sorted
1
50, 10, 30, 20, 40
2
3
4
Comments
-
20, 10
30
10
30
20
Start with an unsorted list and pick a pivot
element—in this case 30.
50, 40
-
10, 20, 30, 40, 50
40
Partition the list, with items less than the
pivot going to the left list and items greater
than the pivot going to the right list. Then,
to sort the left list, pick a pivot (here, 10).
Similarly, to sort the right list, pick a pivot
(here, 40) for that list.
50
In the left list, 20 is greater than 10, and in
the right list, 50 is greater than 40; therefore,
both 20 and 50 go into the right list. This
yields lists of only one number, which are
all by definition sorted.
All the small sorted lists are merged to
create the final complete sorted list.
QuickSort


T(n)=2T(n/2)
時間複雜度為 𝑂 𝑛 log 𝑛
43
結論

應用程式生命週期管理(Application
Lifecycle Management)





需求分析(Requirement Analysis)
軟體發展(Software Development)
測試(Testing)
版本釋出管理(Release Management)
測試方法


黑箱測試(Black-box Testing)
白箱測試(White-box Testing)
結論

測試層級


資料結構





單元測試(Unit testing)、整合測試(Integration
testing)、系統測試(System testing)、接受度測
試(Acceptance testing)
陣列 Arrays
佇列 Queues
堆疊 Stacks
鏈結串列 Linked Lists
排序演算法

BubbleSort, QuickSort