The Prisoner's Dilemma
The prisoner's dilemma is a powerful game theory experiment - but what has it to do with Software Development? Let's talk about cooperation, team work, and mutual benefit.
Hello, developers! 🚀
Welcome back to the Learn Agile Practices newsletter, your weekly dose of insights to power up your software development journey through Agile Technical Practices and Methodologies!
Before starting, I quickly remind you that my brand new Test-Driven Development 101 5-day Email Course is available!
With this course, you will effectively learn what TDD is, for real: what's the objective of this practice, how the TDD process works, and how it enables you to achieve better software. The course goes beyond theory with interactive quizzes and flashcards for active learning, providing practical tips and suggestions for practicing with katas.
As a subscriber to my newsletter, you can have it with a 10EUR discount!
Now, let's dive into today's micro-topic!
The Prisoner's Dilemma
The Prisoner's Dilemma is a classic example in game theory that demonstrates why two rational individuals might not cooperate, even if it appears that it is in their best interest to do so. The scenario typically involves two persons who are interrogated separately. Each prisoner can either betray the other by testifying that the other committed the crime or remain silent. They are told that:
if only one of them cooperates by accusing the other, the one that collaborated will be free, but the one accused will stay 7 years in jail
if both of them accuse the other, they will both remain in jail for 6 years
if none of them cooperates and accuses the other, they will both remain only 1 year in jail
The optimal outcome for both is to stay silent, but it requires a lot of trust and affection, otherwise, they might choose to betray each other, leading to a worse outcome for both.
In other words, they will have better outcomes if they think as a team.
What about Software?
You might wonder, what does the Prisoner's Dilemma have to do with software development? A lot, in my opinion.
Software development is an inherently collaborative practice. The best results are achieved when it’s seen as a team effort rather than a collection of individual contributions. Much like the prisoners of the dilemma, who need trust, affection, and team belonging to achieve the best outcome, software developers need to work together effectively to build robust, reliable software.
And how much would the prisoners improve their situation if they could communicate? Communication is fundamental in a team effort, much more than technical skills.
I’m dropping a bold opinion here, but I honestly think that the communication and collaboration within the team (and of the team with the rest of the world) have a much higher impact than the technical skills. Tech skills are important, but the software history teaches us that isn’t enough: if we focus on efficiency instead of effectiveness, our team will reduce its outcomes - no matter how skilled the team members are.
Team members, not individual contributors
Referring to developers as "individual contributors" is a very bad idea that someone comes up with at a certain point, a name that undermines the collaborative nature of software development. This term suggests that each developer works in isolation, producing pieces of a puzzle that are only put together at the end. However, the reality is that software development thrives on collaboration, continuous integration, and collective problem-solving.
Like feature branches, or long-living branches in general, the idea of an individual contribution to development is a nice fit for the Open Source context, but it’s not a good idea for a company software team.
Going back to the dilemma parallel, if the two prisoners think about the dilemma as individual contributors, meaning that they don’t take into consideration the impacts of their choices on others but only on their specific work, they will gain an immediate benefit for themselves but at the same time causing the other one a negative outcome - and it may even happen that both have a negative outcome of both of them only think about himself.
Thinking as a team leads to the best outcome possible - and it’s not a causality that all the best practices and methodologies around software development focus on the team:
Lean and DevOps focus on the optimization of the whole team (and organization), and practices like limiting Work In Progress, Single-Piece Flow, or having a slack of free time for everyone, work so well because they seek to improve the outcomes of the whole, which usually requires not having a full efficiency for the individuals to improve the effectiveness of the team. Another example of focusing on the team outcomes is to accept some inefficiency at individuals level, avoiding multitasking and context switching, to maximize the overall effectiveness.
Agile and XP focus a lot of their practices on teamwork, collective ownership, and overall quality of the work: Pair/Mob Programming is a clear example, but Continuous Integration and Trunk-Based Development also foster a team effort culture.
Conclusion
The Prisoner's Dilemma is a great analogy to highlight the importance of collaboration and trust in software development. By viewing software development as a team effort, adopting Lean/DevOps principles, limiting WIP, and embracing collaborative practices like Pair/Mob Programming and Continuous Integration, teams can optimize their workflow, enhance productivity, and deliver high-quality software more efficiently. The key to success in software development lies in optimizing the whole system, not just individual contributions - enabling innovation, and the ability to adapt, change and evolve with the business.
🧠 Test Yourself in 1 minute:
💡 Did you know? An interactive activity, like quizzes or flashcards, can boost your learning!
Take advantage of our set of Flashcards dedicated to this topic: read the word and try to describe its definition - then turn the card to check the correct one for feedback 😲 Don't miss out the opportunity to boost your learning—try now!
The Prisoner Dilemma is…
Insights Recap
The Prisoner's Dilemma is a game theory scenario that involves two prisoners who are interrogated separately. Each prisoner can either betray the other by testifying that the other committed the crime or remain silent.
if both of them betray the other, they will be sentenced to 6 years in prison
if only one of them betray the other, he will be free but the betrayed one will be sentenced to 7 years in prison
if none of them betray the other, they will be sentenced with only 1 year in prison
It’s evident that the optimal outcome for both is to stay silent, but it requires a lot of trust and affection - in other words, they will have better outcomes if they think as a team.
In software development, the best results are achieved when it’s seen as a team effort rather than a collection of individual contributions. Much like the prisoners of the dilemma, who need trust, affection, and team belonging to achieve the best outcome, software developers need to work together effectively to build robust, reliable software.
communication and collaboration within the team (and of the team with the rest of the world) have a much higher impact than the technical skills.
Referring to developers as "individual contributors" is a very bad idea that undermines the collaborative nature of software development.
All the best practices and methodologies around software development focus on the team:
Lean and DevOps, with practices like limiting Work In Progress, Single-Piece Flow, or having a slack of free time for everyone, focus on the optimization of the whole team (and organization)
We need to accept some inefficiency at individuals level, avoiding multitasking and context switching, to maximize the overall effectiveness.
Also Agile and XP focus a lot on teamwork, collective ownership, and overall quality of the work, with practices such as Pair/Mob Programming, Continuous Integration, Trunk-Based Developmentm, and more.
Until next time, happy coding! 🤓👩💻👨💻
Go Deeper 🔎
Legenda
📚 Books
📩 Newsletter issues
📄 Blog posts
🎙️ Podcast episodes
🖥️ Videos
👤 Relevant people to follow
🌐 Any other content