Is your mind an automatic error correction device?

A mentor and student discuss how the mind catches errors before they're obvious. After peer Zolake showed a simpler way to code a cache program, the student realized they'd over-engineered it. They explore how debugging code and editing a novel both rely on spotting inconsistencies, and how intuition often flags problems before any error message appears.
Chapters
Aimoi. So we've been 2 weeks. How have the last 2 weeks been?
It's been really good. It's been very, very fun.
Good. I love how positive you and your life are. Any highlights from either— from any of your classes?
Uh, in Humanities, we just started reading our first novel. It's It's called The Alchemist. I'm liking it a lot so far.
Mm-hmm. That's a famous one. I know a lot of adults who love that book. How far into it are you?
I think we're on— we have a PDF version that we're all reading together. I think we're on the 29th page or something on that version.
Excellent.
We just started.
The last time we talked, you were working on a cache program for Harvard CS50. Were you able to finish that cache program?
Almost. It turns out I was doing it completely— like, making it so much more complicated for myself than I'm— than I should. So I'm just revising it right now, and I should be done soon.
Very interesting. I actually think that's a great learning lesson in coding, is when we do things way more complicated. Can you tell me a little bit about how you made it more complicated than you should and, um, what the simplificate— simpler way is?
Well, I think at the most simplest level, how I made it so much more complicated for myself is, um, for just calculating everything. I wasn't— I didn't think through it, I guess. Or I didn't think about the easiest way I could have just done it, which is just one operation, and instead I was doing all this crazy multiplication, division. Looping through variables and stuff.
I was gonna say, last time I think you told me you had 4 loops, one for quarters, dimes, nickels, pennies. Is that correct?
Yes, it's just that, or it was a loop except, um, well, one, I wasn't sure if it worked correctly because it wasn't working at all, and two, um, I think I lost track of everything, so I think it kind of spirals off in a wrong direction. But I think I had the right idea. It's just I didn't quite grasp how I should have done it. But I'm there now.
How did you discover the better way to do it?
I actually went and asked Zolake, because I was having some problems. You know, I was testing it out and it wasn't going fully, so Zolake helped me out a lot.
Did he tell you what to do, or did he ask you questions or provide hints and suggestions? How did we help you?
I told him what my problem was and he shared with me the easier way. Um, and yeah, he just, he shared it with me kind of straightforwardly.
Would you say that once you saw the easier way, it was immediately obvious to you why it was the easier way?
Yes, immediately.
See, I think these are really great learning experiences. Um, and you know, it will happen over and over again in your life. You'll try to do something you'll do it the hard way and then you'll find there's an easier way. And then ideally in the future, you know, maybe it's— I think there's some problems that there's only a hard way. I think there are a lot of problems where it looks like there's a hard way, but if you think about it in a different way, there's an easier way. Do you think that there's any chance you could have figured it out the easier way on your own or not yet?
I think There was a possibility, but I, but I feel like I would have needed a nudge in the right direction because I was so wrapped up in my own complicated way. I wasn't quite thinking about anything else that I could have done.
Yeah, um, I think sometimes we need to kind of back off from a problem and find new ways to attack it. Does that sound right?
Yes.
Um, and, and so sometimes I get in a situation like that where, uh, you know, I feel like I'm kind of getting stuck. And would you say you felt like you were getting stuck in your, your CASH program?
I think so, yeah.
Um, have you ever, in any work you've done, had the experience of kind of backing off for a bit and then trying a fresh approach that was different?
I think that's happened to me a few times outside of programming also.
Well, I was wondering, you know, certainly I know in your— I wonder if in your writing, do you think of solving problems in your novels as somewhat like solving problems in coding, or are they completely different?
Um, well, in some ways they're different, but in the end they're both solving problems, that kind of help the rest of the text or program so that they're similar and different.
Can you give an example of a problem you were trying to solve in writing one of your novels?
Um, well, this wasn't necessarily a problem, but sometimes when I go back through the text, I find like a text or like a sentence that's messing up the order of things, wrong grammar, wrong punctuation, or just wrong wording in general. That's probably the most common problem for me.
No, that makes sense. And I'm going to see if I can make an analogy. So when we're writing something, we want the sentences to flow in the proper— we want the words to flow in the sentences, the sentences to flow in the paragraphs, and the paragraphs to flow into the chapter or story. Does that sound right?
Yes.
And I'm thinking of the kind of error that you're talking about: a word's not quite right, a sentence is not quite right, a paragraph's not quite right, is somewhat analogous in coding to a mistake or an error in the code. Does that make sense?
Yes.
Except in coding you get an error code, whereas in writing, how do you, how do you find the mistakes in writing without an error code?
I think you just have to keep going through it a lot. Like, I remember— this isn't the same problem, but a problem I had before was I forgot something that happened earlier in the story, and so I added a new thing that kind of over— over-written the other element in the story, so I had to go back and change everything and uh, change the story and change the guidelines and change what I was going to do.
I think that's a great example, and what that tells me is that you want your story to be consistent. That is, you want the plot to be consistent, you want the characters to be consistent. You don't want one thing happening in one part of the story that completely contradicts something that happened in the other part of the story. Is that correct?
Yes.
So in some ways, then your error, your error code is your mind saying, whoa, these two pieces are— don't work together. They're not consistent. So is your mind an automatic error correction device?
In the right circumstances, yes.
Do you think your mind ever does that in coding as well? Without the software giving you an error code?
I think there are some circumstances where I've run it and then I realize right as the error hits that I did something wrong. Um, and there are a few examples where I realized that I did something wrong, but those aren't very big.
Got it. Um, last time we talked, we were talking about similarities in structure, or the fact that there are general structures in both code and, say, writing. And we talked both about essays and about stories or narratives. Do you remember that conversation at all?
I do.
So, you know, the example we were using— well, first we were using the examples of loops in your cache program. Does your new program still have loops, by the way, or no loops remaining anymore?
I believe there will be a few loops, but not as complicated or as many as there were in the harder version.
Okay, so you've changed the structure of your cache program, uh, in terms of loops and others. Are there like if-then statements and things like that, conditionals?
There are a few.
Okay, so that's part of the structure. Actually, we were talking about sometimes writing out the structure on paper before coding. Did you write out the structure, the new structure before coding it?
I did something like that. I did that with Swahili.
Okay. And then in, you know, the stories, there's, you know, the Freytag's Pyramid as a structure. And then if you have multiple pyramids, there are multiple zigzag structures. And does it— do you see that there is a general structure But for both coding and stories?
Yes.
And then I guess I'm thinking about consistency. What is consistency? I mean, I have an intuitive sense, but how would you describe consistency?
I think consistency— I think of consistency as like if you're writing a story or something, you're following a path of where your story leads. It's better not to wander off that path, especially for the reader. I don't want to have my character doing some quest and then automatically saying, "Well, I'm gonna go home now." I think consistency is key to a lot of things. I guess it's kind of hard to describe, but Sort of sticking with, especially if you have a plan, not wandering too far off.
No, it is hard to describe. I think examples are helpful, and I can see not wandering off. I actually like your example where, you know, they're on a— character's on a quest, and in the middle of the quest, hey, I'm gonna go home. That would— it's that it sounds to me that's inconsistent with the idea of a quest. That is, you're on a quest, you're, you know, you're going towards the quest, and you can't just drop out randomly. Or if you did, that would fundamentally change the story and probably ruin it. And so it's both inconsistent with the nature of the quest and presumably inconsistent with the nature of the character, because I assume your character you want your character to be the kind of person who would persist in the quest. Does that sound right?
Yes.
Um, so there are interesting ways in which they have to be consistent with the nature of the story you're telling and consistent with the nature of the character. Um, and then somehow your mind figures out when something is inconsistent. Would you say it's always easy to know when a particular direction in your story is consistent or inconsistent, or sometimes you're like not sure if this fits or not?
Um, I think it varies. I think one of the easier ways to depict if your story is inconsistent, at least for me, is to check— or is to kind of compare it to other novels I've read. Like, is this It doesn't need to be exact. Obviously your story is going to be different and maybe your consistency, but, um, I think that helps.
So this is really interesting and I want to understand it better because presumably you're not saying you, you want your novel to match the plot of Harry Potter or Tolkien or whatever. So it's not a matter of being consistent matching the plot of another novel. "Can you say more about in what way you use other novels as a model for consistency in storytelling?" I think one of the bigger ways I use it is when, say, I'm kind of—
actually, it doesn't matter where in the story, but I think there's a lot of similarities between different stories in plot. But when I say plot, it's not the actual story. It's kind of the ups and downs of the plot and the way things go. And I think sometimes it's good, or it's easier to sort of, like I said, compare my ups and downs in my plot or my story and kind of match it with the other novels because, I mean, that other novel is really good and their ups and downs are consistent in their story, and if my story is at least sort of similar, then that could go hand in hand. And so sometimes I do that.
That's helpful. And so when you're talking about ups and downs, are these kind of like, um, you know, emotional ups and downs or action ups and downs? What do you mean by ups and downs?
I think I'm not— I don't— I'd like to do more emotional, but for now it's mostly just action. Like, I tried to implement that more in my story this time because I feel like last time and the time before it was a bit different.
Got it. So you're more aware of the pattern of action in novels you like, and you're trying to replicate that pattern of action Uh, in your current novel you're writing, correct?
Yes.
Where are you in that novel? Are you like mostly done? Have you finished one draft, or—
I finished the draft. We're gonna print it out either today or sometime this week.
Oh wow.
Yeah, and I'm gonna bring it down to my neighbor and I'm gonna go through it with her.
Oh, that's super exciting. Are you, are you proud and excited?
Yes.
No, it's always good, you know. And even if you're gonna— with your neighbor, do you Do you and she talk through it, or do you just read it to her, or she reads it to you? How do you and she work?
Usually, or last time how we did it was I printed it out for her, bigger text and stuff, double-sided pages. And the really cool thing is that she edits by hand. So it's cool to see how they did it kind of way back when. So I gave it to her and maybe just start with the first chapter. She edits it, and then we meet outside in the courtyard or something. Um, and then I go over with her. It's really fun.
Oh, it sounds marvelous. It sounds marvelous. Well, I can't wait to read, uh, the finished version when you are finally finished. Um, anything else you want to touch base on this week?
Um, I don't think so.
Okay, well, congrats again on getting a first draft of your novel done, and, uh, also on the new and improved version of your cash program.
Um, thank you.
And yeah, enjoy The Alchemist. Uh, have a wonderful day.
Thank you.
I welcome—
bye, see you next week.










