Thumb lukasz How to learn to code in 5 steps

By:, On:

Many people ask me what is the best way to learn to code. After all, I have taught myself to code from scratch and later I found myself confident enough to teach others.

At least in my case, I found there was about 5 steps I went through:

  1. Find something you really want to build
  2. Learn HTML and CSS
  3. Try a framework
  4. Build your thing
  5. Build your thing again

Alright, let's look at each one of those one by one.

1. Find Something you REALLY want to build

This is probably the most important step. If you just want to learn the syntax, commands and other "programming" stuff without getting something off the ground, you will most likely lose interest really, really fast.

Never has coding been so accessible and easy to learn. There are a lot of great languages, frameworks, tools, tutorials and people willing to share their knowledge. But the thing is, coding is still a pretty damn hard thing to master. It is too easy to go to, get excited and then get stuck once you want to build something bigger than 10 lines of HTML. If you have nothing that will make you persevere, learning to code will be harder and less fun than it could be.

Look around, what do you really care about? Don't think too much about the details of the thing you want to build. I guarantee that thing will evolve during the process. It doesn't mean that you'll change your mind. As you learn building, you will start to understand more about the nature of the thing that you're building. You will see the details most people miss, you will see ways you can make it better than anything you have seen before. It is really a lot of fun. As long, of course, as you care about the thing you're building.

So what is it?

  • Blog?
  • Expense tracking?
  • Social Network?
  • Project management tool for your company?
  • Automatic reporting system?
  • CRM?
  • Some crazy idea no one has ever thought about?

2. Learn HTML and CSS

HTML and CSS are the languages of the internet. Regardless of what you would like to do in the future, HTML and CSS can't be avoided. They are everywhere. Every website on the internet is built using HTML and CSS. Millions of iPhone and Andriod applications are also in fact built using HTML and CSS thanks to platforms like PhoneGap.

Yeah, HTML and CSS are all over the place. But do you know what's the best thing about HTML? It's actually super easy to learn. That makes it at perfect starting point for your coding adventure.

Great places where you can learn HTML:

3. Try a framework

Now, this is where it gets interesting. A framework is a set of tools that will help you build your app faster. Frameworks are basically placeholder programs written in a certain computer language. Some of them are very simple, some very advanced. Some give you flexibility, some make you write code in a very particular way.

Why jump straight into learning to build apps with a framework rather than learn syntax first? Well, let me ask you this: Imagine you have a chance to learn Chinese in school for 5 years in your home country (given, that you're not Chinese) -- OR -- you go for 1 year to China to study. Which approach, you think, will be more effective? The deal with frameworks is similar.

Instead of trying to build pointless loops or craft perfect class methods simply make it work with the least amount of effort, instead, break it, fix it and see it work.

The question therefore is: Which framework should I choose?

I'm biased, very biased. For me, the current answer will be Ruby on Rails. That doesn't mean I won't change my mind in the future. There are great frameworks out there, but Rails has proven itself as an excellent, reliable framework and it's easy to learn. In fact, there are new frameworks written in languages other than Ruby (Laravel build in PHP) that mimic Rails.

Some reasons to consider Rails as your framework:

  • Easy to learn
  • Ruby code is easy to read
  • Requires minimal setup
  • Secure out of the box
  • Great and helpful community
  • Great learning resources online
  • Language of choice for Silicon Valley internet startups

Some of the reasons not go go with Rails:

  • All you want to do is Android applications

Again, I'm biased. I have managed to teach myself to code after many trials and trying several languages and frameworks. Ruby On Rails turned out to be by far the easiest to learn for me.

4. Build your thing

Just go for it. After you learn the basics, maybe you go through the tutorial once and you start to feel comfortable - try building your own thing. Don't wait until you have 2 years of experience. Two weeks is, in most cases, enough. I guarantee you will have a lot more fun hacking your own thing rather than doing tutorials on BTW - you can find tutorials on this very website.

5. Build your thing again

Now, this is an important and probably underestimated bit. First iteration of your thing will be ... most likely, not exactly what you imagined. Perhaps you hit the wall and simply won't be able to move ahead. This is ok. In fact, this is absolutely normal. Take a deep breath, count to 10 and start over. Same tutorials, same idea. You would be amazed how much simpler everything will be the second time.

Most of all - keep pounding and ask for help if you're stuck. There are thousands of people that can and will help you.

If you login you will be able to rate this post


  • On: Teresa He wrote:

    very interesting

  • On: Dale Lotts wrote:

    I've been working full time in Puppet and Ruby for the past few months - coming from the Java / JavaScript world it's been a challenging transition for me. Ruby and Puppet (and RSpec and Rspec-Puppet, and...and...and...) present some interesting challenges.

    I liken this to skiing vs snowboarding. Snowboarding makes sense to me and can't imagine why anyone would want to ski. When I started dating my girlfriend I said "You need to learn how to snowboard"... she gave it great effort, but after several lessons with no success she was quite frustrated and ready to quit. Finally, I suggested she try skiing - in one lesson she loved it and was getting down the hill in no time.

    The point is, there are different programming languages for a reason - people have different preferences. If your frustrated and not making progress in one language, don't give up, try another language - try several - eventually you will find one that makes sense to you. =)

  • On: chauchongsing wrote:

    Hi Lukasz Muzyka I like this article because I feel frustrated after 3 weeks for learning Rails. I am living in China so that there is no good book or website about Rails_learning. All books about Rails in China are obsolete and very boring. You said the first step of learning program is find something you really want to build. I can not agree with you more. I am not going to be a very professional programmer. I just want to build an app which can help me to do a better job. That's something like CRM but not CRM. I heard that Rails is the best framework to build web app. But soon I found that's not easy to learn. All references I could found almost are building a blog or forum. So I am expecting for your paths about simple CRM. =)

  • On: Bhushan wrote:

    Thanks Luckasz.. Very inspirational bolg. I have never done coding as i am working as a DBA. But after going through your tutorial, i have realized the magic of Ruby. It is amazing. I will take this as an inspiration and move forward as a developer. Thanks much !!


You can login to comment