SlideShare a Scribd company logo
@jphenow
What TDD Can Teach
Us About API Design
Jon Phenow
Highrise
@jphenow
What is TDD?
@jphenow
Test Driven Development
• Test first
• Run and watch test fail
• Fill in the funcGonality that makes the test pass
• Run and watch test pass
@jphenow
TDD Benefits
• Proof
• Fast feedback loop
• Test Coverage
• Code Design
@jphenow
TDD’s Effect on Design
• Testable code is usable code
• Explicitly illustrates dependencies of an operaGon
• Exposes difficulty
@jphenow
• Design is affected because of perspecGve
• WriGng as a user
• Not wriGng what’s simple as an author
TDD’s Effect on PerspecGve
@jphenow
PerspecGve is everything
@jphenow
API Design is like UX Design
@jphenow
What’s an API User
• Not user bob vs. user alice
• Topical
@jphenow
An API workflow
• Get a Client Token
• AuthenGcate to receive a user token
• Make requests using this token
@jphenow
Let’s Talk Real World
@jphenow
“Real” World
• Legacy CMS for Tiered Sports OrganizaGons
• Leagues, divisions, teams, games
• Third-Party wants to automaGcally update game
statuses due to weather informaGon from their
system
@jphenow
“Real” World
• Call support for an API Key
• Copy this key into headers
• Query CMS nodes for leagues matching our query
• Query each of those for children nodes that are teams
• Query each of those for a list of games that would be
affected by today’s weather
• Update each of those because its too nice out to play
baseball today
@jphenow
This sucks
@jphenow
First-glance Problems
• Client admin
• Lots of steps to get something done
• Design of the legacy internals is bleeding out
@jphenow
Dealing with bleeding out
@jphenow
Bleeding out
• Consider who’s using your API
• A Sport CMS with an API probably has disGnct two
users
• Sports/Stats
• Content/Site Structure
@jphenow
@jphenow
Fix it
• Separate Users
• Your internal choices shouldn’t necessarily bleed out
• DisGll funcGonality and data
@jphenow
Recall Some “Real” World
• Query CMS nodes for leagues matching our query
• Query each of those for children nodes that are
teams
• Query each of those for a list of games that would
be affected by today’s weather
• Update each of those because its too nice out to
play baseball today
@jphenow
Fix it
• Don’t solve for cancelling all rained-out games at
once
• Solve for updaGng a group of games with search
parameters
@jphenow
Don’t over fix it
• Only a few types of users
• Focus on the 80%
@jphenow
There are limits
• Be protecGve of what you provide
• Performance
@jphenow
Low-FricGon APIs Are
a Feature
@jphenow
PerspecGve is the key
@jphenow
Things I didn’t address
• Protocol/Pafern: SOAP/REST
• AuthenGcaGon: SAML/OAuth2/JWT
• API Versioning
@jphenow
Conclusion
• API Design is hard
• To the user it should feel fun, simple and powerful
• Consider what you have, what they want and
express that in an API
@jphenow
@jphenow

More Related Content

PDF
Unstoppable releases with kanban
PPTX
Agile Project Management: "How I Learned to Stop Worrying and Love Agile”
PPTX
Agile Testing
PPTX
Right-Sizing User Stories
PDF
Selenium Shots by Kyle J. Ginavan & Ryan Felton
PDF
Tdd2018 state of the software quality in Germany
PDF
Job manager 2020 in Angular
PDF
Boquet manager
Unstoppable releases with kanban
Agile Project Management: "How I Learned to Stop Worrying and Love Agile”
Agile Testing
Right-Sizing User Stories
Selenium Shots by Kyle J. Ginavan & Ryan Felton
Tdd2018 state of the software quality in Germany
Job manager 2020 in Angular
Boquet manager

What's hot (20)

PPTX
Developer Night Opticon 2017
PDF
Drulenium - Testing Made Easy
PDF
Becoming a better programmer - unit testing
PPTX
JavaScript Unit Testing
PPTX
Peer review
PDF
Productive teams
PPTX
Responsive App Design with the Salesforce Lightning Design System
PDF
Automated Performance Testing
PPTX
Developer Testing
PDF
WebCamp: Project Management Day: Управление требованиями в Agile: как это про...
PDF
Don't lose revenue. Go viral with no downtime.
PDF
Fast end-to-end-tests
PPTX
Developer Night - Opticon18
PPTX
Using real customer data to drive Testing
PPTX
Unit testing for project managers
PPTX
Spot the difference - automating visual regression testing
PDF
15 Explosive Things You Should Try As An Agilist by Peter Gfader
PDF
TLC2018 Shyam Sunder: Legoizing Testing
PPTX
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
PDF
Test Driven Development
Developer Night Opticon 2017
Drulenium - Testing Made Easy
Becoming a better programmer - unit testing
JavaScript Unit Testing
Peer review
Productive teams
Responsive App Design with the Salesforce Lightning Design System
Automated Performance Testing
Developer Testing
WebCamp: Project Management Day: Управление требованиями в Agile: как это про...
Don't lose revenue. Go viral with no downtime.
Fast end-to-end-tests
Developer Night - Opticon18
Using real customer data to drive Testing
Unit testing for project managers
Spot the difference - automating visual regression testing
15 Explosive Things You Should Try As An Agilist by Peter Gfader
TLC2018 Shyam Sunder: Legoizing Testing
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Test Driven Development
Ad

Viewers also liked (8)

DOCX
Psv tahun 6
DOCX
high temprature
DOCX
PDF
Transformada de laplace
PPT
Yeu to con_nguoi
PPT
Properties and Changes
PPT
Acids and Bases
PPT
Over view about mba
Psv tahun 6
high temprature
Transformada de laplace
Yeu to con_nguoi
Properties and Changes
Acids and Bases
Over view about mba
Ad

Similar to What TDD Can Teach Us About API Design (20)

PPTX
API-first Redesign of a Legacy Application - Nordic APIs Platform Summit 2018
PPTX
Developers are People Too! Building a DX-Based API Strategy Ronnie Mitra, Pri...
PDF
"API Design: From User Need to Finished Spec" by Andrew Jordan, ex-Product @T...
PDF
I Love APIs - Oct 2015
PPTX
Building a REST API for Longevity
PPTX
API-First Redesign of a Legacy Application
PPTX
{10.0} Test Driven Development.pptx
PDF
Why your APIs should fly first class
PDF
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
PPTX
Test execution
PDF
[WSO2 API Day Chicago 2019] Sustainable Competitive Advantage
PDF
Dependency Down, Flexibility Up – The Benefits of API-First Development
PPT
Test Driven Development
PPT
XP through TDD
PPTX
Refining Your API Design - Architecture and Modeling Learning Event
PDF
TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
PDF
api-driven-development.pdf
PPT
API Architecture Summit 2014- APIs: A Mobile Developer's Perspective
PPTX
[DevDay2018] High quality mindset in software development - By: Phat Vu, Scru...
PPTX
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
API-first Redesign of a Legacy Application - Nordic APIs Platform Summit 2018
Developers are People Too! Building a DX-Based API Strategy Ronnie Mitra, Pri...
"API Design: From User Need to Finished Spec" by Andrew Jordan, ex-Product @T...
I Love APIs - Oct 2015
Building a REST API for Longevity
API-First Redesign of a Legacy Application
{10.0} Test Driven Development.pptx
Why your APIs should fly first class
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
Test execution
[WSO2 API Day Chicago 2019] Sustainable Competitive Advantage
Dependency Down, Flexibility Up – The Benefits of API-First Development
Test Driven Development
XP through TDD
Refining Your API Design - Architecture and Modeling Learning Event
TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
api-driven-development.pdf
API Architecture Summit 2014- APIs: A Mobile Developer's Perspective
[DevDay2018] High quality mindset in software development - By: Phat Vu, Scru...
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso

Recently uploaded (20)

PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administration Chapter 2
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
medical staffing services at VALiNTRY
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Introduction to Artificial Intelligence
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPT
Introduction Database Management System for Course Database
PDF
top salesforce developer skills in 2025.pdf
PDF
Digital Strategies for Manufacturing Companies
CHAPTER 2 - PM Management and IT Context
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administration Chapter 2
Which alternative to Crystal Reports is best for small or large businesses.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Internet Downloader Manager (IDM) Crack 6.42 Build 41
medical staffing services at VALiNTRY
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
2025 Textile ERP Trends: SAP, Odoo & Oracle
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Introduction to Artificial Intelligence
Computer Software and OS of computer science of grade 11.pptx
Reimagine Home Health with the Power of Agentic AI​
Introduction Database Management System for Course Database
top salesforce developer skills in 2025.pdf
Digital Strategies for Manufacturing Companies

What TDD Can Teach Us About API Design