Dry Suppleness

Don’t sacrifice suppleness to the DRY gods

Dry Suppleness

Consider your application has feature A and feature B, and in order to implement each of these features you need to invoke functions X, Y, Z:

feature A() { A1() X() Y() Z() }
feature B() { B1() X() Y() Z() }

The gods of DRY would proclaim that you should create a new function to encapsulate the behaviour of X,Y,Z.  However, I would argue that unless that group of functions is some distinct concept in your application domain then grouping them into a single function is adding unnecessary complexity in your application. Do you agree?

Related Blog