3 ms·
I would second the parent. DRY was a false God. I would say RCL: reduce cognitive load. Obviously if there is a manageable way to reduce repetition, take it, b
by api 7y ago
I would second the parent. DRY was a false God. I would say RCL: reduce cognitive load.
Obviously if there is a manageable way to reduce repetition, take it, but I would not add a lot of complexity for the sake of brevity. That's turning your dev team into a data compression algorithm made of meat.
- tome 7y agoPerhaps DRY was a good shortcut to RCL and SST (single source of truth). Those two are really important. DRY is an approximation to them (a good one in most cases).
- dllthomas 7y agoAre you speaking about DRY on a syntactic basis, or the version from The Pragmatic Programmer ("Every piece of knowledge must have a single, unambiguous, authoritative representation within a system")?
- tome 7y agoAh, thanks, now I realise I've been taking DRY too literally and what I described as "single source of truth" is actually what DRY tends to mean: https://en.wikipedia.org/wiki/Don't_repeat_yourself https://en.wikipedia.org/wiki/Don't_repeat_yourself
- dllthomas 7y agoI would say "was intended to mean.". The acronym is catchy and seems sufficiently self explanatory that I think your initial interpretation may be more common. I've been jokingly pushing for over-application of syntax-focused DRY to be called "Huffman coding"
- q3k 7y agoCognitive load is also present from vastly duplicated code and config: having to remember to update or take into consideration 20 other places in your codebase any time you make a change.
- api 7y agoYes, both extremes can increase cognitive load. The ideal is simple, effective, parsimonious abstractions, but that's much easier said than done. I was just arguing that adding a lot of complexity to reduce duplication is an exercise in diminishing returns pretty fast.
- Ozzie_osman 7y agoThis is so true. I say this all the time to my team. Given two choices, go with the one that produces less cognitive load. I used to say "less complexity" but I've found that even for me, sometimes when I do something that seems simple and less complex, it ends up requiring more cognitive load (it's not descriptive enough, or it tries to do too much "magic", etc).