Home

Speculative Generality

Seedling 🌱 - Published October 5, 2022 - (Updated April 18, 2023)

Speculative Generality is when you engineer code to handle cases that aren't required, but might be some day.

More often than not the "some day" never comes and you're left with bloated code that can be annoying to maintain1.

This can often be seen in Rust through the use of aggressive parametrisation and generics, resulting in code that is hard to refactor2.

Footnotes

  1. Developers are lazy, the last thing they want to do is spend a lot of time maintaining code and tests that for use cases that don't impact the customer. ↩

  2. Rust is very verbose when working with generics. Every impl block requires the generic to be written more than once, meaning a whole heap of places you have to edit when refactoring - something to keep in mind when easy to refactor Rust. ↩


Bennett is a Software Engineer working at CipherStash. He spends most of his day playing with TypeScript and his nights programming in Rust. You can follow him on Github or Twitter.
This work by Bennett Hardwick is licensed under CC BY-NC-SA 4.0Creative Commons CC logoCreative Commons BY logoCreative Commons NC logoCreative Commons SA logo.