From the course: Build with AI: Beyond Pair Programming with AI
Documentation-Driven Development (DDD?)
From the course: Build with AI: Beyond Pair Programming with AI
Documentation-Driven Development (DDD?)
- You've heard of test driven development. Now get ready for documentation driven development. One unique thing about being a programmer is the code we write and the environments we work in are constantly evolving and changing. To stay current and write the best code for right now means we have to constantly update our knowledge and rethink our strategies and change our best practices. And this process of constantly learning and adapting is something we humans are really well equipped to do, even though it can be really difficult and time consuming, and it's also something AI coding assistance can't do at all. I'll talk more about this later on, but the basic premise is this. Language models can only reproduce language patterns from their training data. They can't learn anything new. To add new patterns to a language model, you have to either rebuild it from scratch or create a fine tuned or distilled model. Language models also tend to reproduce what's most prevalent in its patterns, which, in code, means old ways of doing things. In other words, when you use AI coding tools, part of your job as a human coder is to ensure that AI uses the latest coding standards and practices. The good news is language models are bias amplification machines, and when you prompt a language model, you're actually biasing it towards whatever is in your prompt. That means if you need the AI coding tool to use a new coding strategy or module or something else it doesn't do on its own, you can do so by providing it with documentation and examples of what you want. As I've explained before, coding languages are highly structured and patterned, and language models are designed to reproduce language structures and patterns. So biasing the system by giving it documentation and examples usually causes the system to reproduce these new patterns. Here's one example of how to do this. In this React and TypeScript project, the AI coding tool keeps insisting on using explicit function components with the shorthand React.fc, even though this isn't a recommended pattern any longer. To get the AI to change its default bias and apply a new pattern, I'll grab some documentation about how to write function components without React.fc, then prompt the AI to write the code to match this new pattern. And it does. And if I'm using an integrated AI tool like GitHub, Copilot, or Cursor, it'll recognize this pattern going forward and use it for future function declarations most of the time. My recommended best practice for you is to always stay on top of the latest standards and practices for whatever code language and application you're using, and monitor what the AI coding tool does. Anytime it starts reproducing old patterns, grab the official documentation and a practical code example of how you want the code to be implemented, and then prompt AI to follow this pattern, and it'll mostly do that, which is why I call this documentation driven development.
Contents
-
-
-
-
Where to start and how to start3m 4s
-
Inline generation4m 11s
-
Seeding, selecting, and expanding4m 32s
-
Generating documentation4m 59s
-
Documentation-Driven Development (DDD?)3m 16s
-
Chatting with code2m 55s
-
Code from a chat (ChatGPT)5m 1s
-
Artifacts (Claude)2m 45s
-
Knowledge, trust, and conservative models4m 49s
-
-
-
-
-