I hope to keep this blog useful to both more experienced programmers, who might find the topics interesting or might discover little nuggets of knowledge, but don’t need me to tell them how to get to Hello Word, and keep it useful to total beginners, who were the original intended audience. This post is for total beginners.
So, dear total beginners, welcome! I’m glad you’re here.
This post is about taking your first bite of the elephant. That is, it is about going from never having written code to having written code. So, here goes. My first step-by-step lesson:
Step 1: Coding with help from the Internet
Remember, there are typos. Perhaps the classic beginning programmer mistake is to blame errors on things besides typos in your own code. Start the habit of rereading things carefully when you get unexpected behavior. Ask yourself what you thought would happen, and what happened. Read the code, and ask yourself what each statement does. A little persistence and patience will get you through this course. A little good humor about how easy it is to type the wrong thing goes a long way, too.
Step 2: Get some way of executing arbitrary code
Codecademy is fun, but it’s a little bit artificial. You’re essentially editing little pieces of someone else’s half-finished project until they pass someone else’s pre-written tests. It’s a great start, but you need to make a leap to just writing arbitrary code.
The lowest cost way to just get code to do things is probably repl.it. This basically just let’s you write code in your browser, and see what it does. This can be a fun little sandbox, and I occasionally use it to try out a language before I go to the trouble of getting that language’s tool chain set up locally.
Try to build, from memory, something like what you built in Codecademy. (This won’t work well for the HTML parts of Codecademy, but for any part that has text only output, it should work fine.)
Step 3: Get a local toolchain
This section might be its own post later. There are too many variables for a good step by step instruction set that will work for everyone. How you do this depends on what language you’re using, what operating system you’re using, whether you want to use an IDE, and so on.
Here’s what I suggest:
Get a Good Text Editor
(Note: You cannot use a word processor, such as Microsoft Word, to edit source code. Word processors store will store files on disk in a format that doesn’t make sense to the rest of your toolchain. If you’re not sure whether a file is stored in plain text or not, open it in Notepad and see whether it’s readable.)
You’re going to be spending a lot of time in this program, so get one you like. Even though I often use a fancy IDE such as the full-fledged Visual Studio, having a quick text editor is pretty important.
Follow Some Instructions to Set up A Language
Pick a language you enjoyed playing with in repl.it, copy the code you wrote there into your local text editor, and then Google for “Getting Started with <Language> on <Your Operating System>”. This will involve installing a compiler or interpreter for the language. Get the code that was running in your browser on repl.it to run locally. I’ll put some links at the end of this post to the “Getting Started” pages of various programming languages.
(I’m sorry I can’t be more specific in this question. To get much more specific, I would have to choose your operating system and programming language for you, and I’m not really in a position to dictate that.)
Step 4: Rejoice a bit
If you’re still with me, congratulations! You just took your first bite of a very large elephant. (Or your first step of a very long journey, if you prefer a non-carnivorous metaphor.)
I include this step seriously. One temptation that has always plagued me as a I learn programming is the temptation to constantly look at what the best programmers in the world are doing and then feel sorry for myself. (See handling discouragement if that sounds like you.) It’s very important, for your morale and your productivity, to celebrate when you get something working. It gives you momentum.
Next week, we’ll talk about different types of tools and talk about version control. But for now, you can run programs that you wrote yourself! So go to town. Print “hello world” a prime number of times, or solve some silly fizz buzz type problems. You’re programming now, and that’s exciting.
The Promised Links
Here are links to help you get started:
- Python has a pretty low cost to getting started locally.
- If you’re bound and determined to be old-school, Learn C the Hard Way will get you started there. (That’s a sort of Linux-centric approach. If you use Windows, it will be a little bit harder to set up. In order to run his instructions without modifying them, I set up a virtual box running Ubuntu).
- If you want to learn C#, installing the Visual Studio Community on Windows is by far the easiest way to get started.
I hope you’ve found this post helpful, and that you were able to get started. I know that the Internet can be a little bit unfriendly to total beginners, so I want to personally invite you to comment on this post if the instructions don’t make sense. I will do my best to answer questions.
Till next week, happy learning!