Home | 2014-12-28 | (c)2014 James Hudson

Picture of happy programmer

Tweet Follow @JamesSHudson RSS Feed

Programming basics for everyone: how to try coding right now, and why you need to.

I have no idea how to speak Russian. However, after a few hours' practice, I taught myself to read the Cyrillic alphabet. That means I can translate some of the old GDR signs around Berlin, read names in reports on the Ukraine conflict, and know which films are playing on Russian video streaming sites. In this case, a small amount of knowledge is way, way more useful than none. Similarly, with only a minimal knowledge of programming, you can do a surprising amount of it yourself.

If you have a wealth-generating idea, it almost definitely involves programming; at the very least, a customised webpage. If you can make a prototype, or tweak a webpage yourself, that eliminates your dependence on a programmer or web developer.

If you feel like a career change, there's a huge demand for software developers. There aren't enough developers out there to do even the simplest work. Incidentally, the purpose of most of that work is to automate your current job out of existence.

Did I mention you can work from anywhere, even from the middle of the forest, on a train, or at the beach, and keep your own schedule?

I know people who literally fall asleep when they start reading about programming, so I'll keep it short. I'm not going to give you too many practical tips: the internet has thousands of brilliant programming courses, created by better teachers than me.

This post is the first step for those who haven't yet learnt anything about the forces which are supercharging our world into the future.

My story


Kids these days have no idea how hard it was, back in the day...

My memories of the 80s: frizzy hair, Guns 'n' Roses tapes that needed pencil rewinding, catching Blue Tongue Lizards in the forest, and scrounging between car seat cushions to buy 1-cent sweets. But most vivid of all: my first computer, an Amiga 500.

I was captivated by this magic box which could create other worlds. I wanted the computer to run the games that I dreamed up with my friends, help me do my homework, explore maths and fractals, and to teach me Morse Code to cheat in tests. I made my first money from software when I was 10; I created an arcade game for the school fete and charged 5c per game, and made about $60 for the school.

There was no internet to help me. My only sources of knowledge were the printed manuals that came with the computer, and computer clubs. My dad would drive me to a dusty club room in the nearest town, where bearded middle-aged men would swap floppy disks of software and tutorials.

My imagination quickly outpaced the weak computers and limited information sources of the time. Their languages were complicated, unintuitive, restrictive, and unforgiving.

The barriers to entry are so much lower today. You can start creating software right now, even if you are reading this on a phone.

How do I make sense of this computer gibberish?

When many of my friends watch me programming, they just see a screen full of symbols and strange half-English words. How does that end up being a game, an app, or a website?

Programs are just text files filled with instructions. The computer reads human-understandable instructions from top to bottom of the file, and occasionally the instructions ask the computer a question. Depending on whether the answer is true or not, it will jump to a different set of instructions. These questions and instructions could be anything:

For a real-life example, browse to your favourite website. Click the "show source" button on your web browser's menu. You will see the instructions which generate what you see as a webpage. The code is jumbled up with all the text and content of the page, and is usually not easy to read, but you will be able to read some of what it does in "plain English" if you scan from top to bottom.

Here's a small random snippet of code from the pong-style bouncy-ball game I will show you later:

if (ballY < 0){ ballVelY = ballVelY * -1; }

That just means "if the ball's y position on the webpage is less than zero (ie, the ball is off the top of the screen), then make the y component of the ball's velocity equal to itself times by -1 (make the ball reverse direction vertically)". In other words: if the ball hits the top of the screen, make it bounce.

Where to start

You have all the tools you need for programming already installed on your computer: a web browser and a text editor.

If you are programming for a web browser, your program will be a webpage. You will be using three separate languages: HTML, CSS, and JavaScript.

A basic HTML webpage is nothing but a file containing text. If you type "hello world" into an empty text file, call it "hello.html", and then click on it, it will load a webpage with the words "hello world".

A CSS file lets us change the appearance of this text. CSS files only contain cosmetic details - we can ignore them for now.

To make the webpage do something more than just sit there passively like some schoolkid's webpage from the 90s, you can add a JavaScript program to it.

How hard is JavaScript?

I started teaching a few mostly non-coders some JavaScript the other week. Here's what we made in 90 minutes (with some later design polish in the CSS file by Jessica, one of the participants):

Studying vs doing

I went to university to learn to paint better, and my style actually deteriorated. I learnt much more off the practising artist teaching at my high school. My auntie paints beautifully, and she learnt that at a vocational college.

Don't waste time on formal study. Life is too short; start building things now! This is the best way to begin any trade: just start doing it.

Associate with master craftspeople. Anyone at the top of their game will have a burning need to share their passion with enthusiastic proteges and like-minded souls.

Although I've been programming for about as long as I've been reading, I have actually done little to no useful formal "study" of software development in my life. I just worked on interesting stuff, then did internet research on whatever I needed to finish the job, or lifted my game on successive projects to avoid earlier mistakes, or to match the skills of the more experienced people around me.

Once you get a passion for doing increasingly more interesting and complex work, you will naturally become a master craftsperson with a deep knowledge of your craft.

"Cheating"

The dirty secret of programming is that everyone googles for solutions, then copy/pastes. I've even met a few "professional" programmers with well-paid jobs, who barely have a clue what they are doing. They blindly copy/paste other people's code (for example, from stackoverflow.com), then jiggle things aimlessly until it sort-of works.

Use all the resources, libraries, and existing code you can to get the job done quickly. Just obey the licenses and give credit for the code you use.

Why not give back to the community by releasing your code and bug fixes as open source, whenever it makes sense?

This is fun! How do I turn this into a dream career?


Writin' the code, livin' the life.

A friend recently asked how he could get a similar freelance coding career to the guy in this photo. This is my advice.

Keep your day job, or do something to pay the bills, but throw out your TV and use that free time to program instead. Browse coding websites instead of Facebook. Finish many small projects, AND RELEASE THEM RIGHT AWAY! Don't have one unfinished magnum opus that nobody will ever see - build a public portfolio of many small things, or all your work is wasted.

When you have enough portfolio pieces to interest potential customers (or employers if you just want a software development day job), start doing sales, and gradually phase out your day job as you win contracts. Offer to build simple things cheap. As you gain more experience and have too much work, put your rates up. Time-waster customers will drop away, but your income will be the same. Use some of that new-found spare time for further study so you can work yet more efficiently and put your rates up again.

If you are lucky, one of your "portfolio pieces" might turn out to generate real income, or even go viral. I could link to one of my own modestly successful projects here, but instead I'm going to send you to the GIF dance party!

I finished the first version of this simple iPhone app the same day I started learning iPhone programming, and put it in the store immediately. This meant that within a week, I already had a public iPhone reference piece, could call myself an iPhone developer, and was ready to look for (simple) paid work in that field.

Parting words

Professional programming isn't for everyone, but you will be empowered by even a basic understanding of the principles. It's like owning a car: if you know some basics about how to change the oil, air filter, and wiper fluid, then you will be much less dependent on expensive mechanics. So google "JavaScript programming", and let your imagination run riot!

James Hudson

Please write to me! If you are in Berlin, you can join the mailing list for our coding workshops, where we give free coding lessons in the relaxed, drop-in style of a gym or dance class. Or at least "like" or "share" this post so your friends can be inspired to try programming. The great "freelancing" photo was taken by Daniel Halldorsson.

Tweet Follow @JamesSHudson RSS Feed

OTHER POSTS:

It's Monday morning, but I don't have to go to work. Ever again.
Become a Part-Time Superhuman: Work a 4-Hour-Day
Adequate is better than more: your life as the perfect kitchen
This is the Sales Manual you should have been given at graduation
I'll build your app to help you become independent. For free.
Why there is no Facebook killer: the death of the P2P dream
How to become a freelancer in Berlin: the tricks and the traps
How to write a proposal they can't refuse
Programming basics for everyone: how to try coding right now, and why you need to.
Poledancing versus programming: break away from your business and run it remotely.

Disclaimer

Needless to say, this blog isn't financial or legal advice, an excuse for getting fired, or promising that any of these ideas will work for you. The companies or people I mention may not agree with my opinions here. Don't do anything reckless, damaging or hurtful to anyone! In the future you might need your bridges unburnt. (c)2014-2015 James Hudson