2 ms·
> If you have deeper modules, you stop needing 10, 20 levels of modules to accomplish things. I'm a big fan of being able to read stack traces without scrollin
by 082349872349872 3y ago
> If you have deeper modules, you stop needing 10, 20 levels of modules to accomplish things.
I'm a big fan of being able to read stack traces without scrolling, so my rules of thumb are to remove layers that pass data around without either providing a substantial abstraction or doing some computation with it (avoid ravioli code), and to collapse layers that were all doing the same sort of thing to the data, each a little bit at a time (avoid salami code).
My bet is that shallow modules originate via Conway's Law, then get cargo culted.
- sam_bristow 3y agoEvery layer of indirection needs to earn its keep. I hate working in codebases which are full of indirection without abstraction, you spend so long hunting for the bit of code that actually _does_ something.
- PH95VuimJjqBqy 3y ago> Every layer of indirection needs to earn its keep. So much this. One of the things I absolutely hate seeing are the use of interfaces with a single concrete implementation. context matters, it makes sense if you're authoring a library, it can make sense if you're working in something overly dynamic such as Ruby, Python, et al, but in a language like C#, Java, C++, et al, the compiler will assist you if you ever find yourself needing a second concrete implementation and most likely if you DO end up needing that second implementation, the interface is going to change anyway.