kdwarn

Codeberg Mastodon Feeds

Home > Programming > Blog > Client Interface First

Client Interface First

January 19, 2022

daybook, rust | permalink

Interesting bit from the Rust book, Ch. 20:

When you’re trying to design code, writing the client interface first can help guide your design. Write the API of the code so it’s structured in the way you want to call it; then implement the functionality within that structure rather than implementing the functionality and then designing the public API.

Similar to how we used test-driven development in the project in Chapter 12, we’ll use compiler-driven development here. We’ll write the code that calls the functions we want, and then we’ll look at errors from the compiler to determine what we should change next to get the code to work.