Fueling innovative software
July 15-18, 2019
Portland, OR

Code generation: Principles and challenges

Luke Sneeringer (Google)
4:15pm4:55pm Thursday, July 18, 2019
Secondary topics:  Customer Centered
Average rating: ****.
(4.00, 3 ratings)

Who is this presentation for?

  • Software engineers




Code generation is a useful approach for building, maintaining, and distributing code based on the specification of an API, reducing error and enabling automatic updates as the API interface changes. It also allows you to expand your reach at a lower cost and get more code into open source for developers.

Luke Sneeringer walks you through creating targeted, maintainable code generation for APIs. At a high level, every API has the same structure—nouns (messages), verbs (methods), and adjectives (fields)—but everything in your data model is a mandate. He provides a minimalist schema, API -< message -< field and API -< interface -< method and focuses on modeling ontological relationships. Luke’s goal is to design for a world where the output has a different set of maintainers than the schema, and explains why all output-related code should receive the same data—"If you can edit any of the output, you can edit it all with no surprises." You’ll discover why output can be shockingly procedural and why you should rely on tooling for your target ecosystem. But nothing is ever perfectly easy, and there are still challenges. Versioning is hard. Really hard. Release management is hard. How do you communicate what happened? And tools make assumptions, but what happens when those assumptions are broken?

Prerequisite knowledge

  • Familiarity with REST APIs

What you'll learn

  • Learn techniques for generating code to consume an API with a published data model
Photo of Luke Sneeringer

Luke Sneeringer


Luke Sneeringer is the author of Professional Python. He’s worked at several companies, including Google, Ansible, and FeedMagnet (which he cofounded). He lives in Boulder Creek, California, with his wife and three cats.