“A function either integrates or operates, it either only calls other functions or it does not call other functions but contains only logic.”
Basically, you have code that interacts with the outside world, and you have logic (read: conditionals and branching). Don’t mix the two.
It’s such a simple concept that it seems obvious in hind-sight (so maybe that’s why nobody ever talks about it, because it is obvious), but I don’t see code written this way all that often.
If there’s one thing I could teach every new developer it would be this. It’s such a little thing, but it would make a lot of code much easier to work with.
[1] https://medium.com/clean-code-development/stratified-design-...