软件构造的视图与质量指标
軟件構造的實質:Transformation between different views(不同視圖之間的轉換)
Multi-dimensional software views
按階段分:build and run-time views
按動態性分:moment and period views
按構造對象的層次分:code and component views
Transformation between different views
Nothing -> Code
Code -> Component
Build-time -> Run-time
Moment -> Period
5個重要的質量目標
- Easy to understand
elegant and beautiful code (understandability) - Ready for change
maintainability and adaptability - Cheap for develop
design for/with reuse: reusability - Safe from bugs
robustness - Efficient to run
performance
軟件多視圖的宏觀視角
構建時期(Build-time views)
AST可以認為是代碼的另一種等價視圖,對AST進行修改就相當于對源代碼進行修改,對源代碼進行修改就相當于對AST進行修改。
Semantics-oriented program structure(語義導向的程序結構):用源代碼對現實世界進行刻畫,例如使用UML圖描述接口、類、屬性、方法及其關系。先用人類語言表達需求和設計思想,再轉化成代碼。
版本控制。
運行時期(Run-time views)
Executable programs:純粹的機器語言
Cibrary:運行時庫,需要鏈接
Configuration and data files:配置文件,提供程序運行必要的參數
Distributed programs:分布式程序,例如一臺服務器+若干臺客戶機
兩種可執行文件:編譯成的機器碼(Native Machine Code);完全解釋運行(Fully Interpretation);解釋型字節碼(Interpreted Byte Code)
動態鏈接:庫文件不會在build階段被加入可執行文件,只做出標記,在程序運行時,庫被按照標記裝入內存。
Transformation between views
- Nothing => Code
Programming / Coding (ADT/OOP)
Review, static analysis/checking - Code => Component
Design (ADT/OOP;Reusability;Maintainability)
Build: compile, static link, package, install, etc - Build-time => Run-time
Install / deploy
Debug, unit testing (Robustness and Correctness) - Moment => Period
Verson control
Loading, dynamic linking, execution (dumping, profiling, logging)
Concurrent threads
Quality properties 質量指標
External quality factors: 外部質量因素,影響用戶,如運行速度、易用性,包括correctness, robustness, extendibility, reusability, compatibility, efficiency, portability, ease of use, functionality, timeliness
Internal quality factors: 內部質量因素,影響軟件本身和它的開發者,如模塊化程度、代碼可讀性
對于發布后的軟件而言,only external factors matter
且外部質量取決于內部質量,External quality results from internal quality.
External quality factors
- Correctness
Correctness is the ability of software products to perform their exact tasks, as defined by their specification.
Correctness is the prime quality.
設法保證正確性:Testing and debugging; Defensive programming such as typing and assertions(通過斷言在寫程序的時候就保證正確性而不是在調試時發現錯誤); 通過形式化驗證發現問題 - Robustness
Robustness is the ability of software systems to react appropriately to abnormal conditions.
健壯性是對正確性的補充 - Extendibility
規模越大,擴展起來越困難 - Reusability
一次開發,多次使用。找到軟件系統中共性的部分,將它們抽取出來。 - Compatibility(兼容性)
不同軟件系統之間互相集成是否容易。軟件系統都不是孤立存在的,需要和其他系統進行交互。難點:不同軟件有不同的設定,例如,不同操作系統中有著互相不兼容的文件格式。解決方法:標準化。 - Efficiency
包括時間效率和空間效率。
Efficiency does not matter unless the software is correct.
正確性是性能的前提。
過度的優化可能導致軟件不再適應變化和復用。 - Portability(可移植性)
軟件可方便的在不同的技術環境間移植。 - Ease of use(易用性)
容易學、安裝、操作、監控 - Functionality(功能性)
Functionality is the extent of possibilities provided by a system.
每增加一點點小功能,都要確保其他質量指標不受到損失。 - Timeliness(及時性)
Timeliness is the ability of a software system to be released when or before its users want it.
軟件產品出現的太晚,可能會錯過它的受眾群體。 - Others: Verifiability(可驗證性), Integrity(完整性), Repairability(可修復性), Economy(經濟性)
Internal quality factors
- Readability
- Understandability
- Clearness
- Size
Trade off between quality properties (折中)
如果對efficiency有極致的要求,那么這將手具體機器型號的約束,軟件的portability就會受影響。
經濟性(economy)和reusability也有沖突。
timeliness和extendibility也有沖突。
正確性(Correctness) 絕不能與其他質量指標沖突。
Summary
描述軟件系統的三個維度:
按階段分:build-time & run-time views
按動態性分:moment & period views
按層次分:code & component views
軟件構造的本質是視圖之間的轉化:
nothing => Code
Code => Component
Build-time => Run-time
Moment => Period
質量指標:
external & internal quality factors
important external quality factors
tradeoff
五個質量目標:
easy to understand
ready for change
cheap for develop
safe from bugs
efficient to run
總結
以上是生活随笔為你收集整理的软件构造的视图与质量指标的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Eclipse中Git的使用与Junit
- 下一篇: Testing and Test-Fir