Software Architecture in Practice

3. General Software Abstractions & Relations

  • Encapsulation - helps decrease the amount of coupling between each component by information hiding 
  • Polymorphism - helps increase the cohesion of communication and relationship between objects 
  • Dependencies - dependent libraries and packages


Types of Coupling 
  • Afferent coupling - number of responsibilities; incoming 
  • Efferent coupling - number of dependencies; outgoing


Code Quality Measurements 
  • Instability - ratio of efferent coupling to afferent and efferent coupling 
  • Cyclomatic complexity - number of branches that a method may have, measures the complexity of methods


Cyclomatic Complexity 

E - N + 2 * P 


- E is the number of edges 

- N is the number of nodes 

- P is the number of nodes with exit paths