↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Object Cohesion: Why It Matters

Object cohesion is presented as a measurable property of software modules that can support the claims of Elegant Objects. The post argues that if classes with certain features consistently show lower cohesion, those claims gain empirical backing.

Reading notes
#

  • The author says cohesion can help EO adepts prove some of their assumptions.
  • A class is low in cohesion when its attributes and methods are unrelated and can be split without loss.
  • A highly cohesive class cannot be broken into smaller pieces because its attributes and methods belong together.
  • The post cites earlier research saying more cohesive classes tend to be less error-prone.
  • The author proposes comparing random Java classes with and without static methods and checking which group has higher average cohesion.
  • The post presents jPeek as an open source tool for calculating cohesion metrics in Java code.
  • It says many cohesion metrics have been published, but only a few were properly implemented.
  • The author says jPeek can be used to test EO claims about mutable classes, annotations, and DTOs.