API design‑first is a lifecycle model that starts with a conscious, collaborative API design process. API description languages like OpenAPI allow fast, evolutionary prototyping. API mock services can easily simulate a working implementation, and documentation formats with integrated sandbox testing make it easy for API client developers to test your API, even before you start coding.
The initial design focus allows your team to design “outside‑in,” so the design reflects the API client developer’s view of the business domain, and aligns with the client developer’s real‑world usage patterns.
When you’re ready to start implementation, code generation creates a scaffold, or stub code. Developers don’t have to write repetitive boilerplate code; and they get a head start with generated code that exemplifies recommended patterns and practices for API implementation.
Most API design‑first projects generate code as a one‑time event, following an initial design phase. Subsequent changes to the API have to be made separately in the code and the API specification, sometimes even by different team members.
As the API evolves, the specification and code tend to drift out of sync, and the team may not realize it until users report an inconsistency. Once the code and specs diverge, we’ve lost the benefits of consumer-driven design, rapid prototyping, and auto-generated scaffolding.
Here’s a thought experiment: what if API descriptions are just another kind of code? If we integrate code generation into the API implementation build, the API specification becomes a first‑class part of the codebase.
API CodeFlow is API design‑first, taken all the way through to implementation. API changes start with the specification, and flow automatically to the generated stub code. Done correctly, regeneration is a safe operation, and clearly indicates any breaking changes so we know exactly how to update our code to the modified API design.
Instead of a one-time event, code generation happens continuously. Design‑first goes from waterfall to an agile, iterative process, as API documentation and code evolve in lockstep.
RepreZen API Studio has everything you need to start building APIs today:
© 2016 ModelSolv, Inc. RepreZen and associated logos are trademarks of ModelSolv, Inc. All rights reserved.
Swagger is a registered trademark of SmartBear Software, Inc. OpenAPI is a trademark of The Linux Foundation.
The trademark holders are not associated with and do not endorse RepreZen API Studio.