Week of 22 July
Algebraic effects, memoisation, and running a mile because GQ told me to.
This post by Dan Abramov.
Dan Abramov has such a way with explanation. Every post on his blog is a treat.
This week he described something called algebraic effects. I don't know why they're called that. But the idea is that in the same way as you can
try and wait for errors to bubble all the way up to the corresponding
catch, the idea here would be that you could bubble up on certain events and pass the result back down.
I'm not very good at describing it.
It makes sense, though.
This post at Scotch.io.
From where I stand, most programming seems to be fairly easy once you get the basic concepts. Things like data types and objects and using functions judiciously. This is all the basic stuff that I learned in my first year.
I think I spent my second year learning how to assemble all of that a little better. I'm learning every day, but I think that my code is reasonably readable, tidy, and organised. Some would say that I'm putting a little bit too much emphasis on developer experience.
Now I'm ready for ~advanced techniques~, and memoization feels like one of the first.
Everything is a bloody function now, and some of them are pretty computationally expensive. Especially things like searching, mapping over, or sorting through arrays. And since we're all writing idempotentfunctions, we shouldn't have to carry out the same expensive function if it's always going to return the same value.
Memoization caches the result of a function so that next time the function is called, the cached value is returned rather than running the whole function again. Which results in huge perf gains, which you can tell your boss about. Everyone appreciates perf.
Run a mile
This article from GQ.
Yes, an article from GQ. Something a little different here.
A marathon is way too far. Long distance running isn't great for you. Anything more than 10k is a huge time sink if you run regularly. I don't want to stop anyone else from running, but I've run a marathon before and I refuse to do it again.
On the other hand, I've always really liked interval training. I used to run 10 100m sprints a few times a week, and those were always quick and painful. Which is how I like my exercise.
Not much to say here. Haven't actually tried this yet. Gonna strap up and head out this weekend.