3 ms·
Factoring out constants has a nice effect of turning your header into a sort of declarative program, a quick summary of the interesting behavior choices the pro
by reagency 11y ago
Factoring out constants has a nice effect of turning your header into a sort of declarative program, a quick summary of the interesting behavior choices the program makes, a guide to understanding the program at a glance.
With numRetries=5, you can see he program makes retries. Withjust 5, that fact is hidden away in a method parameter somewhere.
And unless your IDE is ed+cat, there is no hunting needed to jump to a definition of a method. Having layers of generality makes code easier to read.
- omaranto 11y agoed + cat seems like an odd combination: why not use just ed (it has a print command, p)?
- Eridrus 11y ago> And unless your IDE is ed+cat, there is no hunting needed to jump to a definition of a method. Having layers of generality makes code easier to read. I completely disagree; adding extra indirection/generality always makes your code harder to understand. Adding meaningful/intuitive abstractions makes it significantly easier though. My pet peeve is Java interfaces that only exist because you need to be able to mock the object in testing, but otherwise only have one real implementation. Especially when the name gives no indication that it's an interface, so you only find out after you pressed F3.