How did you learn {programming language}? I’ve been asked this question many times and, to be honest, never knew how to properly answer. I’ve always tried to reminisce back to the point when I first started working with it, but that point has always been vague and blurry.
I remember the point when it was necessary to learn a new language, and after that comes the point when I’m already using it at a more-than-a-beginner level. However, I vaguely remember the process of learning it.
You need a process
When Tomislav, Matej, Nikola and I first started doing some serious work at Infinum, we were our own project managers, software architects and developers. We helped each other with knowledge and advice, and whenever it was necessary to learn something new – we just did it.
Now that Infinum is a 40+ people company with an expanding web development team I’m in charge of, the situation is not that simple. To stay efficient, we need to coach people by channeling their learning with a specific goal in mind and specific technology. This time around, the technology in question is Ruby on Rails.
Ruby on Rails is an amazing web application framework, simple enough for anyone to start using it and robust enough to overcome even the biggest obstacles. Being a Rails Girls mentor helped me see it from a non-programmer perspective and realize what are the three key challenges in learning Rails:
- Understanding Ruby – as much as Ruby is a fantastic language itself, Rails adds another layer of complexity. It can be tough for a beginner to tell the language and the framework apart.
- Understanding the MVC pattern – it might seem obvious which code goes where to an experienced programmer, but a beginner could end up with fat (or better say, obese) controllers or overly complex views.
- Understanding the object-oriented model – to use Ruby in a smart way with Rails, you need to understand the OO model properly.
So, how to start learning Ruby?
If you know how to write a simple sentence in English, it will probably be fairly easy for you to write your first couple of lines of Ruby code. Being a dynamic and object-oriented language, Ruby brings a lot of syntax sugar that really makes you think you’re reading a sentence. Of course, eating too much sugar can be dangerous. The same goes for not understanding what you’re doing in Ruby.
- For a total beginner, a good first step is trying Ruby inside a browser – for example Codecademy or TryRuby.org
- Have you fallen in love with Ruby already? That’s great. The next step is installing Ruby on your machine so you can use it locally. Try RubyInstaller (if you’re using Windows) or go ahead with a Ruby version manager like rbenv and ruby-build (if you’re on a Mac or Linux).
- Online tutorials are great, but reading a book about the chosen subject is much better. One of the best books about Ruby is strangely called Programming Ruby. Go read it!
- Screencasts are popular both in Ruby and Rails communities, and you can find great screencasts on Ruby Tapas.
- While Test Driven Development isn’t really a part of learning a programming language, it goes hand in hand with Ruby and Rails. There is an excellent course that will teach you TDD while introducing Ruby to you. Visit rubykoans.com and give it a go!
OK, now you’ve mastered Ruby. What about Rails?
- Your first stop should be the Rails Guides. Here you can find everything about Rails and also a tutorial for adding Rails to your existing Ruby installation.
- There’s no way around books if you want to become a good developer. I would recommend reading Agile Web Development With Rails from the creator of Rails, David Heinemeier Hansson.
- Try to familiarize yourself with Git and GitHub as it will help you deploy your applications, track changes you’ve made and allow others to collaborate. The entire Ruby on Rails community revolves around GitHub, so familiarity here will be useful.
- You’ll want to try out your creations and deploy them to a real server. I suggest going with Heroku, a cloud Platform as a Service provider that’s super easy to use.
- There are a lot of excellent screencasts available on RailsCasts. Also, Richard Schneeman, one of the Rails contributors, has great materials from a course he gave at the University of Texas.
Last but not least, if you are feeling especially eager, I would suggest you try and read the Rails source code. You’ll learn a great deal about the underlying architecture, but also new and interesting ways to solve problems in Ruby. Start by going through the documentation and then explore it further.
This is how we (try to) do it
Since every man for himself isn’t really the best option for an organized development team, having a standard learning process in place is useful. We have several ways to teach and learn Rails (and other programming languages):
- Mentoring – we assign mentors to new developers. The mentor guides a developer on a starter project, teaching them all the essential parts of the architecture. In the next phase, the developer starts working on a real-life project.
- Code review – a great way to share knowledge, where people comment on other people’s code; pull requests are an excellent feature that help experienced developers share their knowledge with juniors and, at the same time, make sure that the production code remains high quality. The only downside is that a junior is “blocked” (can’t continue working on a feature) until someone finishes reviewing the code.
- Pair programming – Even the best developer finds another pair of eyes checking their code useful; when two people work together on a feature, this helps them both improve their skills. The obvious downside is that you’re spending twice the manpower for the same amount of work.
Being practical, we use these methods depending on the needs of a specific situation. We don’t use pull requests, pair programming or mentoring all the time on all our projects… Just when we feel these methods outweigh conventional systems.
And it all comes down to…
Experience is what you get when you didn’t get what you wanted.
In the end, the best way to learn anything is to try it and learn from experience. Having a great community or a team can be of great help, but your personal effort and dedication is what matters most.
Learn the basics and give yourself a goal to finish a small project. If you persist and do it despite the setbacks (and trust me, there will be many), you will be equipped with the knowledge and experience to make something bigger and better. This is precisely how every good developer and, in general, every good professional starts their career.