From the course: Creating Better SDKs with Generative AI
Where does code generation fail?
From the course: Creating Better SDKs with Generative AI
Where does code generation fail?
- [Instructor] Where code generation is useful, also serves as its fatal flaw. Remember, code generation is pattern recognition or turning common patterns into predictable results. But what happens if you have a new pattern? Are you ready to dig into your code generation and build out logic to handle this new pattern? And that new pattern could exist in either your specification document or the underlying language, or even both. Programming languages and frameworks have deprecation all the time. You don't want to accidentally generate an SDK based on an old language version that blocks new development. On the input side of code generation, we also have the context of the code itself. Does your code generation tool understand why you're generating this SDK or what the purpose of it is? Remember, the purpose isn't simply, "I need to use this in Python", but I need to solve this problem and I happen to be using Python. How do we get a code generator to include that context? On the output side of code generation, we have two problems: quality and maintenance. With regards to quality, remember that most code generators are relatively simple if then pattern matching. If there's a bad or odd pattern in there, it's going to be replicated all over the place. Further, the generation itself represents a static snapshot in time that may not reflect your coding standards. So you can't count on clear functional compliant code coming out the other side. Even worse, do you have a feedback loop? Can you add information to improve the code generation for next time around? And this leads to our maintenance problem. In general, code generation is a one and done operation. You generate the library, the SDK, and then you move on. The problem in this pattern is that your API will change over time and your SDK needs to change with it. And now you are stuck manually updating that SDK yourself. Overall, code generation leaves us with a few problems. First, we're limited by needing to know the patterns in advance, then we need to have patterns in order to address those patterns. Unfortunately, we also don't have the context of the underlying code and use case. The generated code doesn't match your current patterns and practices unless you maintain it. And finally, it's a one-time process. But what if we could address each of these and make code generation more useful? That's what we're going to do.
Contents
-
-
-
-
(Locked)
What is code generation?1m 43s
-
Where does code generation fail?2m 12s
-
(Locked)
OpenAPI 1012m 24s
-
(Locked)
Setting up your build environment1m 54s
-
(Locked)
Generating your first SDK2m 59s
-
(Locked)
Validating your SDK3m 49s
-
(Locked)
Reviewing your SDK3m 54s
-
(Locked)
Improving your OpenAPI spec2m 32s
-
(Locked)
Challenge: Improving your OpenAPI spec44s
-
(Locked)
Solution: Improving your OpenAPI spec1m 5s
-
(Locked)
-
-
-
-