Ruby Is Still a Diamond
Ruby is a great language if you don&#x27;t go hog wild with extreme OO ideas and metaprogramming.  Unfortunately, in my experience, it&#x27;s way more common to go hog wild than to just do things in a straight forward way.<p>Before y&#x27;all throw tomatoes at me, allow me to make things more confusing...<p>The problem with elegance is that it is mostly about being <i>clever</i>, but cleverness is often a tradeoff for being cryptic and hard to follow for those who don&#x27;t have context or understanding.  Because it is an <i>abstraction</i>, elegance in the form of things like metaprogramming and inheritance hierarchies make the underlying ideas <i>more</i> difficult to understand, not less.<p>Many programmers, including myself at one time, confused the idea of making something abstract as making said thing simpler, but more often than not it is the underlying details that are most important to be able to read and understand as a sequence of instructions and you are abstracting at the wrong level.  Languages like Ruby are already so abstract that even just a level of abstraction above what it already provides can make code murky, resulting in lots of &quot;thinginess&quot; but not &quot;this does this, and then this, in order to result in this&quot;.<p>I&#x27;m not singling out Ruby, BTW, but the topic of the article just happens to be especially vulnerable to the issues that caused me to lose interest in it and OOP in general.<p>I won&#x27;t go into inheritance other than that I&#x27;ve realized that it&#x27;s a terrible idea most of the time and that a growing number of programmers agree.  Over the years things like Rails have added concepts that lean more into composition, but <i>every single</i> Rails project I&#x27;ve ever worked on was a mess of countless levels of inheritance that makes it difficult to know where behavior is coming from (which is ironic in a way).<p>This isn&#x27;t necessarily a failure of Ruby but rather its <i>community</i> since countless other languages implement inheritance.  There&#x27;s something about Ruby that encourages overuse of inheritance and so many projects suffer from the pitfalls of it whether the developers are willing to admit it or not.<p>Speaking of the community, I really don&#x27;t understand the amount of effort they go through to avoid documenting anything.  I&#x27;m not talking about the language, frameworks, or libraries, since they generally provide great API documentation, but if you are reading Ruby code you are far less likely to find inline documentation or meaningful readme files than in other languages.  Strangely, after having used the Ruby language for 8+ years, colleagues still discourage me from adding comments here or there to provide context around why something works the way it does.  In contrast, it&#x27;s rare that I&#x27;m ever told <i>not</i> to add inline documentation to JavaScript code by other JavaScript devs.  It <i>does</i> happen, but I&#x27;ve really only had that experience one time in my career.<p>Ruby developers buy this line that &quot;Ruby is so expressive that you don&#x27;t need to write documentation, and the tests will describe anything else.&quot;  That sounds <i>wonderful</i> but, frankly, <i>I&#x27;m not a computer.</i>  I don&#x27;t live and breathe code, and I&#x27;m not interested in modeling MRI in my head so I can interpret Ruby code.  Even if I did, I doubt it could actually communicate contextual ideas in a meaningful way because that&#x27;s not what computer languages are designed for, because computers <i>don&#x27;t understand anything.</i>  When you throw in metaprogramming and other dangerous ideas, the &quot;documentation&quot; you are writing effectively turns into a Choose Your Own Adventure book where every page has a 6 line paragraph that rarely finishes a full thought and makes you jump to random pages in the book.<p>I used to not trust the notion that Ruby is slow, and I still think that perspective is overstated, but not in the way a lot of people think.  The vast majority of Ruby projects I&#x27;ve worked were much slower than they needed to be and, again, it usually came down to the community not being interested in how to write code in a performant way and understand which parts of the interpreter and standard library are faster or slower.  The barrier of entry to Ruby is so low that a big chunk of brand new code is written by <i>junior developers</i>, which is insane but also extremely economical.  My first Ruby job paid me $40k (in SoCal of all places!) and although I did achieve some pretty interesting things, I also wrote a lot of crappy code that the businesses didn&#x27;t care was bad.  And they won&#x27;t ever care until they can&#x27;t hire anyone to fix the mistakes that were also piled on top of my own, in which case it will all be rewritten with PHP and React.  It&#x27;s astounding just how slow a Rails project can get, not just when it serves HTTP requests but in just <i>starting up the server</i>.  JavaScript and Node has its definite faults when it comes to over-reliance on 3rd party packages, but the Ruby world too has a problem with over-reliance on packages; it&#x27;s just fewer people care because Ruby&#x27;s package management has advantages over the wild west of NPM.  It seems that with every `rails-<i>` gem that gets installed, the speed of everything decreases exponentially and no one bothers keeping track of it.  Rather than waste time working towards 100% code-coverage, track </i>performance* and you will save countless dollars in human hours.  Ruby seems like a great way for small companies to whip out something great, but has anyone actually figured out whether less time, money, and energy is expended on Ruby projects than on alternatives?  Ruby sells itself as being good for productivity, but if it&#x27;s more often slower than projects that use other languages and frameworks (which is true in my experience), then it&#x27;s not living up to the promise that people are still buying into.<p>Ruby has an awesome syntax, thus I wish there was a radical shift in Ruby, perhaps a fork, where the great parts of the language that make it especially readable and expressive could be kept while metaprogramming be made highly limited and inheritance impossible.  Basically, it should get rid of the things that drag it down in terms of performance and readability and focus on what other languages managed to do right.<p>EDIT: Other thoughts...<p>Oh, and it should be made possible to declare and import modules without automagically bringing them into the global scope unless you `require` them under your own module scope.  That way programmers can <i>just write functions</i> and not feel the need to add them under a named module or class scope.<p>Speaking of, the distinction of a <i>method</i>, <i>proc</i>, and <i>lambda</i> should go away and just be replaced with functions that have a binding.  They add nothing but confusion, and I doubt most Ruby programmers even know the difference or why it is that they call everything &quot;methods&quot; while other languages have &quot;functions&quot; that can both be methods and assigned to local variables.  And yeah, you can kind of do that with procs, but procs really suck.<p>Implicit returns are also... yeah, kinda not worth it and makes things less clear IMO.  Again, I actually like a lot about Ruby, but I&#x27;ve never gotten used to implicit returns.  I really don&#x27;t think it adds anything useful to the language and just makes things more confusing for people coming from other languages.