Re:John Carmack on Inlined Code (2014)
by qwertyuiop924 on Tuesday July 19, 2016 @01:34PM
(#12123267)
If you write and document your DSL well, the cognitive load is minimal, unless you need to plunge into the implementation. And it's not hard to write a DSL: I wrote what looks a heck of a lot like a DSL for a very simplistic piece of IF I wrote with maybe 5 exposed functions, and no macros.
Abstracting with functions is very beneficial to the writer because, well, they come up with the abstractions and know what they mean.
I feel they are less helpful to the reader, except perhaps at a very cursory level. If the reader is trying to actually understand the code to be able to modify it, many abstractions are actually a hindrance.
For example, in lisp, it's a fairly common practice to essentially write a DSL for the problem you are solving. It's a great tool to be able to do this easily and quickly. You can build massive and complex programs without overloading your brain.
However, for a reader new to your code base, there is a huge cognitive load to try to decipher the DSL. It's intuitive for the writer, because they invented it, but for the reader, it is a hurdle to overcome.
Once you learn someone's DSL, it's a very powerful tool now for you too. But when every project has it's own, it's really too much to bear.