Karol Galanciak - Ruby on Rails and Ember.js consultant

Embarking on Programming Journey

Recently I’ve been repeatedly asked how to get started with programming, especially Ruby and Rails. To keep things DRY and make sure I always include all great resources for learning, I decided to write this blog post. Most of people who asked me had never programmed before or had done some coding before in other languages, but are not (yet) proficient developers, so if you are a total beginner or just started learning Ruby / Rails and you are not sure what the next step is then you came to the right place.

First Steps

Starting is always the hardest part and to make it smooth you will need the best possible resources for learning. The problem is that there are plenty of tutorials and it may be quite overwhelming and difficult to pick the right one. Of course I don’t know all of them, but based on my exprerience the best Ruby tutorial for learning programming from scratch is Learn Ruby The Hard Way by Zed Shaw, which I used myself some years ago when starting with Ruby. The great thing about it is that it starts slowly and from absolute basics, so it won’t be that overwhelming if that’s going to be your first code ever written. It also teaches how to think, attention to details and after each exercise there are some study drills that will make you reflect on the code and force you to do some further exploration on your own. And it’s simply fun to do.

Before you start: I can imagine many of beginners have Windows as the operating system. Well, Ruby may work on Windows, but more likely something will go wrong and it will take forever to fix it. I would advice to install some Linux distribution first (unless you have Mac, which is perfectly fine) before you start learing Ruby. Ubuntu will probably be the best option. You may want to set up virtual machine with Linux under Windows instead of installing it as an independent operating system, for that purpose you can use VirtualBox or VMware, but the setup itself is beyond the scope of this post.

It would be nice to learn some basic terminal magic as well. I would also recommend one of the Zed Shaw’s courses for that: The Command Line Crash Course. It’s pretty short, but will give you everything you need to start learning Ruby.

Ok, so you have now some coding skills and know Ruby a bit. What to do next? There’s one more great resource for learning Ruby: The Bastards Book of Ruby. It also teaches basic programming (good to revise at this moment anyway), but focuses on real-world use cases. Besides knowing Ruby better, you will also learn some regular expressions, do some web scraping, image manipulation and even learn basics of databases and SQL.

Entering web

At this moment you can go beyond just Ruby. But it’s not the time for Ruby on Rails just yet. You will need to learn some basics of HTML / CSS first. There are plenty of various tutorials, but I tend to recommend this one - it offers pretty much everything you need at the beginning and gives solid foundation to learn more concepts later. You’ll always be able to google any unknown term that appears on the tutorial, it’s written to be beginner-friendly.

Now it’s time to pick up Ruby on Rails. I can definitely recommend Ruby on Rails Tutorial by Michael Hartl - I learnt Rails with this wonderful tutorial myself and I couldn’t be happier with it. The content is always up-to-date, which is really important, especially when you are at the learning phase, shows Rails from broad perspective, teaches basics of Git, deployment, even covers testing and really gets you excited when you see how much you learn in so little time.

After finishing Ruby on Rails Tutorial it would be great time to start working on your own project. The best choice would be something you will enjoy working on and challenging as well. An idea would be to develop e-commerce platform. It may sound really difficult at that moment, but remember that Google is your friend and you can find plenty of answers in RailsCasts.

What to do next

After polishing your own project you should have enough knowledge and skills to start working as a junior developer or ar least take an internship. That’s probably going to be a period of the most intensive learning so far. The good news is that you are going to make a huge progress.

But still, you shouldn’t forget about developing skills on your own. There are many other things you can do to work on your programming skills. An idea would be to start doing some exercises from Project Euler - they all are mathematical exercises, but are quite enjoyable do and require some deep analysis and force you to think really hard, especially the further you go. Another idea is exercism.io - for me it’s #1 place when it comes to learning a new language. The idea is that you get an assignment with explanation what the exercise is about. Along with the assignments come tests. Your task is to write code to make these tests pass, but that’s not enough - your code should be as beautiful and readable as possible. After finishing an exercise and submitting code it can be reviewed by other developers who participate in exercism.io, which is really beneficial for learning - you will discuss your choices and really think about writing code one way and not the other way. Don’t worry though, of course your code will not look that great when starting, but no one will criticize you for that as the community around exercism.io is aware that many developers start journey with new language by solving these exercises and no one ever starts with writing super clean code. You will also learn plenty of new concepts by reading and reviewing other developers’ code when checking how they solved the same problem. I used it myself for several languages and still use when learning a new one. It had a great impact on how I write my Ruby code today.

There are plenty of awesome books you can learn even more from. You should definitely read Practical Object Oriented Design In Ruby by Sandi Metz. It’s an amazing book for learning object-oriented design, which is essential if you want to write maintainable and clean code. It also covers testing to some extent - and the more you learn about testing, the better.

The great thing about Ruby is metaprogramming, which is an extremely powerful weapon when you know how to use it. You can learn it from Metaprogramming Ruby. Some examples may be outdated a bit (there are real-world examples of metaprogramming e.g. from Rails 2.3.x), but the content is great and walks you through some more advanced Ruby concepts.

Another classic one would be Growing Object Oriented Software Guided By Tests. Yeah, I know it’s in Java which is widely hated in Ruby community (for no reasons at all in most cases) so it may be a good idea to get familiar with the syntax first and approach it without any prejudice, but it’s amazing for learning ideas behind Test Driven Development and how the tests can guide your code design. It’s definitely one of the most influential softwarte development book I’ve read.

Learning how to use specific design patterns is quite a valuable skill. But not all them make sense in Ruby. However, Russ Olsen in Design Patterns in Ruby explains the patterns that are especially applicable to Ruby langugage and shows some pretty useful examples. If you’ve never read anything about softwarte design patterns then it’s definitely worth reading.

Beyond Ruby and Rails

In most cases when dealing with databases ActiveRecord will be enough (assuming you are using some SQL database). However, in more complex cases you will be forced to write the statements entirely on your own, which requires some SQL knowledge. You should already know basics from The Bastards Book of Ruby, for learning little more advanced concepts PostgreSQL exercises is a great choice - you have an assignment with an expected result and your job is to write a query that will give the expected answer. Everything can be done in the browser, after each exercise all new concepts are explained in detail and if you get lost, you can always get some hints.

There’s one more I thing I haven’t mentioned yet: JavaScript - the language behind all dynamic interactions in web applications. You may want to focus on being backend-developer exclusively later, but in learning phase you should have a solid foundation in all major technologies related to web-programming. Remember exercism.io mentioned some paragraphs before? That would be good starting point for learning JS. But first you should have a general idea about the language itself, MDN JavaScript Guide is a pretty good resource for that. In most cases you will probably interact more with a jQuery library (which makes all the interactions pretty easy to handle) than the “pure” JS itself (that may sound sound a bit contradictory, but in fact you can write some jQuery code without really knowing JavaScript itself). For learning jQuery the official learning center is a good choice, it gives you everything you will need to get started. In case you don’t know how to do something, Google is your friend.

If you would love to go further with JavaScript, you should definitely read Effective JavaScript - JS is a pretty strange (not to say broken) language at times and it’s good to know all the facts when doing something more advanced than attaching some events to inputs when clicking on it. This book gives great overview how the language works and how to avoid some common pitfalls.

It would also be a good idea to learn a JS framework - jQuery is nice, but when it comes to some bigger applications you may end up with unstructured spaghetti code, which is impossible to maintain. There are many frameworks out there and trying out all of them may take a lot time time. Personally, I can recommend 2 of them: if you want to start from scratch a serious application with some heavy JavaScript then Ember.js is the perfect choice - it almost brings Rails-like experience to JavaScript world. But if you want to stick to jQuery, but have some better structure you may want to check React out. When learning Ember you should get Ember CLI 101, which is the best introduction to Ember I’ve read so far. For React you may start with the official guide.

Wrapping up

Learning programming may be quite overwhelming at the beginning, especially the web programming, which requires to learn plenty of technologies to develop any meaningful application. Hopefully you will find it much easier after reading this post. It is entirely based on my personal experience and worked perfectly for me. Looks like it works pretty nice for other developers (or developers-to-be) to whom I already have recommended some of these resources. Getting through all these books and tutorials should take you at least 1 year, maybe 2 years, and by that time you will be advanced enough to know better yourself how to continue your journey of being programmer :).

Comments