1. 15
  1. 4

    One of the most noncontroversial good practices in the industry is automated tests. We don’t write a lot of these because our code doesn’t follow standard decoupling practices; while those principles make for easy to maintain code for a team, they add extra steps during runtime, and allocate more memory. It’s not much on any given transaction, but over thousands per second, it adds up.

    Excuse me? I’ve never heard of running the test suite on every request in production lmao

    1. 3

      It’s not talking about running the test suite on every request, but about abstraction layers you might need to allow testing. Say you have a function that uses service X. You will mock X during testing, so you add an abstraction layer and inject a mock object X’ during testing in place of the real X. This indirection adds overhead.

    2. 3

      “Best Practices” optimize for the future: flexibility, stability, maintainability, and ease of feature development. And those are good things to optimize for, especially when you don’t know your problem domain well yet.

      Notably that doesn’t include optimizing for speed or memory use. So if either of those are a higher priority than, say, code maintainability, then, yes, it makes sense to deprioritize best practices and focus on them instead.

      1. 2

        On the one hand, this is a thought-provoking discussion of the trade offs between testability and performance (questions that come to mind: does testable code have to be slow? what about system-level tests instead of unit tests? etc). On the other hand it smells like “the beginning of the end” – in other words, that Stack Overflow is going to be rebuilt all microservicey and “unit testable” and it’ll end up really big and slow as a result. I’ve long loved the fact that Jeff Atwood and saw performance as a feature, and the simple, scale-it-up-rather-than-out architecture they built for SO.

        1. 1

          Is this maybe because it takes time to agree on them across any team in the first place?