I’m sometimes asked how someone should learn to code. This is my attempt at an answer.
So you want to build a site and can’t afford to contract it out? Maybe you’re looking for a career change. Perhaps you’re just interested, and curious about how things like Facebook are built. Learning to program is fun and rewarding (both intellectually and financially).
The development industry (and we wouldn’t really call it that) is incredibly open, mostly welcoming, but also fast-moving and that can be scary. People like shiny new things, and we often talk mostly about the new things while we actually do most of our work with the old tools.
For a beginner it can be difficult to know what to start with. Is it apps? Is it websites? Is it learning your way around the command line? There are literally hundreds of options out there. Accept that as a reality - you’re not going to understand or even know them all.
This continues to be a problem all the way up the skill-chain. First you’ll worry about which program to write code with. Then you’ll face choosing a programming language to write your software. As you get more skilled you’ll look at libraries of complex code that other people have written and have to decide which one to use in your project. Then you’ll have the choice of writing your own complex code or using someone elses. And finally you’ll decide that your problem is so unique that you need to write your own programming language…
You’ll never know where to start. Ever. So just get used to diving in. If it turns out you’ve dived into a tank of liquid shit, and not a five-star heated pool, then just climb out and take another dive.
The terms programmer and developer mean the same thing. If there is a difference, it’s probably that a developer looks at a bigger picture than a programmer. A developer probably has more involvement in architecture, ideas, design, user interface and even the business side. A programmer is likely more focused on writing code. But as I say, people just choose the terms they personally like to use.
And us programmers all use different terms for what we build, but at its core we are creating software : websites, apps, games, programs that make lights flash on a Raspberry Pi - it’s all software. So when I talk about software don’t think it’s irrelevant for someone who wants to design websites. It’s not. It’s all the same stuff.
Designers vs Developers
There is definitely a difference between designers and developers. Designers are concerned with how things work, how users interact with them, and how they look. Some designers write code. Some just create pictures or animations of how things should look. Many people wear both hats - but they’ll definitely lean more to one side than the other. It’s very rare to find a developer with excellent design skills.
One area of confusion is the difference (or lack of it) between web design and web development. For me, a web designer probably works mainly with sites that don’t have much depth. They’ll build a great looking site for your local bar, or design a theme for a blog. A web developer probably builds more complex sites - an online shop, or Facebook. These aren’t rigid rules. I’d call myself a developer.
I taught myself programming as I went along - mainly because I had ideas for sites but no money to pay anyone else to make them. I thought being self-taught was unusual - and I was always conscious that my solutions were often quite scrappy (some might say precarious).
But developers are actually quite unusual among the professions. My feeling is that about half of us are largely self-taught, and the other half have studied computer science.
In my experience someone’s educational background makes no difference to their perceived skill level or value. Passion, curiosity, and intelligence - if you had it when you were a toddler then you’ve got it now.
So if you’re coming late to the party - Don’t worry! You definitely don’t need to go back to college and study computer science to get started. Dive in and start learning to write code! Sometimes I think I’ll go back and fill in the gaps in my computer science knowledge - but if I do it will be because I want to, and not because I need to.
How to start
Get a Mac
Now this is controversial but I don’t care. If you can afford it, I absolutely recommend that you buy a Mac and leave windows behind (at least while you get started). Here’s why:
Most programming tools are built around an operating system called Linux (based on an older one called Unix). Macs are also based around Linux. Windows is completely different. When you read the documentation for the tools you’re using, you’ll find that the authors will generally assume you’re on a Linux-like system. Sometimes there will be instructions for windows, but often there won’t - or they’ll be out of date.
As a beginner you’re going to get stuck, and error messages are going to rain down on you. You’re going to Google these errors and you’ll find more matches for Mac-type errors. And more importantly, the solutions to these problems will be better and more up-to-date.
If you’re interesting in making iPhone or iPad apps then you can only do this on a Mac.
If you’re building websites then your Mac is very similar to what you’ll use on a web server when you come to publish your site.
If you’re stuck on a Windows PC then install a different operating system called Ubuntu. You can use both at the same time. Ubuntu is a flavor of linux and you’ll have almost the same experience as Mac developers (in fact learning Ubuntu is very helpful anyway). Don’t even try to learn to program in Windows.
Your initial _stack_
A stack is what we call the collection of programming languages, tools and frameworks that we use. The term stack makes sense because these tools tend to be built on top of one another.
You’re lucky. In 2016 it looks like learning one stack is going to enable you to build pretty much anything for the next few years. That stack is:
These three technologies are primarily for websites but increasingly you can use them to write all other types of software (apps, programs, games).
When you’ve done HTML, you’ll notice it looks very bland. CSS is the language that describes how HTML should look. What color things should be, what size etc. Just get familiar with the basics of CSS - you’ll get the rest as you go along.
How to learn
Use a text editor
Do not use an IDE. Uninstall Dreamweaver right fucking now. Code is text, learn to write text. Do you think JK Rowling writes Harry Potter using predictive text? Fuck no. So don’t even think about using an IDE.
Get a text editor - Atom, Sublime text, Notepad++, Textmate. Take your pick.
A note on editor wars: You’ll find people talk about two text editors for programming: VIM and emacs. These are old-skool editors that are very powerful. Users love them and there’s an almost religious fanaticism for one or the other. But these editors are way too complex for beginners - don’t waste your time. By all means come to them later and see if they work for you.
Read, type, repeat
The best way to learn is to type out example code. I learned programming by typing out line after line of BASIC code from printed magazines into a BBC Microcomputer in 1995. Copy and paste literally wasn’t an option then.
You need to actually type the code out. Don’t paste it. It will improve your typing and get you used to looking at code. You’ll make typing mistakes - and that’s great! You’ll have to find these mistakes and fix them (using the error messages you get.) And guess what? You’ll make these typing mistakes for the rest of your programming life so the sooner you learn to fix them, the better.
If you’re reading tutorials, open the window next to your editor and type. If you’re watching videos then pause the video and type what the presenter types.
I can’t emphasise this enough - do not copy and paste.
When you’ve followed an example, and it’s working, then get curious. Change the colors, change the messages. Fiddle around. If you break it, try to figure out why.
Where to learn
There are a huge number of completely free resources out there for beginners. Everyone learns differently. Some people want videos, others want websites with written tutorials, others want a paper book.
Sometimes you’ll try a course, get nowhere, and then come back to it in a few months and it all clicks together.
What I suggest is just googling around and finding things that look interesting to you and trying them. If it’s not making sense then move onto something else. That said, here are a few resources that are widely recognised as good places to start:
Some useful tools
If programming is for you then you’ll know it fairly quickly. You should enjoy it and get satisfaction from solving problems and a buzz when things ‘click’. It might not be for you - and that’s ok.
But if it is, and you love it, then you’re in for a treat. I don’t think there’s another career which offers the flexibility and rewards of development. You can work in a huge glass building for Google, a windowless basement for some publishing house, at home (for yourself, for random clients, for a long-term client, or for an employer). You can travel, freelance. Go to conferences and meet loads of other developers - or never meet another developer in your life. Hang out on forums. Build your business, help other people to build theirs. Make games with your kids. Program robots.
I was going to write this in a Facebook message to a friend of a friend but I thought I’d just post it here. It’s a stream of consciousness.