UXDE dot Net Wordpress Themes

Learn a new programming language in a couple of weeks

I joined the Lab six months ago as a junior developer for my university ‘year in industry’ placement. One of the first things I was expected to learn was the Ruby language along with the Rails framework. Although I did have a little Python knowledge, I had never touched Ruby, or web frameworks, so I was starting from scratch in many ways. All the same, I managed to learn it in two weeks. Not to the point of “coding master”, but to where I was comfortably and independently writing code in Ruby and was happy to take on any challenges the team threw at me.

I wrote this guide based on how I did it. It is aimed at complete beginners and does not assume that you have any previous programming knowledge.

Remember to thank all the books you haven't read - image courtesy of osiatynska Where to start

First off, find a tutorial, but choose carefully. There are several around that assume a certain level of knowledge, but terms like ‘how to create an array’ and ‘how to define a function’ mean nothing when you’re starting out and can put you off because they make things sound so daunting. Ideally, you want to find something that teaches you how to build an actual program, step-by-step, from scratch. Usually these come in the shape of books (or e-books) for the programming language in question.

Don’t be put off by how big the books are and how long you think they will take to read.

You are not going to read the entire book.

In all honesty, you will probably only need the first few chapters. I appreciate that once you’ve paid for the book, you want to get your money’s worth, so if you want to read the entire thing, then that is up to you but it’s not hugely important whether you do or don’t. I’ve seen people read a book tutorial, follow it step by step to make a nice looking application, but then have no idea of how to make another application with no instructions. They haven’t learned the language. They’ve just followed instructions, that’s not the same thing.

Sheep - image courtesy of amcunningham72The difference between following and learning

So you start reading your book, following the instructions step-by-step. You get a couple of chapters in, to a point where you have made something, no matter how small and unfinished. You feel pretty good about how your program is turning out, but you know that if someone took the book away and asked you to create it again, you probably couldn’t. The book gave you instructions, which you followed but a lot of it won’t have sunk in. It’s ok, this is perfectly normal. You probably couldn’t read the first few pages of The Lord of The Rings for the first time and then recite them back word for word. (If you can, I apologise and that is one awesome memory you have there!).

Are you telling me to memorise a book?

Far from it! This is where you stop reading your book. Take a look at what you’ve built and give yourself a goal based on what you have done so far. By this I mean, aim to make something you don’t have the instructions for.

You don’t need to have the language memorised yet, and you might not feel very confident but by looking at what you have built so far you know what sort of things are possible. So use your imagination, what else could be made with the same techniques that built the program from the book?

Here’s an example: say you have learned how to allow a user to input a number and when the user presses enter, the program returns a list of numbers from 1 to whatever the user entered. So now, you could try to return the same list, but have them multiplied by two. Using the book as a reference and with help from Google, you should be able to work out how to make it do just that. Then go a step further. Give yourself another goal. You could make your program return the numbers in reverse order. You get the idea.

The trick is to keep going, keep pushing your knowledge further and giving yourself incremental targets. Keep your targets simple – small improvements to or alternative versions of what you already have. It’s really important to write comments inside your code while you’re going along. Writing comments makes you think about how the code is working, which is a great way of getting it to stick in your head. It’s also good practice, so your future self can look back and understand what each piece of code does.

Wake Up! - image courtesy of thebadgerridesBreak the shackles

From there, it’s just a case of repeating this process with each new technique or process you learn. Keep making your own versions and iterations of whatever your book tells you to do. By the time you’re a quarter of the way through, you’ll find that you’re much more confident and independent, to the point where you don’t even need the book anymore. Sure, you won’t have mastered the language by this point, but you will have a good understanding of how the logic works and what is possible, so you’re no longer totally reliant on instructions.

Keep all the code you write, you will have lots of little snippets by this point and you can use them as references instead of the book (another reason why commenting as you go is so important). If you get stuck (and I appreciate this may be stating the obvious) – ask for help. Use Google as often as you need to – it is almost certain that someone, somewhere in the world has asked the same question as you and as a result, the answer will have probably been posted. If not, you can ask it yourself on an appropriate forum.

What now?

From there it’s just a case of giving yourself bigger targets. Create a message board or a blog. Write a program that reads English text and translates it into French. It’s all about using your imagination and staying positive. You don’t know how to do this stuff yet but that’s the point. You’ll find new uses for the code you have already written, plus the advice you’ve picked up as you go and hopefully you’ll start to have fun in the process.

In Summary

In my opinion the aim is to break away from your reliance on a tutorial and become independent as soon as you can. Step-by-step intstructions are long and boring and can quickly put you off ever wanting to learn the language at all. Instead, use them as a push to get you started, read to a point where you have a basic understanding of the language and then go away and build your own small, simple apps without following a guide.

Making your own stuff, no matter how insignificant, is so much more fun, and doing something fun is a much easier way to get the subject to stick in your head.


Comments are closed.