Member-only story

Immutable Infrastructure

Reliability, consistency and confidence through immutability

22 min readMar 30, 2020

--

I’d like to express my gratitude to my colleagues and friends Ricardo Sueiras, Danilo Poccia, and Matt Fitzgerald for their valuable feedback and for being awesome.

Immutable:

not capable of or susceptible to change

Problems with immutability, or the lack thereof, isn’t a new thing. It has been around for as long as there have been programming languages.

For example, any Python developer knows that the mutable and immutable data types in Python are causing a lot of headaches — even to advanced developers. Consider this example:

>>> foo = ['hello']
>>> print(foo)
['hello']

>>> bar = foo
>>> bar += ['world']

>>> print(foo)
['hello', 'world'] <-- WHAT IS HAPPENING?

What is happening? Because foo was never modified directly, but bar was, anyone would expect the following:

>>> print(foo)
['hello'] <-- WHY IS THIS NOT HAPPENING?

But that isn’t happening, and that is mutability at work.

--

--

Adrian Hornsby
Adrian Hornsby

Written by Adrian Hornsby

Former Principal Engineer @ AWS ☁️ I break stuff .. mostly.

Responses (4)