Alfredo Motta

Not So Random Software #20 – Coupling and Cohesion

Hello there! This week I am thinking about coupling and cohesion; two seemingly simple but incredibly effective metrics to design systems both in the small and in the large. As usual, I am going to randomly pick some resources on this topic I have been reading over time, hope you enjoy!

A random article or paper

The Conceptual Cohesion of Classes – An information retrieval approach to measuring class cohesion. There is not such a standard to measure coupling and cohesion of classes. Most of the approaches in the literature (for OOP software) are largely based on the structural information of the source code, such as attribute references in methods. This paper proposes an intriguing set of measures for measuring cohesion based on the analysis of the semantic information embedded in the source code, such as comments and identifiers.

A random video or podcast

All the little things If we are talking about coupling and cohesion in practice I can’t recommend enough Sandi Metz’s talk at RailsConf 2014. It contains the famous quote duplication is better than the wrong abstraction and helps you understand how to go from big problems to smaller components over a series of small straightforward refactoring steps.

A random book

Practical Object Oriented Design in Ruby (POODR). Following up from the previous video recommendation, the next obvious step is Sandi Metz’s book on how to design OOP systems in Ruby; this book changed my perception of software. Among the many books and papers I read about software design — way more than a balanced person should — none was able to convey in simple terms the pragmatic application of OOP as concisely as this one; before reading this I literally felt lost in endless arguments about what good OOP looks like, now I am in peace!

A random tool

Rubycritic RubyCritic is a gem that wraps around static analysis gems such as Reek, Flay and Flog to provide a quality report of your Ruby code.

A random line of code

Extracting pieces of computation that takes a standard input and giving them a name is an act of refactoring that helps both your cohesion and coupling. Ruby makes this easy with Proc!

A random quote

Concurrent software development means starting development when only partial requirements are known and developing in short iterations that provide the feedback that causes the system to emerge. Concurrent development makes it possible to delay commitment until the last responsible moment, that is, the moment at which failing to make a decision eliminates an important alternative. If commitments are delayed beyond the last responsible moment, then decisions are made by default, which is generally not a good approach to making decisions. Mary and Tom Poppendieck

Receive this by email

* indicates required


Leave a Reply:

Your email address will not be published. Required fields are marked *

Answer the question * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.