Talk video: https://www.youtube.com/watch?v=5mbp3SEha38&t=1652s
Blog post: https://itrevolution.com/love-letter-to-clojure-part-1
I will explain how learning the Clojure programming language three years ago changed my life. It led to a series of revelations about all the invisible structures that are required to enable developers to be productive. These concepts show up all over The Unicorn Project, but most prominently in the First Ideal of Locality and Simplicity, and how it can lead to the Second Ideal of Focus, Flow, and Joy.
Without doubt, Clojure was one of the most difficult things I’ve learned professionally, but it has also been one of the most rewarding. It brought the joy of programming back into my life. For the first time in my career, as I’m nearing fifty years old, I’m finally able to write programs that do what I want them to do, and am able to build upon them for years without them collapsing like a house of cards, as has been my normal experience.
The famous French philosopher Claude Lévi-Strauss would say of certain tools, “Is it good to think with?” For reasons that I will try to explain in this post, Clojure embraces a set of design principles and sensibilities that were new to me: functional programming, immutability, an astonishingly strong sense of conservative minimalism (e.g., hardly any breaking changes in ten years!), and much more…
Clojure introduced to me a far better set of tools to think with and to also build with. It’s also led to a set of aha moments that explain why for decades my code would eventually fall apart, becoming more and more difficult to change, as if collapsing under its own weight. Learning Clojure taught me how to prevent myself from constantly self-sabotaging my code in this way.
2. @RealGeneKim
Why I’m Presenting and Who It’s For
Alex Miller emailed me if I’d be willing:
Share why I’m so grateful to Clojure
Present an experience report on Datomic
Intended audience:
People who have been afraid to jump into Datomic,
because it’s so alien and unfamiliar (perhaps even
more alien than Clojure!)
People who want to spread more widely the use of
Datomic, or make it easier to explain/adopt/use — I’m
part of that target market
3. @RealGeneKim
Definition: Experience Report
Noun
“Experience report is a paper written by a person (persons)
who participated in the work completed (being completed) in
a context of a real-life organization”
In the form of: here’s what I wanted to do, here’s what
happened, here’s what I learned, here’s problem that still
remains
What’s they’re also good for
Closely resemble the scientific method (hypothesis, test
hypothesis)
Helps uncover demographics and psychographics (goals
and ideals) of a population
Source: http://processplatsen.ibissoft.se/node/72
4. @RealGeneKim
Agenda
Who am I, what I’ve learned in the DevOps community,
and why I’m so grateful to Clojure and the Clojure
community (15m)
Datomic Experience Report (25m)
What I’ve used Clojure for
Why Datomic scared me away
What made me finally take the plunge
What it felt like to solve the problem
Help I’m Looking For (5m)
7. @RealGeneKim
My Definition of DevOps
The architecture, technical practices, and cultural norms
that enable us to…
increase our ability to deliver applications and services...
quickly and safely, which enables rapid experimentation
and innovation, and the fastest delivery of value to our
customers…
while ensuring world-class security, reliability, and stability...
…so that we can win in the marketplace.
9. @RealGeneKim
State of DevOps Research
State of DevOps Report (2013-2019)
Dr. Nicole Forsgren, Jez Humble, Gene
Kim
Cross population study spanning over 35K
respondents
Identified “IT performance” and the factors
that predicts:
Deployment Frequency
Deployment Lead Time
Deploy Success Rate
Mean Time to RestoreSource: Google/DORA: 2018 State Of DevOps Report:
https://cloudplatformonline.com/2018-state-of-devops.html
10. @RealGeneKim
Elite Low Difference
Deployment Frequency
On-demand
(multiple times per day)
Monthly or quarterly 208x
Deployment Lead Time < 1 hour 1 day to 1 week 2,555x
Deploy Success Rate 0-15% 46-60% 7x
Mean Time to Restore < 1 hour 1 week to 1 month 2,604x
Elite vs. Low Performers
Source: Google/DORA: 2019 State Of DevOps Report: https://cloud.google.com/devops/state-of-devops/
11. @RealGeneKim
Elite Low Difference
Deployment Frequency
On-demand
(multiple times per day)
Monthly or quarterly 208x
Deployment Lead Time < 1 hour 1 week to 1 month 106x
Deploy Success Rate 0-15% 46-60% 7x
Mean Time to Restore < 1 hour 1 week to 1 month 2,604x
Elite vs. Low Performers
Source: Google/DORA: 2019 State Of DevOps Report: https://cloud.google.com/devops/state-of-devops/
12. @RealGeneKim
Elite Low Difference
Deployment Frequency
On-demand
(multiple times per day)
Monthly or quarterly 208x
Deployment Lead Time < 1 hour 1 week to 1 month 106x
Deploy Success Rate 0-15% 46-60% 7x
Mean Time to Restore < 1 hour 1 week to 1 month 2,604x
Elite vs. Low Performers
Source: Google/DORA: 2019 State Of DevOps Report: https://cloud.google.com/devops/state-of-devops/
13. @RealGeneKim
Elite Low Difference
Deployment Frequency
On-demand
(multiple times per day)
Monthly or quarterly 208x
Deployment Lead Time < 1 hour 1 week to 1 month 106x
Deploy Success Rate 0-15% 46-60% 7x
Mean Time to Restore < 1 hour Less than one day 2,604x
Elite vs. Low Performers
Source: Google/DORA: 2019 State Of DevOps Report: https://cloud.google.com/devops/state-of-devops/
14. @RealGeneKim
High Performers Are More Secure And
Controlled
2x 29%
less time spent
remediating
security issues
more time spent
on new work
Source: Google/DORA: 2018 State Of DevOps Report: https://cloudplatformonline.com/2018-state-of-devops.html
15. @RealGeneKim
High Performers Win In The Marketplace
2x 2xmore likely to
exceed profitability,
market share &
productivity goals
more likely to achieve
organizational and
mission goals, customer
satisfaction, quantity &
quality goals
Source: Google/DORA: 2018 State Of DevOps Report: https://cloudplatformonline.com/2018-state-of-devops.html
16. @RealGeneKim
High Performers Win In The Marketplace
2.2xhigher employee
Net Promoter Score
50%higher market
capitalization growth
over 3 years*
Source: Google/DORA: 2018 State Of DevOps Report: https://cloudplatformonline.com/2018-state-of-devops.html
20. @RealGeneKim
Clojure Brought Joy Of Coding Back
For decades, I self-identified as an Ops person…
I now self-identify as a developer
Development is so fun, and these days, you can do
miraculous things with so little effort
I wrote about my 30 year habits of self-sabotaging
my own code. One app I’ve written three times:
3000 lines of Objective C
1500 lines of TypeScript/React
500 lines of ClojureScript/Re-frame
21. @RealGeneKim
Cumulative LoC Written: Three Decades
“I’m going to make the case
that me learning Clojure is
sort of like Encino Man
learning to drive—you know,
the movie about the
caveman who was frozen in
ice and wakes up in the
completely changed,
modern world.”
Source: https://itrevolution.com/love-letter-to-clojure-part-1/
Little coding
23. @RealGeneKim
The Problems That Still Remain
Absence of all the invisible structures needed to
enable developer productivity
The orthogonal problem of getting data from
where it resides to where it needs to be used
Strong opposition to support new ways of
working
Ambiguity on what behaviors needed to support
during a transformation
25. @RealGeneKim
The Five Ideals
1. Locality and Simplicity
2. Focus, Flow, and Joy
3. Improvement of Daily Work
4. Psychological Safety
5. Customer Focus
28. @RealGeneKim
How Many People Do You Need To Feed?
Two pizza team
Feeding everyone in the building
Schedule lunch with 43 different people
29. @RealGeneKim
The First Ideal: Code
Ideal: anyone can implement what they need by
looking at one file or module, and make the
needed change
Kubernetes sidecars
Spring (http-retry, Dependency Injection)
Aspect Oriented Programming
Not Ideal: to make your needed change, you
have to understand and change all the files and
modules
30. @RealGeneKim
The First Ideal: Code
Ideal: changes can be independently
implemented and tested, isolated from other
components (composability)
Not Ideal: in order for changes to be
implemented and tested, the entire system must
be present (e.g., integrated test environment)
31. @RealGeneKim
The First Ideal: Organization
Ideal: every team has the expertise, capability
and authority to satisfy customer needs
Not Ideal: in order to satisfy customer needs,
every team must escalate up two levels (and over
two, and down two)
37. @RealGeneKim
The Second Ideal: Focus and Flow
Ideal: your energy and time is focused on solving
the business problem, and you’re having fun
Not Ideal: all your time is spent trying to solve
problems you don’t even want to solve (e.g.,
YAML files, Makefile and spaces in filenames,
bash)
38. @RealGeneKim
Never Have I Valued Infrastructure More
Things I detest now
Everything outside of my application
Connecting anything to anything
Updating dependencies
Secrets management
Bash
YAML
Patching
Building kubernetes deployment files (mostly by Googling)
Why my cloud costs are so high
39. @RealGeneKim
The Value Of Platforms
Enable developer productivity
Self-service
On-demand
Immediacy and fast feedback
Focus and flow
Joy
Monitoring, deployment, environment creation,
security scans, orchestration…
40. @RealGeneKim
Two Types Of Learning
● Procedural Learning
● One-shot Learning
Source: Dr. Mihaly Csikszentmihalyi
41. @RealGeneKim
In Clojure Love Letter
I want to tell a story that has the same ending as
Rich Hickey’s “If I had to keep programming in
C++ and Java, I think I would need to find a new
career.”
I’ve heard similar things many times…
I wondered if they were a bit… Hysterical? Manic?
Melodramatic?
42. @RealGeneKim
Rich Hickey
“Solve problems, not solve puzzles”
Category theory
Me
Figuring out how to escape spaces in filenames inside
of Makefile
SQL
More Examples
44. @RealGeneKim
A Book Tracking Application
Four years ago, Tom Limoncelli (StackOverflow) and
I wrote some tools to track sales ranks from various
e-commerce sites:
Python
Ruby and ActiveRecord
MySQL
Some bash, Makefiles, and JSON files
Kubernetes
Cron (or K8S CronJobs or Rundeck)
48. @RealGeneKim
3GB Docker Image / Kubernetes (GKE)
E-commerce
Site 1
E-commerce
Site 1
2016-2018
User
Hosted
Graphite
Slack
Hosted
Graphite
E-commerce
Sites...
Cloud SQL
MySQL
Bash script
API Retrieve
Get Reviews
(Scrapy)
ActiveRecord/
MySQL
Dispatcher
49. @RealGeneKim
100MB Docker Image / Kubernetes (GKE)
E-commerce
Site 1
E-commerce
Site 1
2019: 10x LoC
Reduction
API Retrieve
Dispatcher
User
Slack
E-commerce
Sites...
Cloud SQL
MySQL
Google Pub/Sub
Get Reviews
Google Data
Studio
51. @RealGeneKim
Sales Rank (lower is better)
Unicorn Project: Kindle
Phoenix Project: Kindle
Yay! Promotion activities are working!
52. @RealGeneKim
But I’m Not Very Good At Databases…
WHAT HAPPENED?!?
Oops. 2 weeks of all new records with NULL date/times.
ARGH! Analyzing this critical launch period is why I wrote the app in the first
place, and I was totally blind to what happened!!!
53. @RealGeneKim
How Bad Am I At Databases
I wrote an SQL database as an undergraduate CS
student
I’ve spent time as an (unwilling) Oracle DBA
I’ve used MySQL for 15 years
I’m still scared of schema changes and database
migrations
I almost never get database schema changes right
(insert screenshot of 10 git commits to fix Ruby
ActiveRecord migrations)
56. @RealGeneKim
“To what degree do we fear
doing deployments?”
Source: Puppet Labs 2015 State Of DevOps: https://puppetlabs.com/2015-devops-report
57. @RealGeneKim
My Final MySQL Indignity
This query takes 8.1s!!!
I need this for each book I’m
tracking — for 150 books, that’s
2 minutes!
No problem, I’ll just run queries on a
background thread…
Or maybe cache results, or use
Firebase Realtime DB? (and now I
have two problems)
61. @RealGeneKim
Adding Indices Did Not Work
CREATE INDEX time ON salesranks(time);
CREATE INDEX book_id ON
salesranks(book_id);
CREATE INDEX id ON books(id);
ALTER TABLE salesranks
MODIFY COLUMN
time DATETIME NOT NULL;
71. @RealGeneKim
Story Line
For 2 years, I’ve wanted to extend database
schema to encompass notion of “publisher” —
but conclusion was always “maybe next year”
Datomic looked so interesting: kept reading and
watching videos
72. @RealGeneKim
Great Articles on Datomic
Carin Meier:
Conversations With
Datomic (Part 1 and 2)
Datalog is intimidating,
but its link to core.logic
and Prolog link made it
seem incredibly
worthwhile
I’m seeking a more
declarative mode of
thinking…
OTOH: Schema was…
whoa.. Difficult for me to
understand…
75. @RealGeneKim
Definition: “Use In Anger”
“To use in anger”:
“In a military context, 'to fire in anger' means to
shoot for a purpose in war. For example, a
submarine that 'fires in anger' shoots missiles at
an enemy ship.
“Shots fired in anger are never just for practice;
they're fired to deliberately cause damage or
harm.”
Source: http://www.bbc.co.uk/worldservice/learningenglish/radio/specials/1837_aae/page22.shtml
76. @RealGeneKim
Definition: “Use In Anger”
“To use in anger”:
“In a military context, 'to fire in anger' means to
shoot for a purpose in war. For example, a
submarine that 'fires in anger' shoots missiles at
an enemy ship.
“Shots fired in anger are never just for practice;
they're fired to achieve a real mission
objective.”
Source: http://www.bbc.co.uk/worldservice/learningenglish/radio/specials/1837_aae/page22.shtml
77. @RealGeneKim
An Urgent Mission: Use In Anger: Book Launch
Book and product launches are a game of activations
In the Twitter relationship graph around me, where were
points of maximum amplification?
Among my friends, who had the most friends and followers?
Among my followers, who had the most friends and followers?
For a set of people, who were common friends and followers?
I looked for many weeks for commercial offerings, but
didn’t find any — often after a week of waiting before my
account became fully activated.
More on this later…
78. @RealGeneKim
Initial Challenges And Intimidating Things
Okay, I think I can do this, with Hodur helping create
schemas
Datomic Cloud made it feasible — my one attempt to
install Datomic and license 1.5 years ago was not so
good. I never got past the first page. (It didn’t help
that I didn’t even know what a classpath was.)
I’ve never used anything in AWS besides EC2.
Involved using things I’ve never used (DynamoDB,
API Gateway, AWS Lambda, CloudWatch)
79. @RealGeneKim
This Project Was Important To Me
I usually love experience reports that describe “here’s
how we scaled our multiuser chat service to 200MM
simultaneous users overnight without a hitch”
My experience report is different — it was just for me,
it never even ran anywhere besides my laptop
It was important to me and time-critical
I searched weeks for a tool that could do it for me
It completely changed how I think about databases, and
what I expect for one
83. @RealGeneKim
First Goals
Used chbrown’s fantastic “twttr” library to access Twitter API
Retrieve details for a Twitter account
Retrieve details about all my friends and followers
Uh oh… Rate limits…
Final N = 500K+
Only 15 requests allowed every 15 minutes (200 users returned upon each request)
It took 96 hours (4 days), but this was unknowable until program finally finished running
I remember writing/running programs like this; so many things can go wrong
Inability to resume after unexpected program termination
Unwanted data duplication
Unwanted retrieval duplication And THIS is why it takes multiple days for
social media tools to work after sign-up
85. @RealGeneKim
Initial Challenges
Datomic Cloud made it even feasible — my one
attempt to install Datomic and license 1.5 years
ago was not so good. I completed only first 3
steps
I’ve never used anything in AWS besides EC2.
Involved using things I’ve never used
(DynamoDB, API Gateway, AWS Lambda,
CloudWatch)
Video tutorials were great
86. @RealGeneKim
SUCCESS
In a week, had collected 500K users, able to
execute all desired queries
Focused on the top people who have got the
word out about DevOps and Phoenix Project
Copied into Google Sheet and operationalized
87. @RealGeneKim
Sales Rank (lower is better)
Unicorn Project: Kindle
Phoenix Project: Kindle
Yay! Promotion activities are working!
92. @RealGeneKim
Observations
Queries were so easy
It felt like the database was part of my program
Immediacy and fast feedback was incredible
Schema changes were incredibly easy and
painless
Hodur schema changes are amazing
Ghostwheel for type checking so incredible
93. @RealGeneKim
If I Could Wave A Magic Wand
Help upgrading (I’m so scared)
Better understanding what all the CloudWatch
events mean and whether I should care
Ideal use case
Access it from apps in Heroku
Not have to make change API Gateway each time
(I got one set of Datomic calls working in Heroku,
thanks to Clojurians Slack)
99. @RealGeneKim
Dr. Stephen Magill (Galois)
Gene Kim (IT Revolution)
Bruce Mayhew (Sonatype)
Gazi Mahmud (Sonatype)
Brian Fox (Sonatype, Maven
Co-Inventor)
Thanks also to:
Kevin Witten, Derek Weeks,
and Matt Howard
100. @RealGeneKim
2020 goals
Use with SSC
Describe project and data set sizes
100MM records
Components, dependencies, updates, and
vulnerabilities
105. @RealGeneKim
Quote
"If you think that ‘software project’ is
pronounced ‘slow-moving train wreck,’ you
should read The Unicorn Project. Gene Kim
shares the hilarious and sad ways that people
are ground down by failing projects -- and he
has a proven plan to fix it."
-- Stuart Halloway, President, Cognitect, Inc.
“This book describes how to rescue
developers from the tundra of technical debt
and bureaucracy that plagues the most
important missions in almost every
enterprise.”
— Eric Normand, PurelyFunctional.tv
106. @RealGeneKim
In Conclusion
THANK YOU! Clojure brought the joy of coding
back into my life!
And Datomic, even though it looks even more
alien than Clojure, made me so dissatisfied with
SQL databases, I wondered how I’d survive
without databases in my life.
And like Clojure, I’m amazed at how much I can
do with Datomic, easier, safer, and happier!
107. @RealGeneKim
Help I’m Looking For
Help Datomic win the bake-off for SSC Analysis, and then
help to make sure I don’t screw it up (me being the
Datomic expert on the team seems like a recipe for
disaster)
I’m interested in analyzing the clojars ecosystem and
data, too.
I’m interested in wondering what markers there are that
APIs are stable and won’t break consumers.
I’d love to work with anyone on getting more compile-time
checking of types — spectrum? clj-kondo?
Editor's Notes
I've had the privilege of studying high performing technology organizations since 1999. This was a journey that started when I was the founder and CTO of Tripwire, in the information security and compliance space.
We studied organizations that had the best project due date performance in Development, the best stability and reliability in Operations, and they also had the best posture of security and compliance.
We wanted to understand how these organizations made their "good to great" transformation, so that other organizations could replicate their outcomes.
There have been many surprises on this 20 year journey. But by far, the biggest surprise was how it brought me into the middle of the DevOps movement. The last time any industry has been transformed like our industry is being disrupted today was probably manufacturing in the 1960s, when it was transformed through the Lean and Toyota Production System.
In 2013, I co-wrote a book called The Phoenix Project, and I can't overstate how much I've learned since then. In the next 45 minutes, I will share what I wish I had known before we wrote that book.
Was here at the Conj in 2017
I wrote the letter to express my profound gratitude to Rich Hickey for creating Clojure, and the entire Clojure community.
Without doubt, learning the Clojure programming was one of the most difficult things I’ve learned professionally, but it has also been one of the most rewarding. It brought the joy of programming back into my life. For the first time in my career, as I’m nearing fifty years old, I’m finally able to write programs that do what I want them to do, and am able to build upon them for years without them collapsing like a house of cards, as has been my normal experience.
18 million developers
8 million ops people
What the Clojure community is working is relevant to us all
Bus factor is the number of people that need to be hit by a bus before your project comes to a screeching halt.
In TPP, we had bus factor of 1. Brent. Because every outage required Brent, and every major work item required Brent. If Brent got hit by a bus, the company was legitimately at risk of going out of the business.
In the Unicorn Project, I love the concept of the lunch factor.
How many people do you need to take out to lunch.
Amazon has the notion of a two pizza team. No team should be large than can be fed by two pizza. They can indedepently develop, test, and deploy value to the customer.
No need to take anyone out to lunch.
However, in most organizations, to make a small change, everything is so tightly coupled together, you have to take everyone out to lunch.
It’s not two pizza, it’s multiple truckloads of pizzas.
It was with gratitude and extreme enthusiasm that I jumped into this project, because as someone who loves the Clojure programming language, we benefit everyday from the Maven ecosystem.
It was this extensive use of open source in high performing DevOps teams
that led to an intersection of research that I had been leading for five years in the SSC report,
And research that Dr. Steven Magill, Gene Kim, Bruce Mayhew, Gazi Mahmud, and I embarked upon a year ago
You see, Gene Kim shared the Three Ways of DevOps inside The Phoenix Project,
with the first way being
“Emphasize performance of the entire system and never pass a defect downstream.”