Code generation: Principles and challenges
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 outlines how to create targeted, maintainable code generation for APIs.
Talk Title | Code generation: Principles and challenges |
Speakers | Luke Sneeringer (Google) |
Conference | O’Reilly Open Source Software Conference |
Conf Tag | Fueling innovative software |
Location | Portland, Oregon |
Date | July 15-18, 2019 |
URL | Talk Page |
Slides | Talk Slides |
Video | |
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?