Thursday, 16 August 2018

Learning to Code: How to Think Like a Programmer

When first learning to code, it’s easy to feel like a deer in the headlights; everything is unfamiliar and new. It's like learning to play a new instrument or a foreign language—what is this and what the heck am I doing?

I completely understand. When I started programming, I had no real-life experience, no one to teach me. I never got a degree in computer science. Initially, I wanted to learn how to code because I was creating a website for a friend and felt frustrated having to ask multiple times for tech support. I wanted to figure out how to improve the site on my own.

I went from knowing zero to starting a career in tech within one year, after studying for around one to three hours a day. I experienced it all: confusion, frustration, lack of context—and that’s just the beginning. I knew no one in the tech industry to ask for help. So what did I do? I sat down and struggled hard.

Feeling overwhelmed? Don’t be. Every professional no matter how successful started at ground zero—or level negative thirty in my case. Every expert was a beginner once and felt like you.

It could have been easier, though, with the resources and steps I now know. Whether you want to add a few lines of code to your Zap or start your dream career in game or software development, the first steps to becoming a programmer is to start thinking like one.

Become a Problem Solver—in Programming and Life

programming on a laptop

“Everyone in this country should learn to program a computer, because it teaches you to think.”- Steve Jobs

Steve Jobs possessed extraordinary drive and talent, skills he used to take Apple from a startup in a garage to one of the world's most valuable companies. Beyond business acumen or entrepreneurial skills, though, Jobs valued programming knowledge. "Everyone in this country should learn to program a computer," said Jobs, "because it teaches you to think."

Not only is coding crucial in many jobs—both in programming careers and many other scientific and technical careers today—it’s an ability that can improve the way you approach new challenges in life. At its core, programming is about problem solving: thinking logically and breaking down a problem into steps to find a solution.

You’ve probably heard the expression “think like a programmer.” This means having the ability to see a challenge from one angle, then being able to take a step back and look at the same challenge from an alternative perspective. Do this over and over again until you find a solution.

Let’s take a common scenario. Say you’ve always wanted to start your own business. Maybe you hate your job and want to start something new, or you want to start a side business to do something on your own. Yet something has always deterred you from making it happen. How can you approach this challenge with a programmer mentality to solve it right now? Yes, right now.

Start by analyzing the factors that contribute to this situation. Instead of first looking at others and how they’ve made the change, start “thinking like a programmer” by taking a step back, breathing, and taking another look at the problem—yourself.

What’s stopping you? Maybe you don’t have enough energy at the end of a long day? Okay. There’s your first mini challenge within your bigger goal: How can you solve it? After that, what’s the next step you can take? Research! Learn how others have built up energy when they’re exhausted and just do it—whether that be exercising for 30 minutes, taking a walk with your pet, or changing your diet.

Don't have the time for that solution? Take a step back and visualize your whole day. You’re busy with work 8-10 hours a day, sleep another 8 hours, and are potentially unproductive for the remaining 6-8 hours a day. Considering your challenge from this perspective, finding 30 minutes to an hour of an entire day for your new project shouldn't feel so intimidating anymore.

Once you've solved the first challenge, other challenges will arise. Keep resolving them with this problem-solving mindset, and view them from multiple perspectives instead of giving up.

Every challenge in life is a lesson to help us grow. Break your goals into small steps. Solving one small challenge a day equals 30 challenges solved at the end of the month—that’s a lot. You’ll realize how thinking like a programmer—basically a problem solver—can aid you in multiple facets in life.

You will experience stumps on the path to becoming a programmer almost every day. It'll get better. As time goes on and you feel familiar with your environment, you'll feel more confident and have less trouble—similar to most skills. Patience and persistence are key.

Learn to Not Give Up

Possibly you feel intimidated by all the programming terms before you even start to learn. Maybe the challenges seem solvable, but you can’t think of a way to solve them due to limited context. Once you start programming, you might spend hours looking for a bug and feel ready to quit. How can you get around these common pitfalls?

Be Persistent

The most important thing, whatever your situation, is to be persistent.

In the beginning when you research ways to solve a challenge, push yourself beyond your limit—at least a little bit more than usual. When you feel exhausted, drained, and ready give up, many times that's when you finally figure it out. The moment where most people give up is the moment you need to keep going because this is when you improve. Everything uncomfortable is a gift so we can grow as individuals and strengthen our character.

The first few months are the most difficult. Don’t worry; I can tell you from experience it gets better. The hard work you put into it matters. I guarantee you’ll improve as time goes by.

Remember Your Goals

Another way to push yourself forward is to remember your goals. Why do you want to learn to code? Keep a list of your goals on your computer, in a notebook, or stuck to your wall. I like to make lists of my goals, then remind myself of them every morning. That sets my intention for the day and helps me focus on accomplishing them.

When I started, my first programming language was JavaScript. I chose this language because it’s widely used, it’s a frontend language—meaning I can work more on website functionality and design—and it also has high job demand. That met my goal of starting a programming career.

There are many avenues to start learning. You can teach yourself for free online, go to a coding school, take classes at your local university, or even attend meetups—I did a mix of these. But no matter how you learn, keep your goals in mind. They're why you're studying—and what will get you through whenever you get stuck.

Figure Out How to Solve Any Coding Challenge

While learning to code, you’ll get stumped and won't know what to do more than a few times. That's true throughout your career, but especially true in the first few weeks while you’re still developing context around challenges and learning your way.

One of the beneficial soft skills you’ll develop while learning to code is how to research the way a detective investigates a crime scene, both by finding answers yourself and asking others to fill in what you can't find.

Step 1: Try to Find the Answer By Yourself

thinking

“It’s not that I’m so smart, it’s just that I stay with problems longer.”- Albert Einstein

Before you ask someone, push yourself as much as possible at your current skill level. This is the only way to develop your skills further and get to where you want to go.

The tough part is researching when you don’t have much context. Say you’re faced with a challenge and asked to solve it with a method you’ve never heard of. Or you don’t even know if a method to solve this challenge exists.

Start by searching Google if a method for whatever you’re looking for exists in your programming language. It doesn't have to be difficult; a simple method javascript cut a word into strings search gives you a list of results all using the method split. You’ll do this a lot in the beginning until you gain more context. Once you're a full programmer, you'll still search, only this time with a bit more knowledge of what you need.

As you Google issues, you'll most often come across discussions and documentation on Stack Overflow, GitHub comment threads, Mozilla's MDN Web Docs, W3Schools, and documentation sites for your programming language or platform. When you're starting out and have little context when researching for a solution, read through the comments and see if there’s something else you can learn along the way. Don’t be disheartened if a lot of things people say don’t make sense to you. Remember they were in the same shoes as you one time, so you know one day you’ll understand this too. Once you have your answer keep going like this with all the stumps along the way.

Then try the solution you found to see if it works. Writing JavaScript or HTML? Try testing out your code in Google Chrome’s debugger. You can test your code in the browser, see if it's producing the correct output, test out styles in the browser before adding them in your editor, read data of requests coming in or out, and more. Start out with Zapier's inspect element guide to learn how to tweak any website's code, then check out this video tutorial on testing JavaScript in Chrome.

What about when you have context but are still stuck? Say you’re faced with a challenge and feel that you have enough methods and ideas in your mind, but feel like you still can't figure out the full solution. Maybe you think you’ve solved the challenge but are still getting errors. Here's how to troubleshoot:

First, make sure you’ve checked for typos. Can't find any?

Next, try taking a step back. Can any of the methods or ideas you have solve this problem if you look at it from another angle?

If this doesn't work, try taking a breather. Looking at the bigger picture, or looking at it from another angle doesn't work until we take some time away from the code. So take a walk, eat, exercise, chat with someone—take a break. Sleep on it if you need. Then when you’re ready, come back to the problem. You might realize the break is all you needed.

If you're still stuck, start over again with another Google search—or perhaps a site-specific search on Stack Overflow or another coding site where you routinely found solutions while learning to code. Try to see how others have solved similar problems. Maybe the solution is already out there, and someone has solved it in a way you’ve never considered. Perhaps your current ideas are a dead end, and you'll find a more creative solution. Either way, you'll learn more. Next time you face a similar challenge, you’ll know how to handle it.

Step 2: Ask Your Coding Community

group programming

“A good programmer is someone who always looks both ways before crossing a one-way street”- Doug Linder

Knowing when to stop and ask for help is just as important as knowing when to keep going. As a beginner, give yourself more time to research and figure out the challenge you are facing before asking. If it’s been more than an hour, though, it’s probably a good time to ask someone.

If you’re alone at the moment and there is no one to ask—not even anyone online— then stick through it. Eventually, you’ll find your solution. There have been times at the beginning where I’ve spent hours and sometimes days figuring out a challenge. Be okay with that. As long as you’re still learning and applying what you learn with every mistake, then you’re progressing!

When you do finally ask for help, you can level up your skills in less time. Similar to searching for a solution online, getting help from others lets you see the problem through their eyes. This teaches you both a new way of approaching the issue as well as how to solve it. Most people are more willing to help when you show you've put work into figuring out the problem yourself. When asking others, make sure to give good context, explain how to reproduce the issue, and try to make your wording as short and sweet as possible.

When you ask a question, give as many details as possible. Context is crucial—plus it saves everyone time. Explain the steps you took that created the problem so the person helping you can run through them, and share any code you've already written. They may notice something you’ve overlooked or a problem in your existing code. Explain what you expected to see and what happened—and what you think the problem could be.

Above all, be polite when asking your question. You’re taking someone else’s time when you ask and the person helping is being generous, so be grateful. Say thank you when they’ve helped you, and if you found the answer before they can reply, notify them right away to save them more time researching.

If you've already taken a coding class, you can likely ask your teacher, classmates, or other mentors you've met along the way. If you work at a company with other programmers, you might be able to ask colleagues for advice. Or you can find an online community to get help. FreeCodeCamp offers an online chat with multiple channels where you can ask any programming question. Check Meetup's coding groups for a local event, or check out sites where you first learned programming like Stack Overflow to help others in the community learn from the answers too.


Start Your Programming Journey

You’ve just learned the basics of thinking like a problem solver and how to start applying these skills immediately within daily life while you learn to program. Whether you're looking for a full-time programming job or want to learn simple coding steps to solve personal tech problems, these skills will help you get there.

Keep learning and don't give up. With some hard work and persistence, you can definitely learn to program!

Want a simple way to start programming? Check out these Zapier guides for some of the easiest ways to program with almost no coding skills:

  • Build a chatbot in Slack using Zapier workflows, filters, and automations
  • Add bits of code to Zapier workflows with Code steps for a simple way to start using JavaScript in your work without developing a full program
  • Want to do more in your spreadsheets? Our Google Sheets Script guide will help you build your first spreadsheet macros to format your spreadsheets and find data automatically
  • Pull it all together in our guide to coding your first landing page

Laptop typing photo by rawpixel via Unsplash; thinking at laptop photo by Wes Hicks via Unsplash; group programming photo by NESA by Makers via Unsplash.



source https://zapier.com/blog/think-like-a-programmer/

No comments:

Post a Comment