Stomp Complexity!

Sam Boyer @sdboyer

This is a kinda heady talk

Some things I hope you'll come away with:

  • New words, and new ideas about familiar words
  • New metaphors for thinking about Drupal, but systems in general
  • What you, individually, can do to mitigate Drupal's complexity
  • And that doing so is Drupal's greatest need, and highest calling

Much of this talk is proudly purloined from Rich Hickey's Simple Made Easy

(If you haven't seen it, fix dat)

Some Etymology

Simple Easy
sim-plex ese < aise < adjacens
one fold, braid at leisure (to lie near)
vs complex vs difficult


Simple is often about 'oneness':

  • One content type
  • One responsibility, role, goal
  • One concept
  • One axis/dimension

a lack of interleaving

But simplicity does not mean just 'having one':

  • One node (vs two?)
  • One instance (vs five?)
  • One operation (vs ten?)

Cardinality - largely irrelevant to simplicity

Simple is instrinsic and objective


adjacens: to lie near (me)

relative, subjective

Easy: "Near, Effortless"

  • In our tooling:
    • Package managers
    • Devel module
  • Close to our existing skills and knowledge
  • Minimal effort required for considerable utility

Complexity as Braiding

complect - "to braid together, make complex"

decomplect - "to unbraid, tease apart"

constrast with: compose, "to place together"

The Hawk and the Hare



There's a hare on the ground.

There's a hawk in the sky, 100 meters above.

The hawk is hungry.


The hawk can dive at 10m/s.

How long until she reaches the hare?


The hawk can accelerate at 3m/s/s, up to a maximum of 15m/s.

How long until she snatches the hare?

Realistic Descent

Hawks can't dive straight down - she descends in circles, tracing a conical path.

Her maximum angle of descent is 75 degrees.

How long until she grabs the hare?

Centripetal Limits

As the hawk turns more quickly through the narrowing descent cone, centripetal force reduces her velocity.

Her maximum velocity decreases linearly in proportion to the percentage of maximum turn rate reached.

Her maximum turn rate is 135 degrees per second.

At maximum turn rate, her maximum forward velocity is reduced to 33% (5m/s).

How long until dinner?

Hare: not an idiot

The hare starts moving, 3m/s in one direction.

The hawk continuously reorients on the hare as long as he's in view.

How long...

Complexity vs Reasoning

  • Modifying a system requires the ability to reason about its behavior
  • Complexity is the primary limit on our ability to reason
  • Our capacity to create complexity vastly exceeds our capacity to reason about it

Simplicity is prerequisite for reliability.

Edsger W. Dijkstra

Simple and Easy are both important (and difficult)

Easy gets the attention by default. Simple requires deliberate effort.

Simple things can usually be made Easy

The reverse does not hold

Interface vs Artifact

  • Easy focuses on the experience of use
    • Convenience for users
    • Replaceability of users
  • Simple is concerned with the results of use
    • Quality of code, correctness
    • Maintenance and future change

Simple vs Easy: Project Velocity

Simple vs Easy: Coolness

There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.

Tony Hoare

Complexity in Drupal

Global Variables

  • Complects your code with ALL other code in your PHP process
  • Somewhat less risky because failures tend to be obvious
  • Also just wicked easy
  • But, they're hell for testing


  • Global vars are a more general problem of mutable state
  • Complects value with time
  • Weaves into everything that touches it
  • Cannot be mitigated by modularization

"It works, as long as no one does something stupid."


Alter Hooks

  • Complects discrete logic through shared state
  • Traditionally, an "escape hatch"
  • In practice, often amounts to "runtime configuration"
  • Wreaks havoc on artifact predictability - state space is too large
  • Renders "correctness" a delusion


  • Decomplect: tease apart complex artifacts
  • Simplify: make new, simpler artifacts

Hookalyzer: decomplects alters

  • Hooks, especially alters, are strong complectors in Drupal
  • So, tease them apart!
  • Hookalyzer inspects alter data as it goes by, recording a diff for each pass


  • Far easier to do in core than contrib
  • Try to build only on components you understand
  • But, three words...

Swap. Don't alter.


  • Simple and Easy: very different, and both important
  • Simplicity can enable Easy, but not vice-versa
  • Simple is diverse, generative; Easy is cloning, a dead end
  • Drupal desperately needs more simple systems, and simplicity-oriented people

The Learning Curve

The (original) Drupal learning curve

Gauntlet, Thrown

The new Drupal learning curve

Reducing complexity is the highest calling in Drupal

Thank You