| I like the recipe analogy. I've not thought of a better term. u/edejong uses the term "sequential programming", which might be the right (best) answer. u/rgoulter wrote: "I'd note that the recipe used in the post doesn't include a list of ingredients." Yup. Also missing are preconditions, assumptions, defensive programming. Maybe forgivable omissions from a blog entry. But those "ingredient" steps are what allow the "recipe" to be simple. u/contingencies wrote: "decouple your ingredient prep from your cooking algorithm." This is The Correct Answer[tm]. But I don't see anyone explaining why: It makes the code testable, directly. Stated another way: Decouple all the async, blocking, I/O stuff from the business logic. And do not interleave those tasks. How you know you're doing it wrong: Any and all use of mocking, dependency injection, inversion of control is wrong. Therefore, the presence of Spring and Mockito (and their knockoffs) is strong evidence you're doing things wrong. |