Think Like a Programmer | Develop The Mindset of an Apps Script Coder

•Don't memorize. Know where the information is •Read the documentation •Try things. Go for it! •Seek out errors.

Think Like a Programmer | Develop The Mindset of an Apps Script Coder

You're learning Apps Script. You're learning the code behind Google Sheets, and I wanted to give an overview and some tips, at least advice over how to think like a programmer.

TL;DR

• Don't memorize. Know where the information is.
• Read the documentation.
• Try things. Go for it.
• Seek out errors. You're going to get errors, so seek them out early on to understand them.
• Read more. You're just going to have to read a lot more than you ever imagined. Programming is 90% reading, 10% coding.
• And don't stop.

I've heard Bad Advice

Now that I've been doing it for many years, I really wanted to go back and think about like when I knew nothing or I tried some things. It was always like complex and it always seemed like everything was ahead of me.

I still think everything's ahead of me, but look, I've always heard bad advice as well. So I want to actually go to ChatGPT and ask ChatGPT how to think like a programmer.

Okay. It said it involves problem solving mindset, break problems down into  smaller parts. Yeah, because complex problems can be overwhelming. It also said to analyze the problem, come up with a plan.

This is all the kind of advice that I hear all the time and it's terrible advice.

This kind of advice doesn't make sense when you know nothing or you know very little how to think like a programmer. This is the basic, the common advice and AI just proved it right. AI Chat/ChatGPT just sort of went through all of the advice and got like the most common advice and it's so trite and it's ineffective.

You can't analyze the problem if you don't know how to code. You can't come up with a plan if you don't know what to do, what elements are the basic elements.

Testing the solution. 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. Iterating is good. Make changes, be flexible. Understand the problem and you're going to like figure out the solution. Right.
This is all fine and well if you are in the mode of working. But if you're just starting out – i.e. I'm trying to help you get better at App Script –I think this kind of advice is just terrible.

So I came up with my own advice. Again, this is coming from a few years of programming myself in Google Sheets.

I wanted to think of and recall what were the actual steps that I did. Maybe this is more like habits of a programmer or like good things to do, good behaviors to have the mindset. My personal belief is that the mindset comes from the actions. Your behavior will show your thinking.

I thought that ChatGPT would be very helpful and it was to show me what is considered the best advice. But here's my advice:

Don’t memorize.

Do not think that you will remember everything, and literally you cannot remember everything.

One of the practices I did early on was I would just read the documentation through and through. I would try to memorize all of the options. Don't do that.

That did help me understanding what is available, but what I really want to get across to you through this course and through more videos about Apps Script and learning to code is learn the process. Watch the process.

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 because 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.

When coding and programming in Apps Script, I will go to Google a lot because 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.

Figure out what to search for.

I think of the action that I'm trying to do, and then I add Google Apps Script at the end of the search. And more times than not, I'll get a Stack Overflow. I'll get some results that even if I didn't get exactly what I was searching for, I'll try to figure out the actual words later.

Remember the words and phrases to use.

Don't memorize the code, but do remember and try to figure out the words and phrases that are used. In Spreadsheet Automation 101, I talk a lot about functions and arrays. These things come up every single time you’re coding. Know those particular words that come up all the time and you don't have to sit there and memorize them.

One of the hardest things for me when I was learning to code other languages is 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 going to use this? How are you going to use this?

Watch out for the words and phrases that I use in Google Apps Script and in these videos. Understand that perhaps you don't need to memorize what a function is, what an array is. You're going to work through it.

Just go for it.

The second thing I will say here that's sort of a mindset that I have is just go for it. Put that function inside your Google Sheet and just try it. Give it a go. Get the steps that you're working through into your muscle memory.

So just like I said, don't memorize. Your muscles are going to remember. Hit publish, hit save, hit run. Go for it. Your muscle will get that memory and there's lots of tools to that exist to catch errors.

Sometimes, the error code will be in a weird place. Just find out where that error code shows up in the log. In your screen, it'll give you a big red bar. And there's lots of debugging tools, encoding in total, but also in Google Apps Script, which brings me to the next one…

Seek errors.

This is the third advice. I would try to imbue upon you: Do not be afraid of errors. They're like tiny baddies along the way at uncertain smaller, early levels of a game. If you see a baddie, you know you're on the right path.

If you don't get an error and nothing happens, you're like,  “Oh, what happened?” You don't know. Seek out the error. Try to change your code.

Now here's something I will go backwards a little bit. Search for errors. You can copy and paste errors and search for those. You might have to add Google Script, you might have to add Apps Script at the end of these errors. Go ahead, Google for it. Copy and paste the error and you'll see documentations. You'll see people with those errors and then what the issue is.

If you can only remember one thing, seek out errors early on. 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. It's just before that.

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 going to be interesting to learn and understand. Seek them out, find them out early on. See the error that you get when you misspell. Intentionally misspell something.

Read more.

Speaking of error and error documentation and searching for things: Read more.

This is something that I had to learn this myself too. The answers are usually somewhere online. There is an entire huge amount of documentation on Google itself, about Google Apps Script. Read it.

I hope that Better Sheets is a good resource for you. I'm adding more and more resources all the time, more use cases. If you don't understand the thing as it's written right, look for more use cases and see it again and again. I would just say read more. Read more, read more. Keep reading.

Don’t stop.

I can't tell you how many times I've stopped myself and been disgruntled and dismayed and disillusioned. I was like, “I'll never learn this. I can't do it.” This is usually a byproduct of “I can't do this.” If you can't do something, keep going.

Keep trying, never stop. You can slow down, but don’t stop. I'll tell you a little anecdote: Sometime in 2021, I was like, “I should have built a Google Sheet add-on.” So I created a Google sheet add-on, went through the OAuth process, I tried to put it on the marketplace, and I got stopped. There was some issue with it and they emailed me back, “There's some issue with it, and you fix that issue.”

I literally was like, “Where is this thing that you're trying to tell me?” There was this back and forth email literally for weeks and weeks and weeks. 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, 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. I was like, “I'm not going to stop. I'm going to get this done no matter what.”

I also had some help.

I read Alice Keeler’s great documentation about how to create a Google Sheet and she only put it up in 2022. I didn’t have that resource before to read. So I just read that all the way through. I did it step by step what she recommended. I also went through the same emails. I didn't stop. I just slowed down for a few months, almost a year, and I got through.

Use other people's code and other people's projects, not as like, “That is something I want to do.” but rather as an example of it can be done. 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. And you can make it too. You can automate your processes. You might have to be a little creative.

Please don't take this advice of ChatGPT breaking down problems. 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. You have it or you don't.

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, but understanding a lot of different small parts and finding, figuring out how to put them together, that's a different skillset. I think both of those for programmers are easily acceptable and useful.

You might be stronger in one than the other. You might see connections that other people don't see. But I think 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.
• 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.
• Seek out errors. You're going to get errors, so seek them out early on and understand what they mean, what the actual words in the errors mean.
• Read more. You're just going to have to read a lot more than you ever imagined. Programming is probably like 90% reading, 10% coding.
• And don't stop. I'm here for you. You can email me anytime. You can also just watch a bunch of videos 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'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. I'd be really happy to see some unique stuff.

And that's how you think like a programmer! It can develop the mindset of a coder and it won't be overnight. Thanks for reading this tutorial. Get coding.

Watch the video for this tutorial:

Learn more on how you can improve your Google Sheets:

Get more from Better Sheets

I hope you enjoyed this tutorial! If you want to do more with your Google Sheets, I have other tutorials, like how to create a timer with Apps Script and learning to code with Google Sheets. Beginner? Intermediate? There’s a lot of tutorials for everybody! Check them out at Bettersheets.co.

Join other members. Pay once and own it forever. You get instant access to everything: All the tutorials and templates. All the tools you’ll need. When you’re a member, you get lifetime access to 200+ videos, mini—courses, and Twitter templates. For starters. Find out more here.

Don’t make any sheets. Make Better Sheets.