<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://bendiken.net">
<channel>
 <title>Arto Bendiken on Rails</title>
 <link>http://bendiken.net/taxonomy/term/39/0</link>
 <description>Ruby on Rails</description>
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/bendiken/rails" type="application/rss+xml" /><item>
 <title>Opinionated Best Practices Elucidated</title>
 <link>http://feeds.feedburner.com/~r/bendiken/rails/~3/138190764/opinionated-best-practices-elucidated</link>
 <description> &lt;p&gt;Railroad lines are, at any given moment, unidirectional. You can&amp;#8217;t veer off the track that has been laid out in front of you, and you can&amp;#8217;t make unscheduled stops unless you want the overnight express to run into you. These can be problems if you&amp;#8217;re not altogether happy with the direction the track is taking you. Equally so if you would like to make any additional visits alongside the plotted course.&lt;/p&gt;

	&lt;p&gt;On the other hand, if you just keep your limbs inside the vehicle as advised, you can safely traverse the track at a very high velocity to arrive at your destination faster than with any other means of surface transport. You can watch the boring, mundane wasteland outside go by without needing to interact with it in any way.&lt;/p&gt;

	&lt;p&gt;So, riding the metaphor for all it is worth, when &lt;a href="http://en.wikipedia.org/wiki/David_Heinemeier_Hansson"&gt;David Heinemeier Hansson&lt;/a&gt; took &lt;a href="http://www.ruby-lang.org/"&gt;Ruby&lt;/a&gt; and created an opinionated, high-productivity web development framework, is it any surprise he named it &lt;a href="http://www.rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt;? The name lays out the deal up front: &lt;em&gt;our way, or the highway&lt;/em&gt;.&lt;/p&gt;

	&lt;p&gt;Could he possibly have been any more explicit? As I&amp;#8217;m sure most readers know, &lt;span class="caps"&gt;DHH&lt;/span&gt; is anything but &lt;a href="http://www.flickr.com/photos/eugevon/130610241/"&gt;subtle&lt;/a&gt;. Yet people seem to keep missing the point.&lt;/p&gt;

	&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;

	&lt;p&gt;A premise of Rails, and perhaps eventually its enduring legacy, is that constraints can be liberating, that a &lt;a href="http://www.loudthinking.com/arc/2006_06.html"&gt;straightjacket for your mind&lt;/a&gt; can actually increase your productivity. As Hari Seldon might&amp;#8217;ve &lt;a href="http://en.wikipedia.org/wiki/Psychohistory_%28fictional%29"&gt;put it&lt;/a&gt;: your freedom of action has been curtailed in order to guide you out of the Dark Ages along a well-planned, accelerated trajectory.&lt;/p&gt;

	&lt;p&gt;Instead of aiming to please everybody equally badly and making all things equally hard to do, Rails plays favorites. It&amp;#8217;s software with an attitude, it&amp;#8217;s politically incorrect, and as a result it is, of course, controversial. The goals themselves are simple, however: developer productivity and happiness (yes, happiness; motivation being a non-trivial component of productivity, if you can imagine such a state of affairs).&lt;/p&gt;

	&lt;p&gt;Take the little things: how should you organize and structure your project? How should you name your source files, class hierarchy, or your database tables and columns? What should your &lt;span class="caps"&gt;URL&lt;/span&gt; structure be like? What naming and coding conventions should you use in the code itself? If you&amp;#8217;re honest with yourself, the answer to all the preceding is: &lt;strong&gt;who cares&lt;/strong&gt;, as long as there is &lt;em&gt;some&lt;/em&gt; sensible convention in the team. Rails gives you &amp;#8212; or, rams down your throat, actually &amp;#8212; sensible conventions that apply not only within your team, but across all Rails projects and the core Rails code itself.&lt;/p&gt;

	&lt;p&gt;What about documenting your code? What about writing unit and integration tests; should you do it, and if so, how? You betcha you &lt;strong&gt;should&lt;/strong&gt;, and Rails makes sure you know how, and frowns on you if you don&amp;#8217;t fulfill your end of the bargain. (Who knew writing tests could be so much fun? I guess when you take the suck out of something, the fun shines through.)&lt;/p&gt;

	&lt;p&gt;Think about it: how often have you spent minutes agonizing over how to name something in your project? From my own experience I&amp;#8217;d venture that a programmer will need to make up to several hundred microdecisions like this during the course of a typical workday. These are precisely the kinds of trivial, yet time-wasting, aspects of development largely eliminated with Rails, if you follow its conventions. Add to that an iterative development approach using the very capable and dynamic programming language underpinning Rails, and the cost of changing your mind about anything &amp;#8212; anything over which you still have veto power, of course &amp;#8212; is so low as to hardly matter.&lt;/p&gt;

	&lt;p&gt;You may not agree with all of Rails&amp;#8217;s conventions (I certainly don&amp;#8217;t), but there are consequences to violating them. You&amp;#8217;ll discover it is generally worthwhile to stick to them, or else to seek some other framework. These are &lt;em&gt;not&lt;/em&gt; incidental matters as with most software, but key aspects of successful Rails usage. Remember, it&amp;#8217;s the Rails way, or the highway (and the highway can get you there eventually, too).&lt;/p&gt;

	&lt;p&gt;Now, capable programmers tend to be control freaks, and geeks in general don&amp;#8217;t like to have external authority enforced upon them, be it in politics or in technology. &lt;em&gt;&amp;#8220;It&amp;#8217;s like herding wild cats,&amp;#8221;&lt;/em&gt; confounded managers claim. This can mean that unless you happen to agree with most of the innumerable decisions that Rails does make for you and does hold you to, adopting the framework wholesale can be a bitter pill to swallow, at least initially. It truly puts to the test whether you care more about your ingrained habits and dearly-held opinions, or whether you can be railroaded into actually delivering the damn project (and perhaps learning something new while at it).&lt;/p&gt;

	&lt;p&gt;There&amp;#8217;s good news, though. You may indeed have to let go of a little ego and micromanagement, but what you&amp;#8217;ll gain will probably be worth it: there&amp;#8217;s gold at the end of the rails. Provisionally accept the Rails way and gain some real proficiency with it, and you &lt;strong&gt;will&lt;/strong&gt; complete the project faster than you thought.&lt;/p&gt;

	&lt;p&gt;Stick to the recommended practices and well-thought-out conventions, whether you agree with them or not, and your code &lt;strong&gt;will&lt;/strong&gt; be well-organized and maintainable by other Rails programmers; as for being readily comprehensible or elegant, well, that&amp;#8217;ll still be entirely up to you, of course. (Another aspect of this is that for a junior developer, learning and following Rails best practices and reading existing well-written Rails code can conceivably partly make up for the lack of some years of industry experience.)&lt;/p&gt;

	&lt;p&gt;There&amp;#8217;s more. You &lt;strong&gt;won&amp;#8217;t&lt;/strong&gt; have to work in some painful legacy programming language that &lt;a href="http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html"&gt;makes you dumber&lt;/a&gt;. In fact, you &lt;strong&gt;may&lt;/strong&gt; actually start to enjoy programming again, perhaps even begin to indeed care about the work you do; rest assured this is not uncommon, and you don&amp;#8217;t need to see the doctor about it. (You might ask your manager for a raise, though.)&lt;/p&gt;

	&lt;p&gt;If you&amp;#8217;re currently working mostly with obsolete technologies and there&amp;#8217;s no chance to use Rails there, you &lt;strong&gt;may&lt;/strong&gt; be able to get back on the job market using Rails &amp;#8211; there certainly never seem to be enough Rails programmers to satisfy demand.&lt;/p&gt;

	&lt;p&gt;You&amp;#8217;ll &lt;strong&gt;probably&lt;/strong&gt; eventually agree that a lot of the stuff you at first felt Rails shanghaied you into (say, test-driven development) are simply reasonable best practices you&amp;#8217;ll want to adopt elsewhere, too, as appropriate.&lt;/p&gt;

	&lt;p&gt;For those of us who got onto Rails at the ground floor or close to it, all the aforementioned was admittedly a tad less painful. The adjustment process was gradual and addictive instead of abrupt and in-your-face. (I&amp;#8217;ve &lt;a href="http://bendiken.net/2007/01/01/the-road-to-lisp"&gt;written before&lt;/a&gt; about Ruby having been my gateway drug, getting me started on &lt;a href="http://norvig.com/21-days.html"&gt;Norvig&amp;#8217;s ten-year plan&lt;/a&gt;.) But there&amp;#8217;s still a ways to go before the top floor, and plenty of room on board.&lt;/p&gt;

	&lt;p&gt;I think that in retrospect it is clear that on the development side of things, the emergence of Rails is the waterline that came to define &lt;a href="http://en.wikipedia.org/wiki/Web_2"&gt;Web 2.0&lt;/a&gt;. No post-Rails web development framework or toolkit can help but have been influenced by it; witness the explosion of Rails clones in programming languages &lt;a href="http://www.cliki.net/lisp-on-lines"&gt;left&lt;/a&gt; and &lt;a href="http://www.cakephp.org/"&gt;right&lt;/a&gt;, and even &lt;a href="http://www.infoq.com/news/2007/06/yegge-rhino-on-rails"&gt;spot on&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;By now, most of the technical aspects of Rails have been disseminated, some even surpassed, to various degrees in the industry, and the playing field as a whole is better because of it. But perhaps more folks will yet realize that the &amp;#8220;opinionated&amp;#8221; part of the equation should be thought of not merely in terms of DHH&amp;#8217;s demeanor, but as directly relevant to aesthetics and productivity.&lt;/p&gt;

	&lt;p&gt;&lt;em&gt;To be soon continued with some thoughts regarding deficiencies in Rails, and what may lie beyond Rails or the next paradigm shift. And no, it won&amp;#8217;t be airplanes. Perhaps seaside rockets will figure in there somewhere, though.&lt;/em&gt;&lt;/p&gt;</description>
 <comments>http://bendiken.net/2007/07/26/opinionated-best-practices-elucidated#comment</comments>
 <category domain="http://bendiken.net/tags/aesthetics">aesthetics</category>
 <category domain="http://bendiken.net/tags/productivity">productivity</category>
 <category domain="http://bendiken.net/tags/programming">programming</category>
 <category domain="http://bendiken.net/tags/rails">Rails</category>
 <category domain="http://bendiken.net/tags/ruby">Ruby</category>
 <pubDate>Thu, 26 Jul 2007 12:00:00 -0700</pubDate>
 <dc:creator>Arto</dc:creator>
 <guid isPermaLink="false">58 at http://bendiken.net</guid>
<feedburner:origLink>http://bendiken.net/2007/07/26/opinionated-best-practices-elucidated</feedburner:origLink></item>
<item>
 <title>Spam Filters, Alien Technology and Ruby on Rails</title>
 <link>http://feeds.feedburner.com/~r/bendiken/rails/~3/76792756/spam-filters-alien-technology-and-ruby-on-rails</link>
 <description>	&lt;p&gt;&lt;img src="http://bendiken.net/images/misc/lisplogo_fancy_256.png" alt="Lisp - made with secret alien technology" width="256" height="223" border="0" align="right" style="float: right; margin: 0px 0px 5px 5px;" /&gt;&lt;/p&gt;

	&lt;p&gt;When Paul Graham&amp;#8217;s &lt;a href="http://www.paulgraham.com/spam.html"&gt;A Plan for Spam&lt;/a&gt; made its dramatic entrance into the anti-spam battle four years ago, it heralded the beginning of the end for spam &amp;#8212; as we knew spam back then, anyway. Applying &lt;a href="http://www.paulgraham.com/better.html"&gt;a simple statistical approach&lt;/a&gt;, based on &lt;a href="http://en.wikipedia.org/wiki/Frequency_analysis"&gt;word frequency analysis&lt;/a&gt; with a &lt;a href="http://en.wikipedia.org/wiki/Naive_Bayes_classifier"&gt;naive Bayesian classifier&lt;/a&gt;, Graham described how to create a spam filter accurate enough (99+%) that &lt;a href="http://en.wikipedia.org/wiki/False_positive"&gt;false positives&lt;/a&gt; effectively ceased to be an issue.&lt;/p&gt;

	&lt;p&gt;The central idea of the Graham Algorithm was quickly adopted en masse by spam filters, and as a result, the spam arms race has in the past few years tipped in favor of the good guys. &amp;#8220;Successful&amp;#8221; spam has devolved into exactly what Graham predicted it would: &lt;em&gt;&amp;#8220;some completely neutral text followed by a &lt;span class="caps"&gt;URL&lt;/span&gt;.&amp;#8221;&lt;/em&gt; For me personally, the combination of good server- and client-side filters has made spam yesterday&amp;#8217;s problem. (Well, that, and using &lt;a href="http://mail.google.com/"&gt;Gmail&lt;/a&gt; as a front-end for lower-priority e-mail; &lt;a href="http://bendiken.net/feedback"&gt;spam all you want&lt;/a&gt;, it&amp;#8217;s Google&amp;#8217;s problem and they&amp;#8217;re up to the task.)&lt;/p&gt;

	&lt;p&gt;Recently at &lt;a href="http://www.makalumedia.com/"&gt;$WORK&lt;/a&gt;, we&amp;#8217;ve succeeded in applying similar &lt;a href="http://en.wikipedia.org/wiki/Text_classification"&gt;text classification&lt;/a&gt; principles to another unrelated problem area, with the intent of forcing the computer to do the tedious job it was invented for, allowing us super-apes, in turn, to spend more time under a palm tree on the nearby beach, sipping &lt;a href="http://en.wikipedia.org/wiki/Tinto_de_verano"&gt;tinto de verano&lt;/a&gt; and working out answers to deep existential questions, or whatever else it is that one does on the beach (&lt;em&gt;note to self: need more practice&lt;/em&gt;).&lt;/p&gt;

	&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;

	&lt;p&gt;The exact details of this covert project will have to await its escape into the wild, should it ever evolve the capability for that. For the time being, some of the technically more interesting tidbits will have to do as fodder for my ramblings.&lt;/p&gt;

	&lt;p&gt;First, as with most of our internal development, and an ever-increasing percentage of our client projects, this system was developed using the high-productivity &lt;a href="http://www.rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; framework, and reached the magical 0.1.0 mark (i.e., pre-alpha, but usable enough to solve many of the developers&amp;#8217; own needs) in less than a man-week of intensive coding (not to forget the skimming of a good number of &lt;a href="http://www.paulgraham.com/bayeslinks.html"&gt;research papers&lt;/a&gt; related to the subject).&lt;/p&gt;

	&lt;p&gt;However, to ensure &lt;a href="http://www.paulgraham.com/avg.html"&gt;a permanent gap on the competition&lt;/a&gt; (after all, it sometimes seems like half the world has already jumped onto Rails), we also pulled out the big guns: the top-secret &lt;a href="http://lispers.org/"&gt;alien technology&lt;/a&gt; known as &lt;a href="http://en.wikipedia.org/wiki/Lisp_programming_language"&gt;Lisp&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;(Don&amp;#8217;t be fooled by the devious code name, intended to confound us earthlings with spurious ideas relating to speech defects &amp;#8212; this is seriously powerful stuff: &lt;a href="http://www.gigamonkeys.com/book/"&gt;exposure&lt;/a&gt; is guaranteed to subtly but permanently &lt;a href="http://www.catb.org/esr/faqs/hacker-howto.html"&gt;alter your brain structure&lt;/a&gt; in ways not yet fully understood. In fact, the aliens have &lt;a href="http://wiki.alu.org/Glenn_Ehrlich_Road_to_Lisp"&gt;theorized&lt;/a&gt; that the Universe &lt;a href="http://wiki.alu.org/Svein_Ove_Aas%27s_Road_to_Lisp"&gt;may&lt;/a&gt; actually be one giant Quantum Lisp machine, explaining how it is possible that lots of irritating, seemingly superfluous parentheses can act as magic incantations conveying an apparently inexhaustible power as per the principle of &lt;a href="http://en.wikipedia.org/wiki/Clarke%27s_three_laws"&gt;Clarke&amp;#8217;s Third Law&lt;/a&gt;. But that&amp;#8217;s neither here nor there for our present purposes.)&lt;/p&gt;

	&lt;p&gt;In our case, we simply integrated into the Rails system an interpreter for a subset of &lt;a href="http://www.schemers.org/"&gt;Scheme&lt;/a&gt;, a Lisp derivative; thus no doubt confirming &lt;a href="http://en.wikipedia.org/wiki/Greenspun%27s_Tenth_Rule"&gt;Greenspun&amp;#8217;s Tenth Rule&lt;/a&gt; once again. (Well, to be fair, the Lisp interpreter in question is only some few hundred lines of fairly elegant Ruby code.)&lt;/p&gt;

	&lt;p&gt;The system&amp;#8217;s top-level classification and scoring algorithms are implemented in this Lisp subset, allowing us to easily fine-tune and try out new tweaks at runtime, and perhaps in the future letting us semi-automatically pit various competing implementations against each other in a manner not dissimilar to a &lt;a href="http://en.wikipedia.org/wiki/Genetic_algorithm"&gt;genetic algorithm&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Due to the combined &lt;a href="http://en.wikipedia.org/wiki/Rapid_application_development"&gt;RAD-factors&lt;/a&gt; of Rails and Lisp, we quickly proceeded through a number of intermediate prototypes along the way, starting from a short-lived &lt;a href="http://ferret.davebalmain.com/trac/"&gt;Ferret-based&lt;/a&gt; implementation, evolving to a hand-rolled tokenizer and SQL-backed corpora storage, and eventually ending up with the current version that delegates the content classification to a &lt;a href="http://en.wikipedia.org/wiki/Dr._Strangelove_or:_How_I_Learned_to_Stop_Worrying_and_Love_the_Bomb"&gt;Dr. Strangelove-inspired&lt;/a&gt; piece of excellent software called the &lt;a href="http://crm114.sourceforge.net/"&gt;CRM114 Controllable Regex Mutilator&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;(Speaking of CRM114, I was surprised to not find any existing Ruby bindings for it, and thus took the time to transcribe a previous &lt;a href="http://www.elegantchaos.com/node/129"&gt;Python wrapper&lt;/a&gt; into a Ruby version, to be released shortly.)&lt;/p&gt;

	&lt;p&gt;Anyway, the system appears to work more or less according to spec, but definitely still needs some more tweaking before embarking on world domination. For one thing, all this number crunching is, well, rather &lt;strong&gt;heavy&lt;/strong&gt; (let&amp;#8217;s just say it&amp;#8217;s a good thing we have A/C in the server room where the development box is located). Although CRM114 itself is pretty light on its feet, we&amp;#8217;re dealing with an exponentially growing data set, and the next challenge will be to put some checks on resource consumption.&lt;/p&gt;

	&lt;p&gt;So, for the time being, we&amp;#8217;re not going to let the development box interact with our &lt;a href="http://www.makalumedia.com/space"&gt;space systems department&lt;/a&gt;, to prevent any non-regulated growth or inadvertent contact with the &lt;a href="http://www.lisperati.com/logo.html"&gt;aliens&lt;/a&gt;. More updates to follow as they happen.&lt;/p&gt;

	&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note to self&lt;/strong&gt;: too many &lt;a href="http://images.google.com/images?q=tinto%20de%20verano"&gt;tinto veranos&lt;/a&gt; can make you forget there&amp;#8217;s a fine line between tongue-in-cheek surrealism and plain-bad geek humor.&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Update 2006/11/06:&lt;/strong&gt; I&amp;#8217;ve released &lt;a href="http://rubyforge.org/projects/crm114/"&gt;the Ruby interface to CRM114 on RubyForge&lt;/a&gt;.&lt;/p&gt;</description>
 <comments>http://bendiken.net/2006/07/05/spam-filters-alien-technology-and-ruby-on-rails#comment</comments>
 <category domain="http://bendiken.net/tags/aliens">aliens</category>
 <category domain="http://bendiken.net/tags/crm114">CRM114</category>
 <category domain="http://bendiken.net/tags/ferret">Ferret</category>
 <category domain="http://bendiken.net/tags/lisp">Lisp</category>
 <category domain="http://bendiken.net/tags/rails">Rails</category>
 <category domain="http://bendiken.net/tags/ruby">Ruby</category>
 <category domain="http://bendiken.net/tags/scheme">Scheme</category>
 <category domain="http://bendiken.net/tags/spam">spam</category>
 <category domain="http://bendiken.net/tags/strangelove">Strangelove</category>
 <pubDate>Wed, 05 Jul 2006 14:19:00 -0700</pubDate>
 <dc:creator>Arto</dc:creator>
 <guid isPermaLink="false">34 at http://bendiken.net</guid>
<feedburner:origLink>http://bendiken.net/2006/07/05/spam-filters-alien-technology-and-ruby-on-rails</feedburner:origLink></item>
</channel>
</rss>
