My First 12 hours with Ruby
Tags: ruby, opinion, programming
Published: 2018-12-13 00:02:01

---
title: My First 12 hours with Ruby
published: true
description: My personal opinions about Ruby after the first 12 hours.
tags: #ruby, #opinion, #programming
cover_image: https://blog.davidjeddy.com/wp-content/uploads/2018/12/ruby.jpg
---

Cross posted from [my blog](https://blog.davidjeddy.com/?p=1248&preview_id=1248).

<!-- wp:heading -->
<h2>Background</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>For the last 10 years or so I have been squarely a PHP developer. From version PHP 4 around 2000 up to and including the current version 7 in 2018. From scripting, to OOP, to the modern language ecosystem it is today. This year I wanted to learn a new language, to add a different perspective on problem solving. I tried out Golang for a couple months as the concurrency and channels model is super interesting and it is a very low level language (all of which PHP is not). However, recently I was approached with a project that is currently written in Ruby (on Rails). I have wanted to learn Ruby for awhile so this provided an excellent opportunity to give Ruby/Rails a spin. After a week of spare time tutorials and reading here is <strong>my opinion</strong> about Ruby after the first 12 hours.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Good</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>General Community</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I've been around the internet a bit. ICQ, AIM, Usenets, direct dial BBSs, Stack Overflow, Dev.to, Regional Conferences, on and on. I have never, in my experience, witnessed a community so open, friendly, and helpful as the Ruby group. If I had to pick a language to learn based on how friendly and curitouse the members are to each other; Ruby would win hands down. Not to say the community is perfect, just the nicest in general.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Language Syntax</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You know, I like the short syntax. It is a dot based syntax (like JS for example), paren's are optional, and the data types ad nearly self defining.</p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre class="wp-block-preformatted">[0 =&gt; 'value'] #array<br>{'key' =&gt; 'value'} #hash<br>1+2=3 # int + int = int<br>1.2 + 2.3 = 3.3 # dec + dec = dec<br>self.validate data #object.method parameter_date</pre>
<!-- /wp:preformatted -->

<!-- wp:paragraph -->
<p>The optional paren's was confusing at first, but quickly mentally internalized.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Package Management</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>After some digging around I am pleased with the ecosystem around the Ruby language. Dependency management is handled nicely by <a href="http://Bundler">Bundler</a> and the <a href="https://rubygems.org/">Gem</a> system. While I am not a personal fan of the Gemfile syntax (being a DSL) it is very readable and easy to spot errors in. I also like that it handles system level dependencies as well. Need Postgres? Add it. Need a library for geolocation calculations? Add it. Need a SASS process for the frontend asset pipeline? Add it. Even the frameworks Rails and Sinatra are dependencies of your PROJECT, not your project being built from a specific commit of a framework. Sure, there are ways around this but Ruby does it this way by DESIGN.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Oh, and Ruby as a version manager similar to NodeJs. Called RVM (Ruby Version Manager).</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li><a href="https://bundler.io/">https://bundler.io/</a></li><li><a href="https://www.cloudcity.io/blog/2015/07/10/how-bundler-works-a-history-of-ruby-dependency-management/">https://www.cloudcity.io/blog/2015/07/10/how-bundler-works-a-history-of-ruby-dependency-management/</a></li><li><a href="https://rvm.io/">https://rvm.io/</a></li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Bad</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>Modified SemVer</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For the love of everything software use normal SemVer! That means you Rub, Laravel, and anyone else who thinks they are _better_ than nearly 60 years of release management. Stop being a special snowflake.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Automagical Frameworks</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Both Rails and Sinatra are both VERY opinionated about how things should be done. Want to do thing's a bit different? Nope, get lost. The language is very flexible but the top two frameworks are very opinionated. I guess this goes hand-in-hand with convention over configuration. You have to expect things to be a given way in order for convention to work properly.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Ugly</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>Syntax Might be a bit Too short</strong></p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre class="wp-block-preformatted">[A] - [B] = [C]</pre>
<!-- /wp:preformatted -->

<!-- wp:paragraph -->
<p>That is array subtraction in Ruby. If you did not know those are arrays there is minimal chance you would know what is going on. Makes sense for number math, but numbers usually do not have brackets. #confused Some languages have static function for construct manipulation. Not Ruby, nope. "Everything is an object", so everything has innate abilities and functionality. I know, 'cant please everyone everyday'. This is really just a nit-pick more than anything.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Performance</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here is where Ruby falls down. For all the short syntax, everything is an objects, neat-coll-shininess; Ruby 2.6 lags behind PHP 74.3 in all buit the binary Tree test.&nbsp;<a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/yarv-php.html">https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/yarv-php.html</a><br>Say what you will, but in the age of instant information every 10ms counts. In some examples Ruby is ice-age slow. the simple fix to this is caching (Redis/et al.). It adds a layer of complexity to even the most basic app but is generally desired for any scale application anyways.<br></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Closing</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>So far, I am liking it. I could see myself reaching for Ruby (+Rails / Sinatra) for quick web projects for automation scripting as easily as PHP or Golang. 0 (bad) to 10 (good) I give Ruby a 8.5 overall at this time. Will definitely be sticking with it, but has room to grow as well.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>What about you, have you used Ruby for an extensive amount of time? Do you have any feelings or opinions about Ruby? Any resources you found helpful while learning the language? Please share in the comments below.</p>
<!-- /wp:paragraph -->