-- Leo's gemini proxy
-- Connecting to siiky.srht.site:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
siiky
2021/12/15
2022/07/07
en
Naming, using, reading, and understanding well named operations rather than (kinda) well named variables grows the habit of reading and understanding code rather than relying on variables being well named -- and everyone knows naming is hard.
Bad:
x = '42' x_food = foo(x) x_bard_food = bar(x_food) x_zazd_bard_food = zaz(x_bard_food)
Good (using procedural composition):
x = zaz(bar(foo('42')))
Better (if the chain of operations is long):
x = '42' x = foo(x) x = bar(x) x = zaz(x)
Best (using functional composition):
(=> '42' foo bar zaz) ; OR ((-> foo bar zaz) '42')
It also comes with rather nice advantages. Just compare the two approaches in each scenario:
Imagine you want to change the order of operations in the chain;
Imagine you want to add an operation to the chain;
Imagine you want to remove an operation from the chain.
And a final bonus: the "better" approach is easier to read than the "bad" approach, and requires less typing, thank you very much.
-- Response ended
-- Page fetched on Mon May 13 16:55:22 2024