Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My experience, limited though it is, is that there is a trade-off between how easy it is to write code vs how easy it is to read.

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.



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: