6 ms·
I have a crazy theory that when we read code, we actually read it as a narrative, because that's how our brains are wired. And we can't help it. It's baked in.[
by dimal 3y ago
I have a crazy theory that when we read code, we actually read it as a narrative, because that's how our brains are wired. And we can't help it. It's baked in.[0]
Good, readable, code tells a story. (Here is the protagonist(s), the value(s) you're starting out with, next is the journey, the transformations on the data, then the conclusion at the end is the return value.) This is why I like functions more than objects. Each function is a self-contained story. Bad code is like reading a stream of run-on sentences with no coherent beginning, middle or end. It's like hearing a story from someone who gives you all the irrelevant details of whatever they're trying to tell you and doesn't get to the point.[1]
[0] https://medium.com/the-protagonist/the-science-behind-storytelling-51169758b22c https://medium.com/the-protagonist/the-science-behind-storyt...
[1] https://youtu.be/n5CgGTziQ4Y?t=61 https://youtu.be/n5CgGTziQ4Y?t=61
- Terr_ 3y ago> And we can't help it. It's baked in. I often like to point out that our instinctive need to see narratives (or aversion to the inexplicable) is so strong that we construct stories even onto situations where we know (in other moments) that the story is wrong. Gambling is a great example, and it's easy to see when people are flipping coins while insisting that recent past flips determine the next flip because of "a hot streak" or "the other one is overdue".
- foundart 3y agoAs someone with formal education in both literature (including lots of analytical essay writing ) and computer science, this resonates strongly with me and is a great addition to my toolbox for thinking about code. I'm wondering how useful it would be to deploy among my colleagues who don't have similar backgrounds. Have you tried that?
- dimal 3y agoNot yet. I was working up to it at my last job, but I was laid off. What I’d love to do is something like John Ousterhout’s software design class. He admits that he based the format on an English writing class. People would write code, then their classmates would read it and make comments and then they’d revise it. I’d love to give this a shot in the real world. If you’re up for discussing this, I’d be happy to talk about it more. My email is on my profile.