高等軟體工程
軟體工程簡介
軟體危機
- DEF:軟體開發的速度遠不及軟體的成長速度,因此導致開發成本的提高以及時辰的延誤
- SOL:以工程化的方式引入軟體開發,以解決軟體危機
issue
- Unrealistic Deadline
- Vague(不明確) Requirements
- Complex Structure
- Numerous Uncertainties (不確定因素)
Fredrick Brooks 提出的軟體本質問題
- Complexity
- Changeability 易變性
- Invisibility
- Conformity 一致性
軟體開發活動
- 需求分析 Requirements Analysis
- 設計 Software Design
- 將客戶的需求轉換為系統的過程
- Including Architecture, DS, Algorithm, and Database
- 實作 Implementation (Coding)
- 測試與維護 Testing and Maintence
- 檢測程式是否符合要求及效能
- 「軟題維護」確保軟體系統持續滿足客戶需求
軟體測試
- 單元測試 Unit Test
- 整合測試 Integration Test
- 測試模組或子系統(sub system)的介面整合
- 系統測試 System Test
- 接受測試 Acceptance Test
Activities Common to SW Projects
紅字:Work Product 工作產出
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Requirements and Specification
- Modeling
- Use case modeling
- Structural modeling
- Dynamic and behavioral modeling
- Design
- 確定需求如何被正確實作
- System engineering
- System architecture
- Internals of subsystems
- User interface design
- Database design
- Programming
- Quality assurance
- Reviews and inspections
- Testing
- Deployment
Management
- Managing sw configurations
- Managing sw process
- 預估成本(時間)
- planning -> PEP (project execution plan)
軟體流程模型
軟體流程模型:定義軟體開發流程指引的抽象樣板
- 瀑布開發 Waterfall Model
- 統合流程 Unified Process
- 極限製程 Extreme Programming, XP
瀑布開發 Waterfall Model
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
SRS:軟體需求規格書
SDD:系統設計規格書
STD:系統測試報告
瀑布:水往下流,且不往回(往上)流
- 每一階段沒有完成,就不會進入下一階段
- 每一階段的產出(work product)是下一階段的輸入
瀑布式開發時程規劃範例
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
優點 |
缺點 |
清楚的階段分割 |
需求提供者(早期)無法正確及完整的表達需求 |
明確的文件產出 |
使用者 系統分析師 系統設計師 程式設計師溝通上的誤解 |
null |
使用者需求可能會改變 |
瀑布式開發適合大型專案,且需求變更幅度不大的系統
統合開發 Unified Process
因應物件導向程式語言興起,採用UML為開發方法,提供比起waterfall 更為彈性的開發流程。
以工作流(workflow)貫穿兩個面向
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
統合流程強調
- 反覆 Iterative
- 遞增 Incremental
- 演進 Evolutionary
統合流程特色為
- 使用者案例導向 User Case Driven
- 以架構為中心 Architecture_centric
- 以元件 模組為基礎的架構 component-based approach
時間面向
- 起始階段
- 分析階段
- 建構階段
- design, coding and testing
- 移交階段
內容面向
- 企業模組工作流
- Domain analysis
- 了解與評估企業的背景與動機
- 建立溝通管道
- 需求工作流
- 分析設計工作流
- modeling
- design
- DS, algo, database
- 實作工作流
- model to codes
- unit test
- 可及早發現可能的設計錯誤
- 測試工作流
- 確認單元可以整合
- 確認單元介面相容
- 可測試到缺失(Defects)
- 佈署工作流
Construction 階段採回合制,每一個回合都可能檢視需求與設計並修正

每一回合產生minor release以供使用,最後再產生final production release

統合流程開發時程規劃範例

優點
- 具瀑布開發優點,並強調反覆,遞增與演進
- 以使用者觀點,藉由use case diagram確認使用者需求
- 反覆的系統展示與架構檢視減少客戶與系統的落差
極限製程 Extreme Programming, XP
「擁抱改變」
特色
- 客戶駐點
- 漸進式規劃
- 頻繁改版
- 簡單設計
- 測試先行
- 事先撰寫單元測試
- Test-driven development (TDD)
- 事先設計測試案例
- 自動化測試
極限製程開發時程規劃範例

優缺點
- 非常具備彈性,較敏捷
- 測試程式若不完整,容易造成危機
需求工程
需求是甚麼
– 描述系統必須做甚麼事情
– 描述系統有甚麼限制或品質
相關人員:Stakeholders
由需求文件(requirements document)確認需求
需求種類
對象
- 使用者需求(user requirements)
- 系統需求(system requirements)
軟體功能
使用者需求
系統需求
*** 軟體需求規格書(System Requirements Specification, SRS) ***
功能性需求
- 指具體提出系統應該提供的服務項目
- 非常明確,只有有或沒有,沒有程度差異
非功能性需求
- 強調系統品質與限制
- 系統的特性
- ex 可靠度 安全性
- 相依於功能性需求
- 使用者關心
- 開發者關心
- 不同需求提出者關心的可能有所衝突 ex 效率VS可再使用性
軟體品質
- 正確性
- 可靠性
- 效率性
- 整合性
- 可使用性
- 可維護性
- 可測試性
- 彈性
- 可移植性
- 再利用性
- 互助運作性
建議盡量量化非功能性需求,使其成為可測試性的非功能性需求
ex 良好的UI -> 最多2步驟即可完成功能
ex 快速的搜尋 -> 2秒內有搜尋結果
需求工程
指 將待開發的系統需求由需求端擷取出來,加以分析及建置,以供開發端依此開發
Process for Developing Requirements

Domain Analysis
使SW針對所要開發系統的領域有一定程度的瞭解
ex 銀行 -> 存提款,借貸
domain expert: 銀行經理
- how
- advantage
- faster development
- better system
- 擴充性
定義問題與範圍
問題描述需短及簡潔
- scope
- 列出所有系統需要完成的事情
- 移除太廣泛的
- 也不要定義的太瑣碎
需求擷取

如何將使用者需求擷取出來
擷取方法
- 面談
- 問卷
- 使用者觀察
- 研討會
- 具經驗的主持人,提前準備,適合系統的使用者來自不同單位或組織
- 腦力激盪
- 使用案例
- 情境思考
- 站在使用者角色思考
- 使用案例(User Case)
- 雛型法(Rapid Prototyping)
- 初步雛型系統視覺化展示以確認需求
- 捨棄式雛型法(Throwaway Prototyping)
- 漸進式雛型法(Evolutionary Prototyping)
- 從最有把握的需求開始開發
- 進而擴充其他功能需求
- 不會丟棄
需求分析
目的:需求是否
資料流程的分析 (Data Flow Analysis)
- 以系統功能面的角度切入
- 利用 資料流程圖 (Data Flow Diagram, DFD)

- 圈圈:process
- 箭頭:Data flow
- 一個process的output可能是別的process的input
- 資料會儲存到Data Store裡
實體關聯的分析 (Entity Relation Analysis)
-
實體關聯分析 (Entity Relation Analysis)
-
擴充實體關聯分析圖(Extended Entity Relationship Diagram, EERD)
狀態行為的分析 (Behavior Analysis)
- 狀態轉換圖(State Transition Diagram, STD)
- ex 線上考試簡易狀態轉換圖
- ex 線上考試系統復合狀態轉換圖
- 目的:隱藏一些複雜的狀態

企業流程的分析 (Business Process Analysis)
- 分析作業流程
- 企業流程模組(Business Process Model)
- 流程應考慮不同的組織或角色
- ex 線上考試的企業流程模組
-
需求規格文件

Software Requirements Specification,SRS
- ex 線上考試系統之SRS

- ex IEEE 830 建議的SRS

需求確認與需求管理
需求確認 Validation
- 確認定義的需求是不是使用者要的
- Do Right Thing
需求驗證 Verifiable
- 設計的系統是否符SRS的規範
- Do Thing Right
需求管理
- 開發中的需求會變更
- 制定及遵循變更的程序
- 需求追溯表(Requirements Traceability Matrix, RTM)
物件導向與UML
UML
使用案例(Use Case Model)
Use Case :以使用者角度出發思考系統功能
- 使用者如何與系統互動
- 如何達到使用者目的
- full sequence steps
- user's interaction (不在乎如何系統設計)
- independent with UI
- only include actions actor interact with
-
ex
- Bank system
- Sales report system
-
Use Case View 使用案例觀點
-
Actor 行為者
- class
- system
- subsystem
- outside system interact directly
- 可以有繼承關係

- 個人與公司都是繼承自銀行客戶
-
Use case 使用案例
- a sequence of actions
- relatonship
-
Association
- actor與use case的關係
- 非use case間的
-
Extend
- use case 與另一 use case 的擴充關係

- 額外的功能,少了並不會導致原use case失去意義
-
Include
- 在 use case中常被使用的另一 use case

- reuse 的概念
- 如果沒有pw use case,那提存款等use case就沒有意義了
-
Generalization
- 使用案例規格樣板 (斜體為建議要有,highlight為一定要有)
- ID
- Description
- Actors
- Assumptions
- Constraints (使用限制)
- Priority
- Pre-Conditions (執行前須符合之條件)
- Post-Conditions
- Basic Flow (基本流程)
- Alternative Flows (備胎)
- Exceptional Flows (意外狀況處理)
- Include Use Cases(其他Use Case)
- Business Rules
- Special Requirements
- Artifacts
- Use Case Glossary

類別圖(Class Diagram)
描述Data
- Class
- Associations
- Attribute
- Operation
- Generalization
Class
- class 表示法
- operation 表示法
Associations
-
many to one

-
many to many

Implementation
-

-

-
multiplicity

- use vector
Generalization
Aggreation 聚合關係
- whole part
- isPartOf
- whole:擁有者,part:被擁有者

- ex
- when to use
Composition 組合關係
- strong of aggregation

- part/whole不存在,whole/part就沒有存在的意義
Interfaces
- class without operaction
- visible behavior


Note

Example
http://140.136.149.35/courses/SoftwareEngineering/2015-10-14-SE-CH3-U03.ecm.mp4/index.html
第22小節

動態塑模
互動圖(Intersaction Diagram)
- 動態觀點
- 視覺化
- 從use case 與 class disgram 建立
Sequence Diagram 循序圖
-
時間軸表示
-
class
-
actors
-
message
-
ex
- :有底線就是物件

-
由來
-
Object deletion
-
Iteration
- loop
- opt
- alt 多選一
- ref: 副函式
- [] : 判斷condition

Communication Diagram 溝通圖
- class之間的平面關係
- 好處:一目了然每個class之間的互動
-

-

how to choose
-
Sequence diagram
- 時間軸 base
- 更多詳細資訊
-
Communication diagram
- a project from class diagram
- validating class diagram
狀態機(State Machine Diagram)
- 元素
- State
- Event
- Transition
- Action
- ex
-

-
time out and condition
-
from class
- Activity
- a period of time
- after activity, run into another state
- may be interrupted
- Action
- Nested Substate
- 開車換檔

活動圖(Activity Diagram)
- flow of work
- 解讀不同 use case 間的互動
- concurrnt activities
- ex.
- Representing Concurrency
- Swimlanes
- 分隔不同腳色的視角
- 適用 business process model
- ex
設計樣式(Design Pattern)
Pattern
- Pattern describes problem which occurs over and over again, and then describes the core to the solution
- The recurring aspects of the designs are called design patterns
Elements
- Context
- Problem
- Forces
- 一些需考慮的issue or constraints
- Solution
- Antipattern (optional)
- some patterns will not work
- Related patterns (optional)
- some similar pattern will work
- References
- refer to or being referred
Example (物件導向語言)
-
Reources Acquisition Is Initialization
- 把所有初始化都放在constructor做
- complier error instead of running time error
-
Garbage collection
比較
-
Idiom
-
Design pattern
-
Framework
- partially completed design to solve a problem
- ex. 視窗程式拖拉(填入參數即可)
Design Patterns
Modeling pattern
The Abstraction-Occurrence Pattern
-
Context
-
Problem
-
Forces
-
Solution
-
Antipattern (optional)
-
-
References
The General Hierarchy Pattern
- context
- 物件在一個hierarchy的關係中要如何描述其他objects
- Solution
The Player-Role Pattern
- Context
- Problem
- 如何model 角色跟物件以使物件可以扮演不同的腳色
-
Forces
-
Solution
-
Antipattern (optional)
-
- References
GoF Design Patterns
-
Three type
Creational
-
how to new a object
-
try to hide the how to
-
example
-
Factory Method
-
Abstract Factory
-
Prototype
- 可以產生不同的 object copy 並動態替換
-
Builder
-
Singleton
Structural
- 關注 class 與 object 如何組成一個大的 structure
The Adapter Pattern
The Façade Pattern
The Proxy PatternThe Factory Pattern
Behavior