<?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>Jan Varwig &#187; orm</title>
	<atom:link href="http://jan.varwig.org/archive/tag/orm/feed" rel="self" type="application/rss+xml" />
	<link>http://jan.varwig.org</link>
	<description>Somewhere between Hello World and HAL9000</description>
	<lastBuildDate>Sat, 03 Dec 2011 00:15:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Why bloggers suck</title>
		<link>http://jan.varwig.org/archive/why-bloggers-suck?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-bloggers-suck</link>
		<comments>http://jan.varwig.org/archive/why-bloggers-suck#comments</comments>
		<pubDate>Mon, 09 Jun 2008 19:10:04 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/?p=84</guid>
		<description><![CDATA[Today a post by Reg Braithwaite brought to my attention several blogposts about ActiveRecords alledged shortcomings. Most of their writers are posting rants rants about some ideas they have about ActiveRecord without ever having really used it, it seems. The main issues seem to be Domain-code in your controllers instead of your models Rails choice [...]]]></description>
			<content:encoded><![CDATA[<p>Today a <a href="http://weblog.raganwald.com/2008/06/bitchiness-also-sucks.html">post by Reg Braithwaite</a> brought to my attention <a href="http://nothinghappens.net/?p=324">several</a> <a href="http://kore-nordmann.de/blog/why_active_record_sucks.html">blogposts</a> <a href="http://blog.mikeseth.com/index.php?/archives/4-ActiveRecord-sucks,-but-Kore-Nordmann-is-wrong.html">about ActiveRecords</a> <a href="http://karwin.blogspot.com/2008/05/activerecord-does-not-suck.html">alledged shortcomings</a>.
Most of their writers are posting rants rants about some ideas they have about ActiveRecord without ever having really used it, it seems. The main issues seem to be</p>

<ul>
<li>Domain-code in your controllers instead of your models</li>
<li>Rails choice of inheritance (AR as a base class for models)  for implementing AR</li>
</ul>

<p>Putting domain code inside your controllers is a programmer problem, not a framework problem.
I won&#8217;t even elaborate this any further.</p>

<p>The other issue is trickier. Not because of technical issues but because there&#8217;s a problem with the perception of Rails ActiveRecord. I first didn&#8217;t even want to waste my time to write this rant but then I started a comment on one of the postings that turned longer and longer until I decided to make a post of it.</p>

<p>Bill Karwin wrote some observations that I can mostly agree with.
There&#8217;s one exception though: I don&#8217;t see any problem with AR being implemented as a base class for your models.</p>

<p>One perceived problem is a lack of separation of concerns, the idea that you should separate model logic and database logic and that ActiveRecords fails here.</p>

<p>But one must look beyond the <em>separation-of-concerns</em> dogma here and ask what motivates this principle. Mixed concerns lead to confusion, confusions leads to errors and redundance (and thus to more errors). So, the motivation is to maintain a clear view over your methods and to reduce redundance.</p>

<p>Both goals are maintained by Rails although the models contain a mix of model- and database logic. Because most things can be expressed <em>very</em> concisely in Ruby, one line or even no code at all (using the powers of reflection) is enough to achieve what you want. If all your model-functionality and ORM-functionality  fit within one page on your screen, the benefit of splitting both into separate modules and/or files becomes too low to justify the cost.</p>

<p>The second problem with inheriting your models from AR::Base is supposedly the tight coupling between your model and your DB-access layer, requiring you to have a database ready for unit testing. If you&#8217;ve ever written tests for Rails, you know this is bullshit. Testing is a non-issue and the support for the testing database so seamless that I can&#8217;t imagine it being any more simple. One rake task sets up your testing database after a migration, the rest is handled automatically.</p>

<p>Pretending that relying on AR so much for your models is still bad somehow because you might want to change your record-store a some point in the lifetime of your application is nothing but a bunch of bullshit. NO solution EVER will enable you to do THAT in a way that&#8217;s so seamless that you&#8217;d want to. We&#8217;re talking about software here, not lightbulbs that you just screw in. Abstractions are always leaky and talking as if they were not is foolish.</p>

<p>The whole point is that Rails set out to to one thing well, and that is to write web apps in a certain way that has proven to be quite productive and covering the needs of most projects pretty well. You get a lot of comfort following that way but you pay a price if you don&#8217;t, namely losing that comfort. People are demanding stuff that Rails never promised to deliver. About their motivations I can only speculate. Maybe they&#8217;re just clueless, maybe they just want to make some noise. In any way, they&#8217;re hell of a reason to <a href="http://gilesbowkett.blogspot.com/2008/05/summon-monsters-open-door-heal-or-die.html">stay away from Digg and Reddit</a> and stick to some bloggers you trust with not wasting your time.</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archive/why-bloggers-suck/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse ORM</title>
		<link>http://jan.varwig.org/archive/reverse-orm?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reverse-orm</link>
		<comments>http://jan.varwig.org/archive/reverse-orm#comments</comments>
		<pubDate>Sun, 04 May 2008 15:03:45 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/?p=81</guid>
		<description><![CDATA[That Object-Relational-Mapping is a difficult Problem is not news. The usual criticisms are all valid, but what occured to me, after thinking a while about this, is that all approaches I&#8217;ve seen so far seem oriented to the object-oriented modeling, trying to map the OO-models to database relations. What about tackling the problem from the [...]]]></description>
			<content:encoded><![CDATA[<p>That Object-Relational-Mapping is a difficult Problem is <a href="http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx">not news</a>.</p>

<p>The usual criticisms are all valid, but what occured to me, after thinking a while about this, is that all approaches I&#8217;ve seen so far seem oriented to the object-oriented modeling, trying to map the OO-models to database relations.</p>

<p>What about tackling the problem from the other side? Relations can have huge benefits over object graphs, why not leverage their strengths and, instead of mapping OO to relations, just try to use OO to make dealing with relations easier and more natural in OO languages?</p>

<p>Relational logic is powerful and relatively easy to understand. There are just a few annoyances that should be addressed:</p>

<ul>
<li>Validation</li>
<li>Mapping relations to forms</li>
<li>Keeping track of associations</li>
</ul>

<p>This wasn&#8217;t in any way thought through by me, it just came to my mind. Maybe there are already some solutions that go this route, maybe someone even proved this to be impractical. The approach seems worth investigating.</p>

<p>&#8230;as soon as I find the time :(</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archive/reverse-orm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

