Lecture Software engineering: Lecture 16 - Ivan Marsic

Lecture 16: Class cohesion metrics. The main contents of this chapter include all of the following: Structural cohesion metrics, internal cohesion or syntactic cohesion, external cohesion or semantic cohesion. | Ivan Marsic Rutgers University LECTURE 16: Class Cohesion Metrics Topics Structural Cohesion Metrics Internal Cohesion or Syntactic Cohesion External Cohesion or Semantic Cohesion Measuring Module Cohesion Cohesion or module “strength” refers to the notion of a module level “togetherness” viewed at the system abstraction level Internal Cohesion or Syntactic Cohesion closely related to the way in which large programs are modularized ADVANTAGE: cohesion computation can be automated External Cohesion or Semantic Cohesion externally discernable concept that assesses whether the abstraction represented by the module (class in object-oriented approach) can be considered to be a “whole” semantically ADVANTAGE: more meaningful An Ordinal Cohesion Scale 6 - Functional cohesion module performs a single well-defined function 5 - Sequential cohesion >1 function, but they occur in an order prescribed by the specification 4 - Communication cohesion >1 function, but on the same data (not | Ivan Marsic Rutgers University LECTURE 16: Class Cohesion Metrics Topics Structural Cohesion Metrics Internal Cohesion or Syntactic Cohesion External Cohesion or Semantic Cohesion Measuring Module Cohesion Cohesion or module “strength” refers to the notion of a module level “togetherness” viewed at the system abstraction level Internal Cohesion or Syntactic Cohesion closely related to the way in which large programs are modularized ADVANTAGE: cohesion computation can be automated External Cohesion or Semantic Cohesion externally discernable concept that assesses whether the abstraction represented by the module (class in object-oriented approach) can be considered to be a “whole” semantically ADVANTAGE: more meaningful An Ordinal Cohesion Scale 6 - Functional cohesion module performs a single well-defined function 5 - Sequential cohesion >1 function, but they occur in an order prescribed by the specification 4 - Communication cohesion >1 function, but on the same data (not a single data structure or class) 3 - Procedural cohesion multiple functions that are procedurally related 2 - Temporal cohesion >1 function, but must occur within the same time span (., initialization) 1 - Logical cohesion module performs a series of similar functions, ., Java class 0 - Coincidental cohesion high cohesion low cohesion PROBLEM: Depends on subjective human assessment Weak Cohesion Indicates Poor Design Unrelated responsibilities/functions imply that the module will have unrelated reasons to change in the future Because semantic cohesion is difficult to automate, and automation is key, most cohesion metrics focus on syntactic cohesion Structural Class Cohesion SCC measures how well class responsibilities are related Class responsibilities are expressed as its operations/methods Cohesive interactions of class operations: How operations can be related 3 - Operations calling other operations (of this class) 2 - Operations sharing attributes 1 -

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.