How to Start Learning to Program

Welcome!

I'm glad you have an interest in learning how to code. It's incredibly interesting, and anyone can learn how to do it given enough time and willpower.

Why coding rocks

I am very passionate about computers and technology, for many reasons. Knowing how computers work gives one a fundamental understanding of our modern world, and the power to change it. Any program that you use, and task that you do, any site that you visit, all of that is yours to change and build upon. Those that understand the world best can create tools that save them time, tweak existing solutions to fit their needs, and make their lives much simpler.

Many people think programming is sitting all day at a computer, frantically typing. That is not completely true. In my experience, 90% of the time I spend wandering around, thinking about a problem, dreaming of solutions. Once inspiration hits, I sit down and write it all out. A lot of your time will be spent on debugging and catching quirky edge cases, but at the end of the day you will have created something unique in this world.

How do I start?

The best way to start coding is by completing a project. Reading a dry textbook is atrociously boring, and will kill any interest you have very fast. Pick a small, simple project, and try to finish it. You can make a simple site, a command line calculator, or even a script to scrape a website and extract data. Find something that annoys you, and figure out how to automate it. Alternatively, find something that you love and make it better! Having a concrete goal will give you the motivation you need.

Web development

There are several approaches you can take. If you are a more visual person, I suggest you start out with web design. There are countless tutorials online, and all you need to start is a proper text editor and a browser. Keep in mind that with this approach, you will be mostly doing UI (User Interface) work, rather than creating programs and scripts. Here are some links to get you started:

Python

If you prefer to create nifty tools that will save you time and help other people, you will need to learn a programming language. For a beginner, I suggest starting out with Python, because it's closest to a regular human language. Here are some links to get you started:

What programming languages exist, and how do they differ?

There are several categories of programming languages, all suited for their own unique purposes.

The most common languages you've probably heard about are C, Java, Python, and HTML/CSS.

  • c, c++, c#, and objective c are used in environments where speed is important, and you need access to low level hardware. These languages give you more power, but they are harder to write in and harder to debug. I don't recommend starting out with c.
  • Java is used in many corporate environments, and various cross platform applications. It's very portable, meaning you can write one program and have it run on Linux, OSX, and Windows with no major changes. It's a good way to learn Object Oriented programming , and there are many tutorials and books for it.
  • Python is a relatively new language, well liked by many people. You can write very small and simple programs in very little code, yet have them be very powerful. It's reasonably fast, and easy to learn.
  • HTML, CSS, and Javascript are used to create websites. You can see this code for yourself by right clicking on this page and selecting "inspect element". HTML is the skeleton of the page, defining different elements of the page, using <tag> elements. CSS is then used to style these elements, specifying the dimensions, font size, etc. Javascript is used to bring the pages to life, adding interactivity, responsiveness, and other convenience methods.

Coding ideology

Computers are dumb

The first fundamental concept you need to understand is that computers are incredibly efficient, obedient machines with no common sense. They do EXACTLY what they are told, and never make mistakes (barring extraneous circumstances). What this means is that if your program is not working, it's your fault. Either you have a bug, or you misconfigured something, or there's something else you forgot to do.

Let me illustrate this with an example. Suppose you are sitting at a dinner table, and you want some tea. If you have a human around, you can say "Please bring me some tea", and soon enough you will have it. If you were to ask a computer to do the same thing, it would have no idea what you mean.

You could try breaking it down into steps:

  1. Go to the kitchen
  2. Boil some water
  3. Pour me a cup
  4. Put the tea bag in
  5. Bring the cup to me

Seems reasonable, right? Well, remember that computers are dumb. They have no idea how to do anything unless explicitly told. It might be able to roll over to the kitchen, but it would have no idea how to boil water. It might try pouring water on the stove, or boiling it in a plastic cup. In short, you would have to define every single action exactly in order for the computer to succeed in accomplishing this task.

This is what most programming is like. You look at a problem, break it down into steps, break those steps down into more basic steps, until you have something that the computer can actually execute.

Share and help others

The coding community is the most incredibly sharing and supportive community I have ever seen. If you ever run into a problem, you can go online and odds are someone already solved it, and wrote a detailed blog post on how to do it. There are also sites where you can submit questions, and kind strangers from all over the world will help you diagnose your problem. As long as you are polite and know how to search before you ask, people will always reach out and help.

I ask that you continue this tradition. As you learn more and more about computers and coding, take the time to reach out and help your peers, and the people less experienced than you. We are creating this brand new field, together.

What tools do I need to start coding?

Text Editor

The most important tool of any coder is a proper text editor. You want it to have the following features:

  • Line numbers (for debugging)
  • Syntax highlighting (for easy overviews)
  • bracket matching (for convenience)
  • auto indentation (to keep your code clean)
  • Tabbed file explorer (so you can switch between files easily)

For windows, I suggest Notepad++ (free) or probably even better is Sublime text
For linux, try gedit or Sublime text.
For OSX, either TextMate or XCode.

IDE (integrated development environment)

Once you start developing more complex projects, you may want an IDE. I only use one for Android dev, so I don't have too many recommendations. Eclipse is a nice cross platform tool, and on OSX I heard XCode is good.

Browser

If you are doing web dev, install a modern browser. I use Chrome, Firefox is okay too.

Tips and Advice

  • Don't give up easily. Writing a program is only the first 20% of the work. Now you have to debug and make sure it works properly. It will be worth it!
  • Learn how to be a Google poweruser
  • Search for your question before asking. Someone probably already solved it.
  • Have a concrete goal, and strive for it. Reading dry textbooks is boring if you have no application for it.