2 ms·
> Develop a sense for clarity Ah, I thought this would define "readable code", but it's "how to write" it. The title, literally. missing step: understand WTF
by hyperpallium2 6y ago
> Develop a sense for clarity
Ah, I thought this would define "readable code", but it's "how to write" it. The title, literally.
missing step: understand WTF you are doing.
Many small functions also create complexity, though hadn't considered stacktrace documentation:
> [small functions] It’s easier to tell what the program was “thinking” when you look at a stack trace or run a debugger.
[don't mix levels of abstraction] also explodes the number of functions. I've seen this reasoning before, it makes sense, but I'm not convinced yet. I think if there's some substantial, genuine work done at each level, it's helpful. But just a sequence of calls doesn't help.
Nice bit on incidental duplication:
> The point of DRY isn’t to run a manual compression process on the codebase, it’s to avoid a dependency where two parts of the code need to be manually kept in sync.
In writing, clarity and simplicity go together. Of course, it takes longer to write a short letter. And, code is not writing.
- hyperpallium2 6y ago> don't mix levels of abstraction I'm uncomfortable about this because abstractions are difficult to define and demarcate - and end up being leaky anyway. So you need to change several separate functions in parallel, instead of having them in the same place. OTOH there are also some obviously different levels of abstraction, which it makes sense not to mix. Further, some such levels can be established in a particular domain, so whether good or not, they are helpful for people already trained in or familiar with that domain.