Sitemap
Martinsoft

Hello! Welcome to the Martinsoft blog! We share tech news, mobile app development stories, and help to make tech less daunting.

Learn a Language: Ruby

6 min readJul 16, 2018

--

Learning to code requires a HUGE investment of time and energy. For newcomers it’s also difficult to know where to start because there are so many languages to choose from. Through my Instagram account I’m often asked:

“Which programming language should I learn?”

I wanted to be able to give a better answer than “it depends”, so with this Learn a Language series, I hope to build a resource that’ll help people decide for themselves which language they should invest their time in learning!

With help from other developers across the tech community, each article will give an overview of a popular programming language, from a developer experienced in that language. We’ll look at what each language is good at, what it’s not so good at, and the tools/resources that can help you get started.

In this article, Glen Codes gives an overview of Ruby!

GlenCodes

How long have you been working with Ruby?

About 5 years roughly.

What made you choose to work with Ruby?

Funny story I actually attended my very first developers meetup ages ago and this guy was doing a talk on APIs and a lot of developers were keenly listening in on his talk because he seemed to know a lot. A lot of other developers looked up to him and as silly as it might sound I was like “Hey I wanna be like that guy, what language does he use?”

At the time I only knew PHP and I soon learned he was primarily a Ruby developer so I figured it would be a great time to start learning a second language. Soon as I realised how succinct and powerful it was and how much you could achieve with so much less lines of code I was hooked.

I also wanted to learn it because I heard great things about the Ruby framework Ruby on Rails and I’ve been an avid fan ever since.

What sort of things is Ruby well-suited for? When should someone consider using Ruby for their project?

  • Ruby was created by Yukihiro Matsumoto, who basically intended the language to help make programmers productive, happy and to enjoy programming and I believe he has achieved this beautifully.
  • You can generally write much less lines of code to achieve the same task compared to other languages.
  • Good if you need something that can scale easily.
  • Excellent if you need to prototype something fast.
  • If you are looking for flexibility.

If you also know other languages, how does Ruby compare to these?

I first learned PHP and while this language was great back in its heyday (90s) it’s still easy to unintentionally write spaghetti code with it.

Get John Martin’s stories in your inbox

Join Medium for free to get updates from this writer.

Ruby was made for simplicity so it’s less prone to that. I find Ruby way more streamlined.

Are there any types of project / task that Ruby would not be a good choice for?

Because Ruby is considered a dynamically typed language, technically it is a smidge slower than some other languages.

What do you particularly like about coding in Ruby?

There is a very popular and beautiful framework built with Ruby called Ruby on Rails. Great documentation, easy to use, heaps of resources and support online.

What are the things that frustrate you when working with Ruby? What possible sources of pain or frustration (if any!) should people be aware of before they start learning Ruby?

Ruby like most languages is good (and also not so good) in describing the errors it throws. It can be cryptic if you are not clued in on what the possible source of the problem is. It won’t know how to explain in exact English where the problem is so you really need to know the nature of the error, e.g. “What do you mean when you say there’s a NoMethodError”.

What dev tools do you use when working with Ruby? What other tools are also popular?

  • VSCode and there’s a plugin just called “Ruby”, I also use another plugin for when I’m working with Ruby on Rails which is just called “Ruby on Rails”.
  • Sequel Pro for visualization of the database for any project I’m working on.
  • Git version control is used a lot in my projects, it’s a must and a time saver if your project goes pear shaped.
  • There are open source libraries called Gems. rubygems.org is a great place for those, I recommend a gem called Pry to get you started, theres also ruby-toolbox.com.
  • Bundler which is a command-line based library (gem) to help with installation and updating.
  • A lot of work also involves the terminal, iTerm is pretty handy which I use on my Mac from time to time.
  • Ruby has its own built-in interactive console called IRB, I use that quite a bit too, helpful for problem solving.
Glen posts super-motivational content on Instagram! Go follow him!

Which resources would you recommend for people looking to learn Ruby?

  • My number one go to is www.tryruby.org — it’s free to use, free to sign up and save your progress, and has an interactive coding component so you learn by doing. It’s very thorough to get you started.
  • “Learn Ruby the Hard Way” (don’t let the title scare you, it’s actually really good, and while you can buy a copy, it’s free to view online).
  • Ruby’s official documentation site as a quick start guide you can check out.
  • Derek has a pretty thorough Ruby tutorial and links to all the code he uses underneath his YouTube tute.
  • Udemy have some great courses on Ruby. I recommend “Comprehensive Ruby Programming” by Jordan Hudgens.
  • Treehouse have some great courses on Ruby too.

If you want to learn the framework Ruby on Rails once you have learnt Ruby

What are the popular libraries or frameworks that people should also consider learning with Ruby, and what do they do?

  • Ruby on Rails is probably THE most popular framework out there.
  • It was built by David Heinemeier Hansson and his team at Basecamp and they later made it open source in July 2004.
  • All kinds of sites have been built with it: blogs, shopping carts, CMS, you name it, it’s pretty much been done.
  • It’s a server-side framework that uses MVC (model, view, controller). It enables you to set up a website pretty fast, uses RESTful routes and has excellent default schemas for any database you are using. Want to code it using SQLite? Or MySQL? Or Postgres or MongoDB, you can!
  • It has plenty of command-line tools to help you get started, including some scaffold commands (which do most of the building for you, handy if you want to reverse engineer how it works), generators and of course plenty of gem libraries by a huge community of developers.
  • It has its own built-in localhost server you can fire up to test your web application.
  • You can even use the Ruby on Rails framework to build just an API rather than a full blown website if you really want.
  • It also has a very robust set of testing tools, or you can use third party libraries like Rspec, FactoryBot, Capybara.

Popular gems (libraries) that I use in my Rails apps include:

  • Devise (log in/sign up system)
  • Better errors (does exactly that, more readable error screens)
  • Pry-byebug (great debugging tool to allow you to implement step-by-step code troubleshooting by setting breakpoints in your code)
  • Omni auth (login library/gem)

Anything else you want to say about Ruby?

Ruby is a beautiful, simple language. A good choice for those new to programing. There’s a huge community for it online, plenty of good solid documentation and oodles of stackoverflow coverage on the topic.

Thank you so much Glen! Where can people find you online?

My blog will be up soon so please bookmark me at glencodes.com and check back soon!

Thank you so much for reading! I hope you found this article useful!

If you know Ruby and have suggestions for other resources that beginners should know about, feel free to leave them in the comments!

Other languages will be coming soon!

You can find me:

Instagram: @martinsoft

Online: https://martinsoft.net

I also co-host @meetupandcode, a regular meet-up in London for devs with any level of experience. Join us!

--

--

John Martin

Written by John Martin

Full-stack developer with a focus on iOS. Founder and freelance dev @martinsoft. Passionate about all things Apple, and using tech to make life better.

Martinsoft

Published in Martinsoft

Hello! Welcome to the Martinsoft blog! We share tech news, mobile app development stories, and help to make tech less daunting.