[00:00:00] Andrew: All right, so this video is all about how to think like a programmer, how to develop a mindset like a coder. You're learning app script. You're learning the code behind Google Sheets, and I wanted to give you sort of a overview and some tips, at least advice over how to think like a programmer. Now that I've been doing it for many years, I really wanted to go back and think about like when I know when I knew nothing or I tried some things.
[00:00:25] I, I, I did, I attempted some things and I was. It was always like complex and it, it always seemed like everything was ahead of me. Now it, it still think, I still think everything's ahead of me, but look, I've always heard bad advice as well, so I wanna actually go to Cheche PT and ask how to think like a programmer.
[00:00:43] I bet like the answer's gonna be like something like break down the problem into simple, like parts like atomic element. Exactly break. Okay. It said it involves problem solving mindset, break problems in, down into sim. Smaller parts. Yeah. Cuz complex problems can be overwhelming. Analyze the problem, come up with a plan.
[00:01:05] Yeah. This is all the kind of advice that I hear all the time and it's terrible advice. Like, it's just pure, like, it doesn't make sense when you are. , this kind of advice doesn't make sense when you know nothing or you know, very little how to like, think like a programmer. It. This is the basic , the common advice and AI just proved it right.
[00:01:30] AI Chat, chat, G P T just sort of went through all of the advice and got like the most common advice and it's so trite and it, and it's ineffective. You can't analyze the problem if you don't know how to code. Like you, you can't come up with a plan if you know, if you don't know what to do, how, what, what elements are the basic elements and testing the solution.
[00:01:52] Okay. That's on the path sort of. As you implement your solution, be sure to test it to ensure that it is correct and effective. be prepared to iterate. Yeah. Like iterating is good, making changes, be flexible. You know, understand the solu the problem and you're gonna like figure out the solution.
[00:02:11] Right. Document your work. Like, okay. It's, it's fine for like working programmers, like this is all fine and well, if you are. in, in the mode of working. But if you're just starting out, right, like I'm trying to help you get better at App Script and I think this kind of advice is just terrible. So I came up with my own advice, and again, this is coming from a few years of programming myself in Google Sheets.
[00:02:41] I wanted to think of, and. recall, sort of what are the actual steps that I did? and maybe this is more like habits of a programmer or like good things to do, good behaviors to have the mindset. I, my, my personal belief is that the mindset comes from the actions, right? Your behavior will show your thinking.
[00:03:10] . So let, let's just get started. enough with the talk, enough with the introduction. I thought that Jet Chat, G P T, would be very helpful, and it was to show me what is considered the best advice. But here's my advice, all right? The first thing I would recommend is don't memorize. Do not think that you will remember everything, and literally you cannot remember everything.
[00:03:32] So one of the practices early on, I did. Was, I would just read the documentation through and through and like try to peek, try to memorize all of the options. Don't do that. Now, that did help me understanding what is available, but what I really want to get across to you through this course and through through more videos about app script and more videos about.
[00:03:58] Learning to code is learn the process. Watch the process right? As I do things, I might go over to Google help or I'll use IntelliSense or like the auto fill. I'll use the auto fill cuz I won't remember. Is it get active spreadsheet or is it get active sheet? I didn't know that for years and I just tried, which will be another, that's a spoiler alert.
[00:04:19] Figure out how to search. I routinely when coding and when programming in app script, I will literally go to Google a lot cuz I just don't remember the syntax. I don't remember this, but I know that it exists. I know there's documentation somewhere online and I have to figure out what to search for.
[00:04:34] Literally, I have to know, okay, early on I was looking for gas. G a s I would add that to search, uh, my search. I would type in a word and then add gas. That didn't help. I had to type out Google app. Or, um, yeah, now that's what I do. I sort of look for, I think of the action that I'm trying to do, and then I add Google App Script at the end of the search.
[00:04:55] And more times than not, I, I'll get a stack overflow. I'll get some results that even if I didn't get the exact I tried, and, and I'll try to figure out the actual words later. Don't memorize the code, but do remember and try to figure out the words and phrases that are used like in spreadsheet automation 1 0 1.
[00:05:19] I talk a lot about like functions, arrays. These are things that come up. , literally all the time. li like literally, every single time you're coding, you're working with functions, you're li working with a raise. Know those words, know tho those particular words that come up all the time and you don't have to sit there and memorize them.
[00:05:38] One of the hardest things for me when I was learning to code other languages and yeah, other languages, is the, the first set of material would be a lot. defining a word and then telling you what that word meant, but I didn't understand the context and it was very hard for me to understand, when are you gonna use this?
[00:05:57] How are you going to use this? Well, what I realized now years later is that those words were great to say, okay, is there a fun function to do X? How do I access the first element of an array is much easier to search for, and you'll get the right answers than, how do I get the first thing in a. For instance, if I know the word array is a list of elements, great.
[00:06:19] Now I can search for array all the time. So watch out for the words and phrases that I use in, um, Google App Script and in these videos, and understand like perhaps you don't need to memorize what a function is, what an array is, you're gonna work through it. . The second thing I will say here, and I would say let's try, that's sort of a, a mindset that I have, is just go for it.
[00:06:41] Like hit, hit, save, uh, hit run. Put that function inside your Google sheet and just try it. Just go for it. Give it a go. Give it a try. Get the steps that you're working through into your muscle memory. So just like I said, don't memorize. , don't try to memorize. Your muscles are going to remember, so your muscles are gonna remember, okay, hit publish, hit save, hit run.
[00:07:04] Go for it. Go for it. Your muscle will get that memory and there's lots of tools to that exist to catch errors. There's logger dot log, there's try catch, which I don't actually loo use that much, but it's extremely useful if you're like, I don't know if this , I don't know if this particular. Code will run.
[00:07:24] So you can put it inside of a try-catch and then catch the error. Sometimes the error code will be in a weird place, so just find out where that error code shows up in the log in, uh, in your screen in, it'll give you a big red bar. And there's lots of debugging tools, incoding in total, but also in Google App Script, which brings me to seek errors.
[00:07:46] This is the third advice I. I would try to imbue upon you is do not be afraid of errors. They're like tiny baddies along the way at uncertain, like smaller, early levels of a game. Like these are things like if, you know, if, if you see a batty, you know you're on the right path. If, like, if you don't get an error and like nothing happens, you're like, oh, what happened?
[00:08:11] Like, you don't know. Seek out the error. Try to change your code. Uh, early on when you're coding. And if you're in these if you watch some more of the videos in spreadsheet, automation 1 0 1 check out what error occurs. If you misspell something or you don't use a dot there's a video called dot notation, right?
[00:08:28] All about the dots. Take a dot. Run the code, see the, the error you get and get familiar with that, the fact that you're gonna see errors. Now here's something I will go backwards a little bit. Search for errors. The, I don't know why I didn't do this, but it actually was a very late occurrence or, or remind reminder for me is you can literally copy and paste errors and search for those.
[00:08:51] You might have to add Google Script, you might have to add app script at the end of these errors. Go ahead, like Google for him. Literally copy and paste the error and you'll see. , you'll see documentation and you'll see people with those errors and then what the issue is. But I mean, out of all of this, honestly, if this is the one thing you remember, please remember this.
[00:09:11] If you can only remember one thing, seek out errors early on, hit hit the wrong button. R name things wrong, and, and hit run. See what errors you get so that you know, okay, later on when you think you're doing the right thing and you get an. . Oh, it's because I misspelled something. Oh, it's because I didn't have a dot.
[00:09:30] It's because, oh, this is undefined. This is null. There's nothing here. There's, oh, yeah. That's not a function. Learn that. I think I talk about this a little bit in some other videos, but one weird thing about errors is that. Sometimes when you get an error, the actual error isn't in the line or the error that they're telling you.
[00:09:51] It's just before that. So something just before your code that's running and you get the error, it's actually the thing just before it that is causing the error. So causation of error is gonna be interesting to learn and, and understand. So seek them out, like find them out early on. See the error that you get when you misspell.
[00:10:10] So, intentionally misspell something. So you can see that when you unintentionally miss misspell something, you'll see the same error. Speaking of error and error documentation and, and searching for things, read more now. This is something that I had to learn this myself too. , the answers are usually somewhere online.
[00:10:31] In my videos I'll probably go faster than you expect. I'll, uh, sometimes I'll go faster than you want. You'll have to pause. You'll have to watch that video again. You'll have to see what I do, step by step by excruciating step I might say something and then do something else, or, or not say the entire thing that I'm typing.
[00:10:50] So you'll have to pause and retype it. , but I'm also very weary that a lot of the things that I do and say are in text somewhere. You can search for them. You can find them. There is an entire huge amount of documentation on Google itself, about Google App Script. Read it. I, I did spend, like I told you before, I, I tried
[00:11:14] There were times when I just go through the list of things, read it and try to memorize it, and I was. Now that's so silly. But I would read the documentation to get an, to get a flavor of, of what examples are being used, how do they use that? And I hope, you know, my hope is that better sheets is like 10 x that, right?
[00:11:32] The help documentation is gonna give you like one example I hope. That within, over the next few years, that there are tens and dozens and hundreds of examples that you're looking for of how to use this formula or how to use this app script or how the use cases of these things are infinite. And I hope that Better Sheets is a resource like that.
[00:11:53] I'm adding more and more resources, literally all the time, more use cases. So if you don't understand the thing as it's written right. , look for more use cases and see it again and again. And I would just say read more. Read more, read more. Keep reading. So if you get through and you're like, I, I understand this now.
[00:12:10] Keep reading, read just a little bit extra, see if there's any limitations or anything. And that brings me to, to the last thing is don't stop. Obviously we're gonna stop after this, after this piece of advice, but. . I can't tell you how many times I've stopped myself and been disgruntled and dismayed and disillusioned, and I was like, I'll never learn this.
[00:12:32] Like I can't do it. Right. I'll never learn. This is usually a byproduct of like, I can't do this. And like, if you can't do something, keep going. Keep trying. Keep, never stop. Don't haul. Don't slow down. Oh, well, sorry. You can. We all slow down. We should slow down a little bit. I should slow down in some of these videos.
[00:12:50] But don't stop. Keep trying. I'll tell you a little anecdote. When I, uh, about a year ago in, sometime in 2021, I was like, I should have built a Google sheet add-on. It's, it's one of those tools, kinds of tools that I was like, I should probably build one. And I created a. A Google sheet add-on, and I put it into like the, I went through the OAuth process and I tried to put it on the marketplace and I got stopped, like there was some issue with it and they emailed me back, like, this is sort of the normal processes.
[00:13:19] You, you put it up there, there's some issue with it, and you fix that issue and it, and it can be like 20 issues. It could be one issue, it could be five issues. And I literally was like, where is this thing that you're trying. like me to, I need to edit this thing. Where is it? And there was, there's this back and forth email literally for weeks and weeks and weeks, where I keep asking, where can I edit the thing that you're asking me to edit?
[00:13:41] And they like would say in here and I'd be like, I don't know where that is. Long story short, that add-on doesn't exist. I never got through it. About a year later, just a few months ago or few weeks ago actually, I created my first Google sheet on add-on. It's available now because I had gone through that process before I had gotten stopped, and I was like, I'm not gonna stop.
[00:14:01] I'm going to get this done no matter what. I also had some help. I think I actually talk about this in another video is I did get some help, right? I, I read Alice Keeler Great. Documentation about how to create a Google Sheet ad on that. She only put it up in 2022. So I didn't have that, that resource before to read.
[00:14:19] So I just read that all the way through. I did it step by step what she recommended, and. , I went through the same emails of, Hey, this is a problem. Okay, I'll, I'll fix it. Here's a problem, I'll fix it. And it went through. I didn't stop. I just slowed down for a few months, almost a year, and I got through.
[00:14:36] So like you can get through it and use other people's code and other people's projects, not as like, oh, that is something I want to do, but rather as an example of it can. Right. If somebody else is doing something that you're trying to do, understand it can be done. They didn't fake it, they made it.
[00:14:55] And you can make it too. And you can automate your processes. You might have to be a little creative. And and don't take this advice , please of, of chatty pt of, of breaking down problems. I don't think. I, I, I do think that bringing down problems into its smaller parts is essential to programming, but it's not something like you can really do.
[00:15:15] Like you have it or you don't. And, and actually you might, you might be someone who builds from bottom up or top down. and both of those are perfectly fine. I think breaking problems into its smaller parts, top down, but understanding a lot of different small parts and finding, figuring out how to put them together, that's a, that's a different skillset and I think both of those for programmers are easily acceptable and useful.
[00:15:39] You might be stronger in one than the other. You might see connections that other people don't see, or you might want to, but I think also, You can just do it . You can just try it. So to summarize what I said to to think like a programmer or develop the mindset of a coder don't memorize anything.
[00:15:56] Understand and learn the process and know that the documentation is out there. Try things. Get it into your muscle memory. Do it. Go for it. Hit that publish, hit that. Go, go run, run something. Seek out errors. You're gonna get errors, so, so seek 'em out early on and understand what they mean. Like what the actual words in the errors mean.
[00:16:17] Read more. You're just gonna have to read a lot more than you ever imagined, like I imagine like. Programming is probably like 90% reading, 10% coding. truly, like for every piece of code I write, I've probably read like 10 X , right? And don't stop. I'm here for you. You can email me anytime you can also just watch a bunch of videos, right? and see what other people are doing. If nobody else is doing something you're trying to do, email me and let me know what, what's this new thing you're trying to do that no one on earth has ever tried before? I would love to know. Don't stop. Email me and let me know the, the new thing you're trying to do that nobody has done it anymore.
[00:16:55] And let me know. I'd be really happy to see some unique stuff. All right. That's how you think like a programmer. It can develop the mindset of a coder and it won't be over. definitely won't be overnight. Thanks for watching. Get Coding bye.