How to Program: An Absolute Beginner’s Guide
You can add 2 + 2, but do you know how to do that and print it out on a computer screen?
Learning how to program is a valuable skill. If you get good at it, you can even have a lucrative career. Pull up a chair, grab your coffee (or tea), and start learning about this mysterious thing called programming.
What is programming and what makes it a good career?
Programming is the act of writing computer programs. So what does that mean? There are computer programs everywhere. You’re reading this right now on a computer program (web browser) designed to read another computer program (web page) that was used to write this article (web-based word processor with grammar plugin). If you’re reading this on a tablet or phone, it’s the same basic program, but just a little different for the platform you’re using.
Your smart TV has several programs running on it. Maybe your watch does, too. You carry a small computer with lots of programs on it around with you every day, and you call it a “phone” even though that’s not really its primary function.
Software is everywhere and people like you and me write it, and we usually make good money doing so. It can be a great career because it’s one of the highest-paying fields out there that doesn’t require a specialized doctorate or world record sales skills.
Can you do something step by step?
When you write software, you have to tell the computer to do everything, step by step. You can’t skip over programming any steps unless you know for a fact someone else has already coded that little bit of functionality for you in some code library.
A word you might hear a lot as you learn programming is “algorithm.” An algorithm is “…a sequence of instructions, typically to solve a class of problems or perform a computation.” That just means it’s your step-by-step plan for doing whatever task it is you’re trying to program.
When thinking about how to solve a task, it’s important to drill down to the details it takes to get the job done. To illustrate, let’s look at the task of brushing your teeth. Here are the steps I take:
- Using right hand, pick up toothbrush from holder next to sink.
- Using left hand, pick up toothpaste tube.
- Using right hand while simultaneously holding toothbrush, open toothpaste.
- Apply toothpaste to top of toothbrush bristles, eyeballing the amount.
- Close toothpaste and put tube back down on counter.
- Using left hand, turn on bathroom sink faucet, on the cold side.
- Using right hand, put toothpaste-laden toothbrush bristles under running water for approximately 1 second, to dampen.
…And you get the idea of how detailed a process it is to brush your teeth. I didn’t even get into the brushing parts. This was just the setup!
When you learn how to write software, you learn to look at a problem or task and break it down to excruciating detail. Any part of a task you leave out of a program just won’t happen. Computers are dumb and need to be told what to do step by step.
We don’t know what data we’re going to use.
Software doesn’t know what data it’s going to use, so you need to write your programs to work on things in the abstract. You do that using variables. Just like in your early math training (hopefully), you learned that a variable is a placeholder for a value. X = Y + Z…that sort of thing. You will need to write your software to calculate that equation for pretty much any value.
For example, if you hard-code 5 = 3 + 2 in your program, it’s only going to be useful when the answer to your problem needs to be 5. That’s not helpful to anyone. If, however, you use variables that you can stuff with any data (of specific types, so let’s say numbers only in this example), your program can now make calculations based on variable input. That input can come from a user, a database, a text file, etc. If the problem you’re trying to solve is to solve for X, then you just input your Y and Z values from somewhere and watch your program work that math.
This is, of course, a very simplistic example, so let’s use something more concrete. If Twitter’s login was hard-coded with the username NotABot123456@twitter.com, only that user would be able to log in (unless you had their password). Since Twitter isn’t written by a group of small rocks, the login screen has a field where you can enter your login name and password. That way, the whole world can log in, assuming everyone has an account. That login field takes the input and puts it into a variable that works behind the scenes to lookup the user in the database and make sure they can log in with the supplied password variable and associated location and system details.
When writing software, try to think with abstract variables. If you can solve your problem for X, you can solve a lot. Now expand that idea and scale it to match your needs.
How to get started writing software…
Now that you have a good idea of what you’ll be doing in the abstract, how about we dig a little deeper into how to get started?
The first thing to figure out is what’s your computer? Are you using a Mac, Windows PC, or Linux? If you’re using Linux, the article is probably below your skillset, but thanks for reading this far!
Let’s assume you’ve got either a Windows or a Mac computer. The easiest thing to do may be to start with the development tool designed for your platform. That would be Visual Studio on Windows and XCode on the Mac. Notice you can use Visual Studio on the Mac, too. I’m not pushing you one way or another…just giving you information. And if you end up not liking either of these tools, don’t worry. There are many development tools out there for the various computing platforms.
Visual Studio and XCode are serious development environments. They’re not just colorful text editors, but rather tools that are used to create enterprise-grade software systems.
But you can also just write “Hello, World!” apps in both.
Here is a little tutorial for creating your first application using Visual Studio. It’s a simple little app to get you familiar with the development tools and the C# programming language.
If you’re on a Mac and don’t want to use Visual Studio to get started, you can do something similar in XCode. Here’s an example using the Swift programming language.
Read, watch videos, and experiment.
The key to learning how to write software is to write software. Read how-to articles. Watch videos on YouTube about programming, deep dives into computer science, and tours of languages and development tools. Try to do simple things with simple programs.
Learn about databases. They’re everywhere.
Learn as much as you can about the fundamentals of computer science, but don’t just rely on that theoretical knowledge. You have to sit down at your keyboard and write software to learn and excel and programming.
Once you do that — get good — doors will start to open for you. Whether you’re after a new career in a lucrative field or you just want to learn something new, give programming a shot. You might love it, and you might also be good at it. But you won’t know until you try.
Feel free to subscribe to my YouTube channel for more content like this and also not like this.