天天看點

Chapter1-軟體構造的視圖和品質名額

      • Chapter1
        • 1.1 Multi-Dimensional Views
          • 1.1.1 Three dimensions
          • 1.1.2 Eight views
          • 1.1.3 Transformations in Software Construction
        • 1.2 Quality Objectives
          • 1.2.1 Quality properties
          • 1.2.2 Five key quality objectives

Chapter1

1.1 Multi-Dimensional Views

從三個次元看軟體系統的構成

用模型/視圖描述軟體系統

将軟體構造看做不同視圖之間的轉換

1.1.1 Three dimensions
By phares: build-time(構造階段) run-time(運作階段)
By dynamics: moment(特定時刻的軟體形态) period(軟體形态随時間點的變化)
By levels: code(代碼的邏輯組織, functions, classes, methods, interfaces) component(代碼的實體組織, files, directories, packages, libraries)
1.1.2 Eight views
Moment(特定時刻的軟體狀态) Period(軟體形态随時間的變化)
Code-level Component-level Code-level Component-level
Build-time Source code(詞彙層面,半結構化), AST(文法層面,文法樹,結構化), Interface-Class-Attribute-Method(Class Diagram)(語義層面,類圖,表達”需求”和”設計”思想,再轉化成code)(代碼的邏輯組織,function,classes,methods,interfaces) Packge, Sorurce, File, Static Linking(靜态連結發生在構造階段), Library, Test Case(Component Diagram,UML圖) Build Script(代碼的實體組織,files,directories,packages,libraries) Code Churn(代碼變化,增加,修改,删除,版本變更; eg. Git的commit顯示修改) Software Configuration Item(SCI 配置項),Version(版本V 1.6.1.5,1.6為major,1為minor,5為patch;Verion Control System(VCS);baseline,穩定版本)
Run-time Code Snapshot(快照圖,程式運作時記憶體裡變 量層面的狀态),Memory dump(記憶體資訊轉儲) Package, Library, Dynamic linking(動态連結), Configuration, Database, Middleware, Network, Hardware(Deployment Diagram) Execution trace(執行追蹤,log記錄程式執行的調用次序,考慮jstack的使用) Event log(系統層面的事件日志)
Procedure Call Graph, Message Graph (Sequence Diagram) Parallel and multithreads/processes Distributed processes
1.1.3 Transformations in Software Construction
Chapter1-軟體構造的視圖和品質名額
Null ->Code Code->Component Build-time->Run-time Moment->Period
Programming/Coding (ADT / OOP) Design (ADT / OOP, Reusability(可重用性), Maintainability(可維護性)) Install/deploy Refactoring(重構)
Review, static analysis/checking(靜态類型檢查) Build : compile, static link, package, install, clean (Construction process) Debug, unit/integration testin (Robustness, 穩健性) Version control (SCM), Loading, dynamic linking, interpreting, execution (dumping, profiling, logging)

1.2 Quality Objectives

軟體構造過程中需要考慮的重要品質名額

面向品質名額的軟體構造技術

1.2.1 Quality properties

External quality factors

Correctness(正确性) Robustness(健壯性) Extendibility(可拓展性) Reusability(可複用性) Compatibility(相容性)) Efficiency(有效性) Portability(可移植性)- Ease of use(簡約性) Functionality(功能性) Timeliness(及時性)
Conditional(分層,每一層保證自己的正确性,同時假設其下層是正确的), Testing and dubugging(測試和調試,消除不正确), Defensive programming(防禦式程式設計,確定正确性), Formal approach(形式化方法,check,guarantee,ensure,形式化驗證發現問題-自圓其說)(按照預先定義的”規約”執行,至高無上的品質名額) react appropriately to abnornal conditions(針對異常情況的處理,對規約定義之外的情形做出恰當反應), Exception handling(出現異常時不能崩潰,未被specification覆寫的情況即為exception) Design simplicity(簡約主義), Decentralization(分離主義)(對規約進行修改,是否能夠容易應對) Don’t Re-invent the Wheel(一次開發,多次使用,發現共性) Homogeneity of design(保持設計的同構性, standardized) balanced(折中優化, 保證正确性,過度優化導緻軟體不再适應變化和複用) various in hardware and software environments(友善在不同技術環境/硬體/作業系統之間移植) Structural simplicity, Know the user(容易學,安裝,操作,監控,提供詳細使用指南) Featurism(适當的功能,功能太多極為複雜,不靈活, Agile, SCM) In time(及時性,及時釋出新版本)

Tradeoffs

正确的軟體開發過程中,開發者應該将不同品質因素之間如何做出折中的設計決策和标準明确的寫下來

雖然需要折中,但“正确性”絕不能與其他品質因素折中

1.2.2 Five key quality objectives
Understandability-Elegant and beautiful code(優雅性代碼,可了解性) Reusability-Design for/with reuse(可複用) Maintainability and Adaptability -Low complexity(低複雜性,可維護性) Robustness-Robustness and correctness(健壯性, 正确性) Performance-Pertomance and efficiency(效率性)
代碼的可了解性(命名,布局,注釋,複雜度)(Code Review, Walkthrough-人工走查, Static Code Analysis)(ADT、函數規約),軟體、項目的可了解性(包組織,檔案組織,指令空間),(其他包括,重構,版本控制,日志trace) cheap for develop(開發成本低);ADT/OOP,接口與實作分離;繼承、重載、重寫;組合,委派;多态;子類型和泛型;OO設計模式;API設計,庫,架構 ready for changes;子產品化設計;聚合度、耦合度;SOLID,GRASP;OO設計模式;基于表格(switch,if表格)、狀态(State設計模式)、文法(正規表達式);SCM,version control safe from bug;異常、錯誤處理;斷言(Assertion);防禦式程式設計;持續化內建;日志、記憶體轉儲分析;Debug測試 efficient to run;代碼調優(使用設計模式);空間複雜性分析(記憶體管理);時間複雜度(I/O性能);記憶體轉儲分析;GC垃圾回收;分布式系統;使用多線程,并行;代碼的性能分析調整

繼續閱讀