<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Evilsoft.org &#187; RoR</title>
	<atom:link href="http://www.evilsoft.org/category/ror/feed" rel="self" type="application/rss+xml" />
	<link>http://www.evilsoft.org</link>
	<description>We&#039;re everywhere....</description>
	<lastBuildDate>Sun, 20 Sep 2015 23:42:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.3.1</generator>
	<item>
		<title>Why I view ruby as immature</title>
		<link>http://www.evilsoft.org/2010/06/30/why-i-view-ruby-as-immature</link>
		<comments>http://www.evilsoft.org/2010/06/30/why-i-view-ruby-as-immature#comments</comments>
		<pubDate>Wed, 30 Jun 2010 15:54:18 +0000</pubDate>
		<dc:creator><![CDATA[Administrator]]></dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.evilsoft.org/?p=253</guid>
		<description><![CDATA[In 2006 I was introduced to ruby, and for a time I found it to be a fun language to work with. After about 6 months, I started to notice problems and shortcomings in the ruby/rails stack and went on to bigger and better things. The problem is that to this day I have to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>In 2006 I was introduced to ruby, and for a time I found it to be a fun language to work with.  After about 6 months, I started to notice problems and shortcomings in the ruby/rails stack and went on to bigger and better things.  The problem is that to this day I have to defend myself to legions of ruby/rails faithful who seem to think that it&#8217;s sacrilege to ever leave the faith. (That makes me what, an apostate?)  A friend recently asked on a <a href="http://mail.evilsoft.org/mailman/listinfo/tangent">mailing list I regularly traffic</a> why a person would consider ruby to be flawed.  The best way I can express this is in some code.<br />
<span id="more-253"></span></p>
<p>As a note, this isn&#8217;t about these specific flaws: It&#8217;s that these kinds of flaws are endemic in ruby and particularly rails.</p>
<p><strong>Set Processing</strong><br />
<code><br />
devon@chronos ~/Projects/sets $ cat sets1.rb<br />
#!/usr/bin/env ruby<br />
require 'set'<br />
require 'pp'<br />
large = Set.new(Range.new(1,10000000))<br />
small = Set.new(Range.new(1,10))<br />
pp small.intersection(large)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets1.rb<br />
#&lt;Set: {5, 6, 1, 7, 2, 8, 3, 9, 4, 10}&gt;</p>
<p>real 0m35.421s<br />
user 0m23.900s<br />
sys 0m9.910s<br />
</code></p>
<p><code><br />
devon@chronos ~/Projects/sets $ cat sets2.rb<br />
#!/usr/bin/env ruby<br />
require 'set'<br />
require 'pp'<br />
large = Set.new(Range.new(1,10000000))<br />
small = Set.new(Range.new(1,10))<br />
pp large.intersection(small)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets2.rb<br />
#&lt;Set: {5, 6, 1, 7, 2, 8, 3, 9, 4, 10}%gt;</p>
<p>real 0m16.917s<br />
user 0m12.720s<br />
sys 0m3.430s<br />
</code></p>
<p>So the order that I intersect the sets drastically impacts the speed of the algorithm (2x).  Let&#8217;s take a look at python to see whether a language in the same class behaves similarly.</p>
<p><code><br />
devon@chronos ~/Projects/sets $ cat sets1.py<br />
#!/usr/bin/env python</p>
<p>large = set(range(1,10000000))<br />
small = set(range(1,10))</p>
<p>print large.intersection(small)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets1.py<br />
set([1, 2, 3, 4, 5, 6, 7, 8, 9])</p>
<p>real 0m2.583s<br />
user 0m1.850s<br />
sys 0m0.670s<br />
</code></p>
<p><code><br />
devon@chronos ~/Projects/sets $ cat sets2.py<br />
#!/usr/bin/env python</p>
<p>large = set(range(1,10000000))<br />
small = set(range(1,10))</p>
<p>print large.intersection(small)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets2.py<br />
set([1, 2, 3, 4, 5, 6, 7, 8, 9])</p>
<p>real 0m2.598s<br />
user 0m1.760s<br />
sys 0m0.710s<br />
</code></p>
<p>So no, python handles the choice of which set to intersect with the other gracefully.  This is a good example of how the ruby set api is immature.  I&#8217;m ignoring that it&#8217;s taking between 13.7 and 6.5 times as long to execute, because I think that it&#8217;s reasonable for people to do code in something that is easier for them to work in and then optimize.  My problem here is that based on the direction you do the intersection, it can take 2x longer in ruby.  This is shoddy engineering and is the kind of thing that gets solved in a language as it matures.  The problem is that the language was immature when it exploded into widespread use, and no one seems to be doing anything to make it ready for prime time. </p>
<p>So what about 1.9?  1.9 is supposed to be where the energy is going to make the language faster and more mature.<br />
<code><br />
devon@chronos ~/Projects/sets $ cat sets1.rb<br />
#!/usr/bin/env ruby1.9<br />
require 'set'<br />
require 'pp'<br />
large = Set.new(Range.new(1,10000000))<br />
small = Set.new(Range.new(1,10))<br />
pp small.intersection(large)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets1.rb<br />
#&lt;Set: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}&gt;</p>
<p>real    0m13.310s<br />
user    0m11.240s<br />
sys    0m0.680s<br />
</code></p>
<p><code><br />
devon@chronos ~/Projects/sets $ cat sets2.rb<br />
#!/usr/bin/env ruby1.9<br />
require 'set'<br />
require 'pp'<br />
large = Set.new(Range.new(1,10000000))<br />
small = Set.new(Range.new(1,10))<br />
pp large.intersection(small)</p>
<p>devon@chronos ~/Projects/sets $ time ./sets2.rb<br />
#&lt;Set: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}&gt;</p>
<p>real    0m9.181s<br />
user    0m8.280s<br />
sys    0m0.480s<br />
</code></p>
<p>While it&#8217;s faster (which wasn&#8217;t really my complaint anyway), it still is very different based on which direction you do your intersection from.  I see evidence of speed work being done on ruby, but not on maturing the language so that it meets tried and true engineering principals like the <a href="http://www.faqs.org/docs/artu/ch01s06.html">rule of least surprise.</a>  (Yes, code is a user interface for coders, so the rule of least surprise applies) <strong><em>(1)</em></strong> </p>
<p><strong>Nil as an object</strong><br />
How about this one that has actually done damage to our database:</p>
<p><code><br />
devon@chronos ~/Projects/sets $ irb<br />
irb(main):001:0> nil.id<br />
(irb):1: warning: Object#id will be deprecated; use Object#object_id<br />
=> 4<br />
</code></p>
<p>It certainly explains why we have a bizarrely large number of items in our database with foreign keys set to 4.  This conflicts directly with the rails standard for naming a database primary key as &#8216;id&#8217;, which you assess on a model at obj.id.  Yes, code should have lots of null checks, but real world code has flaws.  Sure it throws a warning, but since it doesn&#8217;t break on nil when you call .id, you get data corruption.  Gee, thanks, ruby.</p>
<p><strong>Ruby in general</strong><br />
These are just a few examples, but ruby is <em>rife</em> with happy path coding.  The language needed another 5 years of development before going into widespread use.  Instead, I think it&#8217;s getting worse because a set of rails engineers who don&#8217;t know anything about languages are at the helm, adding lots of syntactic sugar but with a distinct lack of substance behind that candied shell.</p>
<p><sub><strong><em>1.</em></strong> Perhaps it&#8217;s not fair to compare ruby to the unix philosophy, because the ruby design philosophy violates the 17 rules in ways that are clearly intentional.  Specifically, ruby and rails egregiously violate the rules of clarity and transparency, and rails in particular violates the rules of separation, composition and representation.</sub></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evilsoft.org/2010/06/30/why-i-view-ruby-as-immature/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Runaway Train</title>
		<link>http://www.evilsoft.org/2009/07/13/106</link>
		<comments>http://www.evilsoft.org/2009/07/13/106#comments</comments>
		<pubDate>Mon, 13 Jul 2009 20:26:51 +0000</pubDate>
		<dc:creator><![CDATA[Administrator]]></dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Sarcasm]]></category>

		<guid isPermaLink="false">http://www.evilsoft.org/?p=106</guid>
		<description><![CDATA[I got involved with a back and forth on twitter today about rails, and ultimately I realized that there was no way to give my full opinion of the problems facing the rails community in 140 byte snippets. I&#8217;m not saying my opinion is the end all be all, but I have lead probably half [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.imdb.com/title/tt0089941/"><img src="http://www.evilsoft.org/wordpress/wp-content/uploads/2009/07/runaway_train.jpg" alt="runaway_train" title="runaway_train" width="97" height="140" style="float:left; padding-right: 1em; border-style: None" /></a> I got involved with a back and forth on twitter today about rails, and ultimately I realized that there was no way to give my full opinion of the problems facing the rails community in 140 byte snippets.  I&#8217;m not saying my opinion is the end all be all, but I have lead probably half a dozen rails projects and I did speak at <a href="http://www.evilsoft.org/?p=78">RailsConf 2007</a>.</p>
<p>So here goes, my unvarnished opinion of the problems facing the rails community:</p>
<ol>
<li>The community</li>
<p>The community is the single most ego centric community I have ever seen in a decade and a half hanging around the greater free/open source movement.  Everyone remembers <a href="http://www.zedshaw.com/">Zed Shaw</a> ironically (but deservedly) ripping into the rails community for it&#8217;s overblown personalities. But numerous other examples abound.  How can I possibly view the authors of a monitoring framework with the name <strong>God</strong> (and a tagline &#8220;like monit only awesome&#8221;) as anything other then a people with enormously expanded and wholly unjustified egos?  How can I possibly take HAML seriously when the main <a href="http://hamptoncatlin.com/">dev</a>&#8216;s bio starts off with &#8220;Hampton Catlin is one of the best people in the world. Flat out.&#8221;  Seriously?  One has to know that this guy is going to give any production problem you have <em>very</em> serious attention&lt;/wry&gt; </p>
<li>Totally decentralized, egocentric documentation</li>
<p>No other way to say it, the rails community is obsessed with personal branding, not with being a helpful community. Is there any centralized site that has a good set of user commentable docs covering most extensions? Php has that, and it&#8217;s part of why it&#8217;s still a defensible choice for writing web apps despite its numerous other flaws.  The end result is that when you google for just about anything having to do with rails code, the first five items are all personal blogs</p>
<p>With rails, the community doesn&#8217;t build any sort of centralized corpus of knowledge, what they all do is write a blog entry about such and such technique, or how they fixed a problem.  The problem here is that nearly all of this knowledge is outdated, and impossible to tie to any one version of the application stack.  So instead we get <a href="http://www.rubyhead.com/">tons of blogs</a> with <a href="http://weblog.rubyonrails.org/">disjointed suggestions</a> that take you in the <a href="http://blog.jayfields.com/">wrong direction</a> whenever you google about an issue (sure, this solution worked in 2.1, but not in 2.0 or 2.3).  Too bad it&#8217;s in a blog without with the applicable version number instead of in a comment at the end of the documentation like <a href="http://www.php.net/manual/en/class.datetime.php">mysql</a> or <a href="http://www.php.net/manual/en/class.datetime.php">php</a>.</p>
<li>Excessive reliance on ORM</li>
<p>I&#8217;m sure you have all heard of the N+1 problem.  Sure, lots of devs will tell you that it&#8217;s simple to avoid, but based on all the teams I&#8217;ve evern worked on, all it takes is one lazy programmer and all of a sudden your templates are taking 7000+ queries to render.  It&#8217;s no wonder the rails community seems to think sql is slow.  Hint: the answer isn&#8217;t memcached, the reason your rails site is slow is because the sql it&#8217;s running is craptastic.  99.999% of rails sites could be vastly improved by just hiring one or two people who actually understand relational databases.  The part that I really just don&#8217;t get is that sql is much <em>easier</em> then coding, and RDBMS is not rocket science, but it&#8217;s treated like this big hideous bear that your developers have to hide from.</p>
<li>Pure ruby is the answer to everything</li>
<p>The community is utterly obsessed with pure ruby, and looks down on impure extensions that are wrappers around solid C libraries.  This results in a general race to the bottom for speed, stability and maturity.  The unix world is packed with easy to integrate, solid libraries.  Libxml-ruby is nearly two orders of magnitude faster then rexml, and has top notch compliance with the xml spec. Yet somehow rexml is the standard and libxml-ruby is the red headed step child.</p>
<li>Fragile ecosystem</li>
<p>Now, I&#8217;ll be the first to admit that the rails maintainers shout far and wide that rails isn&#8217;t enterprise ready, and it really truly is not.  Over and over I have gotten bitten by the myriad of flaws in the rails ecosystem.  Any one specific issue I&#8217;ve dealt with could have been fixed in version such and such of some gem (or it&#8217;s even worse with rails plugins.)  This complaint is not about specific flaws so much as the whole ecosystem feels like it&#8217;s standing on a very fragile foundation.  Some examples of the ways we have gotten bitten over the life of the multiple rails projects I have been involved with are:</p>
<ul>
<li>rexml violating the xml spec by totally ignoring the encoding of documents parsed by it.</li>
<li>gem silently failing (not returning the proper unix return code) and thus allowing some of our instance launches to blow up without a reasonable way to catch it.  (And as a note, when you have to automatically install large amounts of gems from rubyforge, it chokes a *lot*).</li>
<li>Innumerable gems regularly break api compatibility even in minor releases (I&#8217;m looking at you Rack).  When you add calls, you can&#8217;t just remove them between 0.9.2 and 0.9.3, it&#8217;s damn unprofessional.</li>
<li>i18n has been a real problem right from the beginning.</li>
<li><a href="http://code.google.com/p/phusion-passenger/issues/detail?id=199">Passenger&#8217;s ApplicationPool</a> choking and never coming back, forcing you to restart apache once a month</li>
<li>Constant movement from one webserver to another.  It&#8217;s damn frustrating to have to switch web servers every 3 months as the community hops from one the the next, as everything else gets filed in the community folder for utter crap.  At that point it becomes damn hard to find support for problems.  First it&#8217;s lighttpd, with mongrel, then thin, then nginx with thin and on and on.  Somehow people need to support this mess.  Apache works, is well supported, can be very lean, and basically every systems person on the planet knows how to work with it.  Hint: as a programmer, it&#8217;s not all about you.  Your applications need to be supportable; running away from standards for the sake of being different is dumb.</li>
</ul>
<p>And just to reiterate, some of these could be actually fixed, or hell, they may have always had a *way* to work right, but the default was broken, and caused project problems that never should have existed if the rails community could ever get around to implementing a spec as it is written.</p>
<li>Generates bad, bad habits in devs</li>
<ul>
<li>Creates a view of the world that implicit is good.  This goes all the way to the language itself and the silly fact that explicit returns use more processor power then implicit returns.</li>
<li>Creates a view of the world that clever is good.  Anyone who has maintained software for a few years should be able to tell you, clever is bad, very bad.</li>
<li>My personal least favorite, the technological abortion known as Single Table Inheritance.  Admittedly, even the community is now arguing for people to not use this.  STI is a wretched way to bind a database with an object model, it encourages sparse tables as well as overloading of tables.  Both of these things <em>will</em> bite you in the ass down the road.</li>
</ul>
<li>Convention magic</li>
<p>Magic is the core of rails, and seems to be one of it&#8217;s biggest selling points.  The problem is, there&#8217;s simply no place for magic in a world where people need to actually support your code. Explicit configuration and code is much more useful to operations folks who aren&#8217;t familiar with the codebase, framework, and language.  Even if you use your developers to support your app, when they rely on a bunch of clever magic it can make for longer outages while people have to figure out what implicit thing they are failing to take into account.</p>
<li>Rails hype will kill ruby</li>
<p>Ruby could be a decent language.  It has a lot of awesome things going for it.  In a few years it really will be ready for real heavy lifting.  At least that <em>was</em> ruby&#8217;s future.  Rails has taken over the show.  The Rails community <strong>is</strong> the ruby community, and it has not set ruby on a course to be a truly dependable language.  Instead as rails project after rails project fails in all sorts of business environments, it is creating a permanent bias against the language in the management staff that oversees projects in american business.  I&#8217;ve personally seen it in multiple companies, and expect to see it in most shops that are today fiddling with rails.
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.evilsoft.org/2009/07/13/106/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Java contrasted with Ruby</title>
		<link>http://www.evilsoft.org/2006/01/04/java-contrasted-with-ruby</link>
		<comments>http://www.evilsoft.org/2006/01/04/java-contrasted-with-ruby#comments</comments>
		<pubDate>Thu, 05 Jan 2006 00:12:28 +0000</pubDate>
		<dc:creator><![CDATA[Administrator]]></dc:creator>
				<category><![CDATA[RoR]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.evilsoft.org/?p=57</guid>
		<description><![CDATA[What a nice little article&#8230; over on the IBM developer works website Andrew Glover nicely compares and contrasts common Java idioms with their Ruby counterparts. For all those people out there who find the Ruby magic a bit daunting and who look at Rails and freak out when stuff seems to happen behind a curtain [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>What a nice little <a href="http://www-128.ibm.com/developerworks/library/j-ruby/?ca=dgr-lnxw01RubyOffRails">article</a>&#8230; over on the IBM developer works website Andrew Glover nicely compares and contrasts common Java idioms with their Ruby counterparts. For all those people out there who find the Ruby magic a bit daunting and who look at Rails and freak out when stuff seems to happen behind a curtain take a look at this article. I think it is a really nice comparison between the two languages that is a good super-light-weight introduction to Ruby for experienced Java developers. Also look at the bottom of the article for lots of other goodies introducing Ruby further. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.evilsoft.org/2006/01/04/java-contrasted-with-ruby/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
