4 ms·
"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." This quote is from Alan Perlis' Epig
by jasonzemos 7y ago
"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." This quote is from Alan Perlis' Epigrams on Programming (1982).
- mateuszf 7y agoWhich is also a base design principle of Clojure. There are few persistent data structures at the core, a sequence abstraction and lots of functions to work on them.
- rightbyte 7y agoSo you would have one data structure with 10 pointers to those 10 data structures you need and 10 times the functions? Id rather split up independent structures.
- amw-zero 7y agoHaving a smaller amount of data structures makes the whole graph of code more comparable. Creating a bespoke data structure for 10 different elements of a problem means writing quite a lot of code just to orchestrate each individual structure, mostly due to creating custom APIs for accessing what is simple data underneath the hood. There’s a reason why equivalent Clojure code is much much shorter than comparable programs in other languages.