A blog but built with Github.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
blog/2021-01-29_HowToLearnHowToP...

9.1 KiB

I'm slacking! Missed a day!

How to Learn How to Program

The most common question I get when someone is interested in programming is "Where did you learn how to program?" Those familiar with my works already know my answer to that: Much time spent building thousands of demos and applications. Thousands. That's not a joke.... Let's dig deeper.

How to Acquire a Skill

Have you seen those advertisements / sponsors like Skillshare and things that promise many tutorials on starting new hobbies? Well, they do their job... Their job isn't to teach you a new hobby, it's to get you sucked into buying into their platform. Have you ever seen those things worked or tried it before? Let me summarize for you what happens. You find something you think is cool, you watch the first two videos, try it for a day and then don't come back tomorrow... I'll go into why this happens in the next few paragraphs and dissect it.

This is an example to help back my belief that skill acquisition whether it's programming or something else requires you to first devote yourself. You need a reason to want to do something. This is why I hate helping people with their programming homework. Because they just see it as homework I'll I see it as a great app waiting to be built and discovered...

A Great App Waiting to Be Built

Part of the fun of Computer Programming is Problem Solving. If you love solving puzzles or solving problems, then programming is actually really fun. A lot of people are not viewing computer programming from a problem solving perspective, but as a list of commands you run to get a result.

One thing I've done with peers and students in the past everytime we're doing homework assignments is giving them a scenario and problem that actually requires the same exact app that they are building. But instead, I create a narrative, a story, and a reason they need such an app. After doing this and seeing the responses from my students, I realized that if instructors could approach programming from this perspective as well they would get much more motivated individuals.

An app with a purpose leaves us more desire to build an app.

Programming is an Art

One thing I hate seeing are "requirements" for an app or game. I try to encourage programmers to have an overall vision going into a project but not the idea that "everything has to be this way". That's because programming is like a mold that you can form into anything much like an art form. The direction you take and the things you add to a computer program completely change your approach going into solving that problem and all future problems for that app!

Every single time I build a program, I build it differently. So the same problem in a different app always requires different approaches!!! I say this with enthusiasm as that makes computer programming a unique and different experience each time.

If the same problem can be solved the same way everytime, life would be kind of boring, right? By programming through molding instead of programming through knowledge (copy-pasting (*cough* *cough*) we will always end up experiencing new challenges and approaches. One reason why a computer programmer like myself is so competent with any type of code is because I've approached a problem from the left, right, top, bottom, inside-out, and upside-down directions of it. We don't need "best-practices", we don't need everyone writing code "the correct way". We need you to enjoy programming as an art form.

This is your canvas and you can create great things!

Example time! I've seen peers everytime they reach a problem that they've solved before, they just dig through their old code and use the same copy-pasted solution they came up with before. But this never works! For two reasons:

  • You don't get the repetitions in to walk through the logic every single time you do that
  • You assume that the piece of code was made only for that purpose

Let's talk about Repetitions.

Repetitions

Why are repetitions important? Much like exercise, your brain has neural nodes that have to be trained to remember things. When someone watches me code at blazing-fast speeds and it wows them, that is the result of doing something thousands of times. Again, I'm not exaggerating the thousands of times thing. I never recommend copy-pasting code until you are an expert in your field. Because you need to remind yourself of the logic, the step-through processes, and the structure of the code each time. This is how you grow.

The moment you start copy-pasting, you skip these steps. You stop caring about the reasoning behind why you chose that method in the first place, you stop caring about what the code actually does, and just treat it as a black box.

It's not a bad practice to do this once you can masterfully manipulate code, but this is one thing that beginner programmers make mistakes with. When someone I'm teaching asks me "Why can't I just use what I wrote above? It's almost the same thing!" It's not because I am trying to make you suffer. But your brain does need to learn this stuff through repetitions. It's going to hurt, but the long-term payoff is worth it!

Black-Box Code / Copy-Pasted Code

Common scenario: I tell a student to check the docs, check Stack Overflow, see if they can solve the problem using some online documentation. Then what I dread starts happening: They find this magical piece of code that "works". They don't even know why it works, they didn't bother to dissect the code and experiment. And they sure as heck did not rewrite the code line-by-line and learned what each line did.

They just now have a "tool" that happens to produce the result they want. Until I make them use it in another context and they either realize it does something that only worked in one very specific scenario, or it does way more than they originally thought it did.

Either way! My point stands, always write out your code when possible, even when you find solutions online. Usually only pieces of what you find are necessary, and you don't want to throw in a magic black box in your code, because it will have unintended side effects.

But How Do I Actually Learn??

Up until this point I've been talking about pitfalls of learning computer programming, but actual learning? This is the process:

  • Have a vision or something you want to make.

This is going to be what you work up towards. Maybe you can't make this app now, but this is the ultimate "goal". Keep in mind, this goal can change at any time also.

  • Isolate all the chunks and then make a small demo or project with a feature you want.

Let's say for example your app needs a sky that cycles through a realistic day-night color spectrum. To build that, you may break down your tasks into these sub-categories:

  • Learn to draw giant sky rectangle
  • Learn to color the rectangle two different colors
  • Learn to blend many colors from bottom-to-top based on a color sequence
  • Learn how to change that color sequence among a list over time.
  • Learn how to choose that color sequence based on a time of day given.

These tasks are pretty much in chronological order, and you can tackle each one with ease. Mostly because each problem is a sub-category of the overall goal. It's easy to google and research the functions you will need to get through these tasks. Searching how to do all of these at once or seeing all 5 steps and trying to do them all in one go is ridiculous!

Finally, once you make that piece of your product, integrate it into your main product and move onto the next mini project. Follow the same steps again! Break it up into its sub-categories. Work through them until you've accomplished all tasks. Move onto next mini project....

The Verdict

What you will find is that you may have never completed your original goal. But that means you've succeeded... "Sig, what do you mean? have you gone mad?" You know, my original projects I wanted to make turned out to not be what I wanted to make this whole time. Each time I completed a mini project, I realized that those skills can apply to certain other projects and from there dived into a sea of new things to build.

And then this spark of motivation to build other cool projects turned into a web of even more integration with each project where everytime I succeeded at building stuff for one project I realized it benefits certain other ones just as well.

So maybe we were never meant to complete everything we wanted to originally achieve. But I think by following this mindset of constant improvement and building upon what you've built over and over with no concrete goals you will always end up being a better you! And this doesn't apply to programming.

I hope you can realize that this type of learning system is actually how you succeed in anything in life. Don't worry about what people think, don't worry about trying to accomplish your one strict goal. You want to stray from your path. You want to go down that endless rabbit hole of new experiences to try and never-ending improvement. The farther you can dig into these things, the more successful you will be. Whether it's programming, or not...

This is how I learned how to program. Once you understand these concepts, you too can master and become anything you want to be.