When writing code to fit a certain design pattern, creating data models, or writing mocks for unit tests, it’s sometimes hard to avoid writing templated code. Especially when the codebase gets larger, it becomes very cumbersome to write them manually. This is when a code generation tool can be very handy.
At Uber, we have millions of lines of code, and needed a tool that transforms code in a performant, scalable manner. This talk will go over how we built such tool, with a focus on mock generation. We’ll discuss the details of each step in the tool development, various optimizations applied to make it performant, as well as how the tool can be used in your app.