After a long while, I bought an (DRM-free) ebook again
(Manning currently has a 35% discount so go get it and maybe read it along with me? https://www.manning.com/books/the-programmers-brain)
The Programmer's Brain - Felienne Hermans

With this unique book learn how to optimize your brain’s natural cognitive processes to read code more easily, write code faster, and pick up new languages in much less time.

Manning Publications
Wait‼️ Why am I just now learning that @Felienne wrote a paper title “Programming is writing is programming”⁉️ That’s so obviously my jam! https://dl.acm.org/doi/10.1145/3079368.3079413
“Research has shown that when code contains comments, programmers will take more time to read it.”

‘Beacons are parts of a program that help a programmer understand what the code does. You can think of a beacon like a line of code, or even part of a line of code, that your eye falls on which makes you think, "Aha, now I see."

Beacons typically indicate that a piece of code contains certain data structures, algorithms, or approaches.’

Turns out that all that time I spend “making the code pretty” I was just making it understandable. The question is if what I consider pretty/understandable is the same as other programmers would call pretty/understandable

“after taking a course on design patterns, the time participants needed to maintain code was lower for the code with patterns but not for the code without patterns. The results of this study indicate that gaining knowledge about design patterns, which is likely going to improve your chunking ability, helps you process code faster. You can also see in the graphs that there is a difference in effect for different design patterns: the decrease in time is bigger for the observer pattern than for the decorator pattern.”

I have no idea what the decorator pattern is, but I’m a fan of the observer and i sprinkle it everywhere whenever I can.

A tangent: I think this the magic of functional programming: you have some well defined concepts that you can mix and match. It’s hard to learn them because they are unfamiliar, not because they are difficult, but once you do, it’s easier to reason about stuff that uses them

“In summary, you remember the longest if you study over a longer period. That doesn't mean you need to spend more time studying; it means you should study at more spaced-out intervals. […] This is, of course, in stark contrast with formal education, where we try to cram all the knowledge into one semester, or with bootcamps that seek to educate people in three months.”
“[…] recent research indicates that people never really forget memories—and that it’s the retrieval strength of memories that decays over the years”

In the age of so called AI isn’t it weird I’m reading a book that teaches you how to use refactoring and state tables for the sole purpose of understanding?

Weird is good though

The point of the chapter though is that readability and maintainability aren’t the same, and readability depends on the experience of who is reading.

So, for example, I tend to dislike loops now, I think they add too much noise to what usually can be just a map + a filter call, or reduce or whatever. But before I started to learn Haskell any code using higher order functions was overly confusing for me.

I been rejecting any attempt to make languages easier to learn or more familiar based on how my own experience. Learning is uncomfortable and takes time. There’s no shortcut. If you wanna help beginners don’t be an asshole when they ask stuff. That’s 100 better than adding braces to an ML language (yes I’m still mad at ReasonML)

@RosaCtrl I’ve come back around to for-loops & mutation as the most straightforward way to express most things (while also mapping well to how the underlying instruction set works)
@RosaCtrl you essentially can’t have arbitrary closures without a pretty complicated runtime/compilation framework if you want it to be somewhat performant

RE: https://social.vivaldi.net/@RosaCtrl/116266188163951271

@Profpatsch well, those are two different things, aren’t they? I’m talking as an user. In Swift I can’t use higher order functions when async is involved, so I have to use loops from time to time, and I still prefer pipping stuff to mixing intention and implementation in one place. I just love to see:
.map …
.filter …
.any …
These are beacons!

@RosaCtrl But now you need some sort of higher order lambda fusion framework if you want it to be performant at all
@Profpatsch I’ve replaced these with loops if necessary, yes. This makes me wonder if there’s any Swift feature regarding this that I’m not aware of…
@RosaCtrl @Profpatsch I think LLVM can do a lot of this (and it’s partially why Apple invested so much into it).
@samir @RosaCtrl yeah, at the cost of huge compilation times
@Profpatsch @RosaCtrl Only if you’re not comparing to Haskell! 😛
@samir @RosaCtrl that’s true. but only because most people have 0 clue how to structure Haskell codebases for compile times …
@Profpatsch @RosaCtrl If you have to structure the codebase of a high-level almost-fourth-generation language for reasonable compile times, the promise has been broken.
@samir @RosaCtrl can’t undo logics unfortunately …