3 ms·
A dogmatic book does not make a dogmatic person. And if that's a "problem", then that's rather a problem with the person reading the book. Please provide examp
by Denzel 9y ago
A dogmatic book does not make a dogmatic person. And if that's a "problem", then that's rather a problem with the person reading the book.
Please provide examples of such codebases you're talking about.
One justification of modularity is to hide details. Thus avoiding the need to "go to definition". If the tests pass and the name is descriptive, then you should understand the method without needing the details.
For example, Jekyll's Site#process [1] provides a high-level overview of how the site is built. It reads like simple, plain, easy-to-understand English. Now, I've chosen to dive into Site#write [2]; it tells me that for each site file, we're going to write it out to its destination, as long as it's supposed to be regenerated. Awesome, that's easy to understand.
Say I want to write another method that operates on all the site files. I don't need to know how Jekyll finds all the site files. Heck, they could be in specific directories... or it could pull configuration over the network... or they could be provided through command-line arguments. Who cares! I just use Site#each_site_file because it's an implementation detail.
And yes, Jekyll provides little 1-3 line helper methods like Site#incremetal? [3] all over the place to codify conditionals. These are extremely helpful.
On the other side of the coin, do you know what this conditional is for [4] in Kubernetes? I can't for the life of me understand its purpose without being forced to look into the details. It'd be much easier to read if it was extracted out into its own descriptive method such as activeMultiNodeInterface maybe? I don't know because I literally don't know the intention of that conditional. The original developer could've made their intention far more clear to subsequent developers had they extracted it out.
I find your citation of Carmack underwhelming for two reasons: (1) he's writing to a very specific target audience -- game developers, and (2) he admits himself, "The whole point of modularity is to hide details, while I am advocating increased awareness of details." Carmack is in no way supporting the idea that "it's painful to read code where you continuously have to 'go to definition'". In fact, quite the opposite, he's advocating a very specific recommendation to a very specific type of developer working on a very specific type of project. Simple as that.
You'd do best to provide some examples and empirical data supporting your assertions.
[1]: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site.rb#L69 https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site...
[2]: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site.rb#L208 https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site...
[3]: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site.rb#L347 https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site...
[4]: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/network/kubenet/kubenet_linux.go#L203 https://github.com/kubernetes/kubernetes/blob/master/pkg/kub...