SlideShare a Scribd company logo
Microservices and the art of
taming the Dependency Hell
Monster
Michael Bryzek
Cofounder & ex-CTO Gilt
@mbryzek
mbryzek@alum.mit.edu
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/microservices-dependencies
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Dependency Hell
• What is it and how does it happen?
• How do we mitigate?
• API design must be First Class
• Backward and Forward Compatibility
• Accurate Documentation
• Generated client libraries
http://en.wikipedia.org/wiki/Dependency_hell
Dependency hell is a colloquial term for the
frustration of some software users who have
installed software packages which have
dependencies on specific versions of other
software packages.
Example
service a depends on lib-foo version 1.7
service b depends on lib-foo version 1.6
Build pulls in version 1.7.
At runtime, turns out there was a breaking change in lib-
foo that the compiler could not verify.
Long chains of dependencies make this hard:
service a depends on
lib-foo depends on
lib-bar depends on
lib-baz
http://en.wikipedia.org/wiki/Dependency_hell
Microservices and the Art of Taming the Dependency Hell Monster
From Simple Architecture
To Fully Distributed
0 to 150+ People in Tech
How do you manage
dependencies?
And specifically those
dependencies in the libraries
we use.
Let’s Build an App
Microservices and the Art of Taming the Dependency Hell Monster
The Basics
• User registration and login
• Product catalog
• Inventory data
• Cart
user-service
• API to create a user; fetch user
details
• High throughput: 10k RPS+
• Millions of users
user-service client lib
createUser(form: UserForm): Future[User]
getUser(guid: UUID): Future[Option[User]]
deactivateUser(guid: UUID): Future[Unit]
updateUser(guid: UUID, form: UserUpdateForm):
Future[Unit]
authenticate(email: String, password: String):
Future[Boolean]
…
catalog-service
• API to fetch rich product details
• Moderate throughput: 5k RPS+
• Millions of products
catalog-service client lib
getProduct(id: Long): Option[Product]
getProductsInSale(saleId: Long, limit: Int,
offset: Int): List[Product]
getSkusForProduct(productId: Long): List[Sku]
…
inventory-service
• API to check stock of individual
products
• High throughput: 10k RPS+
• Guarantee never oversold
inventory-service client lib
numberAvailable(id: Long): Long
reserve(id: Long): Token
clearReservation(token: Token)
lock(reservationToken: Token, externalId: UUID)
…
cart-service
• API to add/remove to a
shopping cart
• Integrates with checkout
• Low throughput
cart-service client lib
addToCart(id: String, skuId: Long)
getCart(id: String): Cart
clearCart(id: String)
addToUserCart(userGuid: UUID, skuId: Long)
getUserCart(userGuid: UUID): Cart
clearUserCart(userGuid: UUID)
…
Service
Year of
Latest
Update
Client
Dependencies
Futures?
Example
Methods
user 2015 Scala 2.11, Ning 1.9 Yes
createUser,
deactivate
catalog 2013 Scala 2.10, Ning 1.7 No createProduct
inventory 2009
Java 6, Netty HTTP
client.
No reserve, lock
cart 2008
Java 6, Apache HTTP
Client.
No addToCart
Then We Add Features
• Loyalty
• Recommendation
• Account Credits
• Nav bar with context, related sales
• Tracking
• and dozens more…
And with micro service architectures,
significant new features often lead to
new services and new libraries.
Mature Microservice Arch
What happens next?
• Builds get larger and slower
• Create new client libraries that are each just a little bit
different
• Produce custom APIs that reduce interoperability
• Increase amount of boilerplate code
• Reduce code quality; slow down development
• And Eventually you will see a production error
Caused by:
java.lang.NoSuchMethodError
Minimizing the Pain
• API design must be First Class
• Backward and Forward Compatibility
• Accurate Documentation
• Generated client libraries
Guiding Principle:
The Open Source Way
• How do applications integrate with each other?
• How do you use a library?
• How much and what kind of documentation?
• How do I get support / contribute / report bugs?
• Public or Private is a detail
Tooling Matters
• www.apidoc.me codifies these practices
• very simple to get use
• zero dependencies on existing software process nor runtime
• Open source and free SAAS: https://github.com/mbryzek/
apidoc
• First commit April 6, 2014.
• Over 100 services already built at Gilt w/ apidoc
API Design Must be First Class
• Protobufs, thrift, avro, swagger 2.0, and apidoc
• The design of your API and the data structures
themselves are the hardest things to change
• Design them up front - and integrate these artifacts
into your design process.
Example: AVRO idl
@namespace("mynamespace")
protocol User {
record Employee {
string email;
}
}
Example: apidoc
{
"name": “user-service",
"models": {
"user": {
"fields": [
{ "name": "id", "type": "uuid" },
{ "name": "email", "type": "string" }
]
}
}
}
“Schema First Design”
Really the most important concept
Accurate Documentation
• What services exist? Think of how github helps us
discover what libraries and applications exist.
• API as first class allows us to use these artifacts
directly in our software - ensures accuracy
• Semantic Versioning (http://semver.org/)
Microservices and the Art of Taming the Dependency Hell Monster
Microservices and the Art of Taming the Dependency Hell Monster
Backward Compatibility
• Imagine storing all historical records
• General guidelines:
• New fields are either optional or have defaults
• Can’t rename; Introduce new models where
necessary and migration path
Forward Compatibility
• Imagine new messages arrive with new data
• Additional considerations:
• Careful of enums; consider what happens when
you add a value in the future
• Careful with processing data (e.g. throwing an
exception if an unknown field shows up)
Forward Compatible Enum
sealed trait OriginalType
object OriginalType {
case object ApiJson extends OriginalType { override def toString = "api_json" }
/**
* UNDEFINED captures values that are sent either in error or
* that were added by the server after this library was
* generated. We want to make it easy and obvious for users of
* this library to handle this case gracefully.
*
* We use all CAPS for the variable name to avoid collisions
* with the camel cased values above.
*/
case class UNDEFINED(override val toString: String) extends OriginalType
...
}
Knowing When Things Change
Generating Client Libraries
• Potentially controversial; I was skeptical at first, but
works
• Enables consistent naming
• Minimal external dependencies
• Challenge: Can you generate a client that developers
love?
Microservices and the Art of Taming the Dependency Hell Monster
apidoc Ruby Client
client = MyService::Client.new("http://localhost:8000")
organizations = client.organizations.get(:limit => 10, :offset => 0)
organizations.each do |org|
puts "Org %s is named %s" % [org.id, org.name]
end
neworg = client.organizations.post(:name => "My org")
puts "Created new org named %s" % neworg.name
apidoc Scala Client
val client = new com.bryzek.apidoc.api.v0.Client("http://localhost")
val organizations = client.organizations.get(limit = 10, offset = 0)
organizations.foreach { org =>
println(s"Org ${org.name} is named ${org.id}")
}
val neworg = client.organizations.post(name = "My org")
println(s"Created new org named ${neworg.name}")
Consistency Really Matters
Original Consistent Naming based on REST
createUser
POST /users/
Users.post
createProduct
POST /products/
Products.post
reserve
POST /reservations/
Reservations.post
addToCart
POST /carts/:id/products/:productId
Products.postByIdAndProductId(id, productId, …)
Summary: Mitigate
Dependency Hell
• API design must be First Class
• Backward and Forward Compatibility
• Accurate Documentation
• Generated client libraries
Thank You
www.apidoc.me/doc/start
Michael Bryzek
@mbryzek
mbryzek@alum.mit.edu
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations/
microservices-dependencies

More Related Content

PPTX
Micro Services in .NET Core and Docker
PDF
Microservices with Spring Cloud, Netflix OSS and Kubernetes
PDF
SOA to Microservices
PDF
Java one kubernetes, jenkins and microservices
PDF
Managing your camels in the cloud with CI/CD
PDF
Microservices with Apache Camel, DDD, and Kubernetes
PPTX
Microservices with Apache Camel, Docker and Fabric8 v2
PDF
Fuse integration-services
Micro Services in .NET Core and Docker
Microservices with Spring Cloud, Netflix OSS and Kubernetes
SOA to Microservices
Java one kubernetes, jenkins and microservices
Managing your camels in the cloud with CI/CD
Microservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, Docker and Fabric8 v2
Fuse integration-services

What's hot (20)

PDF
Devina Dhawan's talk - Women and non binary focused intro to AWS
PDF
Web Development using Ruby on Rails
PDF
Cloud Native Camel Riding
PPT
Gwtcreatekeynote
PDF
Elasticsearch JVM-MX Meetup April 2016
PDF
Usergrid Overview
PPTX
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
PPTX
DevNexus 2015
PDF
HTML5 Is the Future of Book Authorship
PDF
Open Source Mobile Backend on Cassandra
PDF
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
PDF
How to Contribute to Apache Usergrid
PPTX
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
PDF
Who's afraid of front end databases?
PDF
Object Oriented Views / Aki Salmi
PDF
DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real...
PDF
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
PPTX
Building a Better BaaS
PDF
Camel oneactivemq posta-final
PDF
JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...
Devina Dhawan's talk - Women and non binary focused intro to AWS
Web Development using Ruby on Rails
Cloud Native Camel Riding
Gwtcreatekeynote
Elasticsearch JVM-MX Meetup April 2016
Usergrid Overview
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
DevNexus 2015
HTML5 Is the Future of Book Authorship
Open Source Mobile Backend on Cassandra
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
How to Contribute to Apache Usergrid
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
Who's afraid of front end databases?
Object Oriented Views / Aki Salmi
DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real...
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
Building a Better BaaS
Camel oneactivemq posta-final
JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...
Ad

Similar to Microservices and the Art of Taming the Dependency Hell Monster (20)

PDF
Forced Evolution: Shopify's Journey to Kubernetes
PDF
Design Microservice Architectures the Right Way
PDF
Building APIs in an easy way using API Platform
PDF
Serverless brewbox
PDF
Beyond DevOps: How Netflix Bridges the Gap?
PDF
Generating Unified APIs with Protocol Buffers and gRPC
PPTX
First Look at Azure Logic Apps (BAUG)
PPTX
Harnessing Free Content with Web Service APIs
KEY
drupal 7 amfserver presentation: integrating flash and drupal
PDF
M meijer api management - tech-days 2015
PDF
2.28.17 Introducing DSpace 7 Webinar Slides
PDF
Intro to CakePHP
PDF
LINE's messaging service architecture underlying more than 200 million monthl...
PPTX
Delivering Developer Tools at Scale
PDF
No REST - Architecting Real-time Bulk Async APIs
PPTX
Docs as Part of the Product - Open Source Summit North America 2018
PPTX
Building Content-Rich Java Apps in the Cloud with the Alfresco API
PDF
Scalable Microservices at Netflix. Challenges and Tools of the Trade
PDF
Building RESTful APIs
PPTX
Untangling - fall2017 - week 9
Forced Evolution: Shopify's Journey to Kubernetes
Design Microservice Architectures the Right Way
Building APIs in an easy way using API Platform
Serverless brewbox
Beyond DevOps: How Netflix Bridges the Gap?
Generating Unified APIs with Protocol Buffers and gRPC
First Look at Azure Logic Apps (BAUG)
Harnessing Free Content with Web Service APIs
drupal 7 amfserver presentation: integrating flash and drupal
M meijer api management - tech-days 2015
2.28.17 Introducing DSpace 7 Webinar Slides
Intro to CakePHP
LINE's messaging service architecture underlying more than 200 million monthl...
Delivering Developer Tools at Scale
No REST - Architecting Real-time Bulk Async APIs
Docs as Part of the Product - Open Source Summit North America 2018
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Scalable Microservices at Netflix. Challenges and Tools of the Trade
Building RESTful APIs
Untangling - fall2017 - week 9
Ad

More from C4Media (20)

PDF
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
PDF
Next Generation Client APIs in Envoy Mobile
PDF
Software Teams and Teamwork Trends Report Q1 2020
PDF
Understand the Trade-offs Using Compilers for Java Applications
PDF
Kafka Needs No Keeper
PDF
High Performing Teams Act Like Owners
PDF
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
PDF
Service Meshes- The Ultimate Guide
PDF
Shifting Left with Cloud Native CI/CD
PDF
CI/CD for Machine Learning
PDF
Fault Tolerance at Speed
PDF
Architectures That Scale Deep - Regaining Control in Deep Systems
PDF
ML in the Browser: Interactive Experiences with Tensorflow.js
PDF
Build Your Own WebAssembly Compiler
PDF
User & Device Identity for Microservices @ Netflix Scale
PDF
Scaling Patterns for Netflix's Edge
PDF
Make Your Electron App Feel at Home Everywhere
PDF
The Talk You've Been Await-ing For
PDF
Future of Data Engineering
PDF
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Next Generation Client APIs in Envoy Mobile
Software Teams and Teamwork Trends Report Q1 2020
Understand the Trade-offs Using Compilers for Java Applications
Kafka Needs No Keeper
High Performing Teams Act Like Owners
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Service Meshes- The Ultimate Guide
Shifting Left with Cloud Native CI/CD
CI/CD for Machine Learning
Fault Tolerance at Speed
Architectures That Scale Deep - Regaining Control in Deep Systems
ML in the Browser: Interactive Experiences with Tensorflow.js
Build Your Own WebAssembly Compiler
User & Device Identity for Microservices @ Netflix Scale
Scaling Patterns for Netflix's Edge
Make Your Electron App Feel at Home Everywhere
The Talk You've Been Await-ing For
Future of Data Engineering
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More

Recently uploaded (20)

PDF
Getting Started with Data Integration: FME Form 101
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Mushroom cultivation and it's methods.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Getting Started with Data Integration: FME Form 101
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Mushroom cultivation and it's methods.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology
MIND Revenue Release Quarter 2 2025 Press Release
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
TLE Review Electricity (Electricity).pptx
OMC Textile Division Presentation 2021.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Accuracy of neural networks in brain wave diagnosis of schizophrenia
NewMind AI Weekly Chronicles - August'25-Week II
Building Integrated photovoltaic BIPV_UPV.pdf

Microservices and the Art of Taming the Dependency Hell Monster

  • 1. Microservices and the art of taming the Dependency Hell Monster Michael Bryzek Cofounder & ex-CTO Gilt @mbryzek [email protected]
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /microservices-dependencies
  • 3. Presented at QCon New York www.qconnewyork.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. Dependency Hell • What is it and how does it happen? • How do we mitigate? • API design must be First Class • Backward and Forward Compatibility • Accurate Documentation • Generated client libraries
  • 5. http://en.wikipedia.org/wiki/Dependency_hell Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages.
  • 6. Example service a depends on lib-foo version 1.7 service b depends on lib-foo version 1.6 Build pulls in version 1.7. At runtime, turns out there was a breaking change in lib- foo that the compiler could not verify. Long chains of dependencies make this hard: service a depends on lib-foo depends on lib-bar depends on lib-baz http://en.wikipedia.org/wiki/Dependency_hell
  • 10. 0 to 150+ People in Tech
  • 11. How do you manage dependencies? And specifically those dependencies in the libraries we use.
  • 14. The Basics • User registration and login • Product catalog • Inventory data • Cart
  • 15. user-service • API to create a user; fetch user details • High throughput: 10k RPS+ • Millions of users
  • 16. user-service client lib createUser(form: UserForm): Future[User] getUser(guid: UUID): Future[Option[User]] deactivateUser(guid: UUID): Future[Unit] updateUser(guid: UUID, form: UserUpdateForm): Future[Unit] authenticate(email: String, password: String): Future[Boolean] …
  • 17. catalog-service • API to fetch rich product details • Moderate throughput: 5k RPS+ • Millions of products
  • 18. catalog-service client lib getProduct(id: Long): Option[Product] getProductsInSale(saleId: Long, limit: Int, offset: Int): List[Product] getSkusForProduct(productId: Long): List[Sku] …
  • 19. inventory-service • API to check stock of individual products • High throughput: 10k RPS+ • Guarantee never oversold
  • 20. inventory-service client lib numberAvailable(id: Long): Long reserve(id: Long): Token clearReservation(token: Token) lock(reservationToken: Token, externalId: UUID) …
  • 21. cart-service • API to add/remove to a shopping cart • Integrates with checkout • Low throughput
  • 22. cart-service client lib addToCart(id: String, skuId: Long) getCart(id: String): Cart clearCart(id: String) addToUserCart(userGuid: UUID, skuId: Long) getUserCart(userGuid: UUID): Cart clearUserCart(userGuid: UUID) …
  • 23. Service Year of Latest Update Client Dependencies Futures? Example Methods user 2015 Scala 2.11, Ning 1.9 Yes createUser, deactivate catalog 2013 Scala 2.10, Ning 1.7 No createProduct inventory 2009 Java 6, Netty HTTP client. No reserve, lock cart 2008 Java 6, Apache HTTP Client. No addToCart
  • 24. Then We Add Features • Loyalty • Recommendation • Account Credits • Nav bar with context, related sales • Tracking • and dozens more…
  • 25. And with micro service architectures, significant new features often lead to new services and new libraries.
  • 27. What happens next? • Builds get larger and slower • Create new client libraries that are each just a little bit different • Produce custom APIs that reduce interoperability • Increase amount of boilerplate code • Reduce code quality; slow down development • And Eventually you will see a production error
  • 29. Minimizing the Pain • API design must be First Class • Backward and Forward Compatibility • Accurate Documentation • Generated client libraries
  • 30. Guiding Principle: The Open Source Way • How do applications integrate with each other? • How do you use a library? • How much and what kind of documentation? • How do I get support / contribute / report bugs? • Public or Private is a detail
  • 31. Tooling Matters • www.apidoc.me codifies these practices • very simple to get use • zero dependencies on existing software process nor runtime • Open source and free SAAS: https://github.com/mbryzek/ apidoc • First commit April 6, 2014. • Over 100 services already built at Gilt w/ apidoc
  • 32. API Design Must be First Class • Protobufs, thrift, avro, swagger 2.0, and apidoc • The design of your API and the data structures themselves are the hardest things to change • Design them up front - and integrate these artifacts into your design process.
  • 33. Example: AVRO idl @namespace("mynamespace") protocol User { record Employee { string email; } }
  • 34. Example: apidoc { "name": “user-service", "models": { "user": { "fields": [ { "name": "id", "type": "uuid" }, { "name": "email", "type": "string" } ] } } }
  • 35. “Schema First Design” Really the most important concept
  • 36. Accurate Documentation • What services exist? Think of how github helps us discover what libraries and applications exist. • API as first class allows us to use these artifacts directly in our software - ensures accuracy • Semantic Versioning (http://semver.org/)
  • 39. Backward Compatibility • Imagine storing all historical records • General guidelines: • New fields are either optional or have defaults • Can’t rename; Introduce new models where necessary and migration path
  • 40. Forward Compatibility • Imagine new messages arrive with new data • Additional considerations: • Careful of enums; consider what happens when you add a value in the future • Careful with processing data (e.g. throwing an exception if an unknown field shows up)
  • 41. Forward Compatible Enum sealed trait OriginalType object OriginalType { case object ApiJson extends OriginalType { override def toString = "api_json" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious for users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ case class UNDEFINED(override val toString: String) extends OriginalType ... }
  • 43. Generating Client Libraries • Potentially controversial; I was skeptical at first, but works • Enables consistent naming • Minimal external dependencies • Challenge: Can you generate a client that developers love?
  • 45. apidoc Ruby Client client = MyService::Client.new("http://localhost:8000") organizations = client.organizations.get(:limit => 10, :offset => 0) organizations.each do |org| puts "Org %s is named %s" % [org.id, org.name] end neworg = client.organizations.post(:name => "My org") puts "Created new org named %s" % neworg.name
  • 46. apidoc Scala Client val client = new com.bryzek.apidoc.api.v0.Client("http://localhost") val organizations = client.organizations.get(limit = 10, offset = 0) organizations.foreach { org => println(s"Org ${org.name} is named ${org.id}") } val neworg = client.organizations.post(name = "My org") println(s"Created new org named ${neworg.name}")
  • 47. Consistency Really Matters Original Consistent Naming based on REST createUser POST /users/ Users.post createProduct POST /products/ Products.post reserve POST /reservations/ Reservations.post addToCart POST /carts/:id/products/:productId Products.postByIdAndProductId(id, productId, …)
  • 48. Summary: Mitigate Dependency Hell • API design must be First Class • Backward and Forward Compatibility • Accurate Documentation • Generated client libraries
  • 50. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/ microservices-dependencies