<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Rails could be DRYer</title>
	<atom:link href="http://aralbalkan.com/764/feed" rel="self" type="application/rss+xml" />
	<link>http://aralbalkan.com/764</link>
	<description>Passionate geekisms.</description>
	<lastBuildDate>Sun, 14 Mar 2010 13:33:42 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: giles</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5654</link>
		<dc:creator>giles</dc:creator>
		<pubDate>Sun, 15 Oct 2006 02:36:20 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5654</guid>
		<description>I think the counterargument would reference levels of abstraction. Implementing a system which automatically generated schemas based on the Model could create a solution which was more complicated to implement than the problem it solves.</description>
		<content:encoded><![CDATA[<p>I think the counterargument would reference levels of abstraction. Implementing a system which automatically generated schemas based on the Model could create a solution which was more complicated to implement than the problem it solves.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aral</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5436</link>
		<dc:creator>aral</dc:creator>
		<pubDate>Wed, 11 Oct 2006 16:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5436</guid>
		<description>Thanks, Cies. Sorry my blog mangled your code block.</description>
		<content:encoded><![CDATA[<p>Thanks, Cies. Sorry my blog mangled your code block.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cies</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5427</link>
		<dc:creator>cies</dc:creator>
		<pubDate>Wed, 11 Oct 2006 12:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5427</guid>
		<description>again the code got mangled...

it is basically the same as i wrote here (see the bottom of the page):
http://wiki.rubyonrails.org/rails/pages/ActiveSchema

i only changed the ActiveRecord super class into ManagedRecord; this because i found that it is mission impossible to implement it into the existing AR.</description>
		<content:encoded><![CDATA[<p>again the code got mangled&#8230;</p>
<p>it is basically the same as i wrote here (see the bottom of the page):<br />
<a href="http://wiki.rubyonrails.org/rails/pages/ActiveSchema" rel="nofollow">http://wiki.rubyonrails.org/rails/pages/ActiveSchema</a></p>
<p>i only changed the ActiveRecord super class into ManagedRecord; this because i found that it is mission impossible to implement it into the existing AR.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cies</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5426</link>
		<dc:creator>cies</dc:creator>
		<pubDate>Wed, 11 Oct 2006 11:56:20 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5426</guid>
		<description>THE ABOVE CODE BLOCK GOT MANGLED...
HERE I TRY AGAIN:


.class Author  /regex/
.  end
.end
.
.# [...]
.
.class Post  3..100
.  end
.
.  attribute :summary, :text
.  attribute :content, :text
.end</description>
		<content:encoded><![CDATA[<p>THE ABOVE CODE BLOCK GOT MANGLED&#8230;<br />
HERE I TRY AGAIN:</p>
<p>.class Author  /regex/<br />
.  end<br />
.end<br />
.<br />
.# [...]<br />
.<br />
.class Post  3..100<br />
.  end<br />
.<br />
.  attribute :summary, :text<br />
.  attribute :content, :text<br />
.end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cies</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5425</link>
		<dc:creator>cies</dc:creator>
		<pubDate>Wed, 11 Oct 2006 11:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5425</guid>
		<description>i totally agree... and i have investigated in this issue. (you can search for my name on rails lists)

what i suggest is a sort of &#039;ManagedRecord&#039;:
 - write your db schema in ruby code; inside your model
 - let the &#039;framework&#039; generate migrations for you (when it encounters your models do not match with the db anymore -- this should only work in development modes)
 - have the attributes and the validations etc. all at one place (the model ruby code)

here a small example:

&lt;code&gt;
class Author  /regex/
  end
end

# [...]

class Post  3..100
  end

  attribute :summary, :text
  attribute :content, :text
end
&lt;/code&gt;

i did a small investigation and concluded that this could never be implemented inside (or as some sort of extention/plugin/etc to) ActiveRecord, because of technical difficulty and because of the rails not seeing the unDRYness as a problem.

that&#039;s why: ManagedRecord will be needed.

i have no clue if Managed- and ActiveRecord could cooperate, of it it would be possible to maintain compatibillity with AR plugins. my guess: mostly likely not.

ManagedReocrd will put a lot more stress on the implementation of the database interface, it might also enable the developer to use stuff like database-side referential integrity (and other database features) with very little efford.

important: what happends if a ManagedRecord model is no longer matching the db?
 - in development: an exception should be raised, and catched by the framework to start the auto generation and execution of a migration (this could be accomplished by a web based interface)
 - in production: this should never happen! when the models are updated on a production server the migrations also have to update.


pfff.... long comment, i hope some one reads it.
with questions, or further investigations: please mail me (cies,at;kde:dot.nl).


Cies Breijs</description>
		<content:encoded><![CDATA[<p>i totally agree&#8230; and i have investigated in this issue. (you can search for my name on rails lists)</p>
<p>what i suggest is a sort of &#8216;ManagedRecord&#8217;:<br />
 &#8211; write your db schema in ruby code; inside your model<br />
 &#8211; let the &#8216;framework&#8217; generate migrations for you (when it encounters your models do not match with the db anymore &#8212; this should only work in development modes)<br />
 &#8211; have the attributes and the validations etc. all at one place (the model ruby code)</p>
<p>here a small example:</p>
<p><code><br />
class Author  /regex/<br />
  end<br />
end</p>
<p># [...]</p>
<p>class Post  3..100<br />
  end</p>
<p>  attribute :summary, :text<br />
  attribute :content, :text<br />
end<br />
</code></p>
<p>i did a small investigation and concluded that this could never be implemented inside (or as some sort of extention/plugin/etc to) ActiveRecord, because of technical difficulty and because of the rails not seeing the unDRYness as a problem.</p>
<p>that&#8217;s why: ManagedRecord will be needed.</p>
<p>i have no clue if Managed- and ActiveRecord could cooperate, of it it would be possible to maintain compatibillity with AR plugins. my guess: mostly likely not.</p>
<p>ManagedReocrd will put a lot more stress on the implementation of the database interface, it might also enable the developer to use stuff like database-side referential integrity (and other database features) with very little efford.</p>
<p>important: what happends if a ManagedRecord model is no longer matching the db?<br />
 &#8211; in development: an exception should be raised, and catched by the framework to start the auto generation and execution of a migration (this could be accomplished by a web based interface)<br />
 &#8211; in production: this should never happen! when the models are updated on a production server the migrations also have to update.</p>
<p>pfff&#8230;. long comment, i hope some one reads it.<br />
with questions, or further investigations: please mail me (cies,at;kde:dot.nl).</p>
<p>Cies Breijs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aral</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5418</link>
		<dc:creator>aral</dc:creator>
		<pubDate>Wed, 11 Oct 2006 09:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5418</guid>
		<description>Hi Dan,

The duplication is in having to manually define the schema when it can be inferred from the Model. RoR definitely gives you a whole lot for free -- this seems to be the main bit where I&#039;ve noticed any duplication.</description>
		<content:encoded><![CDATA[<p>Hi Dan,</p>
<p>The duplication is in having to manually define the schema when it can be inferred from the Model. RoR definitely gives you a whole lot for free &#8212; this seems to be the main bit where I&#8217;ve noticed any duplication.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Glegg</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5415</link>
		<dc:creator>Dan Glegg</dc:creator>
		<pubDate>Wed, 11 Oct 2006 09:09:41 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5415</guid>
		<description>It&#039;s not as unDRY as you&#039;d think. Rails is automatically coercing data between your field types and ruby native objects, which is defined by your database schema. You don&#039;t have to re-code any attributes except those which you want to place behaviour (such as validations, or relationships) on - which MySQL doesn&#039;t support anyway.

So it might seem like a pain, but in reality you&#039;re getting an awful lot for free.

*wanders off, whistling &quot;always look on the bright side&quot;</description>
		<content:encoded><![CDATA[<p>It&#8217;s not as unDRY as you&#8217;d think. Rails is automatically coercing data between your field types and ruby native objects, which is defined by your database schema. You don&#8217;t have to re-code any attributes except those which you want to place behaviour (such as validations, or relationships) on &#8211; which MySQL doesn&#8217;t support anyway.</p>
<p>So it might seem like a pain, but in reality you&#8217;re getting an awful lot for free.</p>
<p>*wanders off, whistling &#8220;always look on the bright side&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5414</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 11 Oct 2006 07:19:53 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5414</guid>
		<description>You might like to have a play with Django, I dont like fiddling with databases it takes me away from the warm cosy comfort of coding. :)

http://www.djangoproject.com/documentation/model_api/</description>
		<content:encoded><![CDATA[<p>You might like to have a play with Django, I dont like fiddling with databases it takes me away from the warm cosy comfort of coding. :)</p>
<p><a href="http://www.djangoproject.com/documentation/model_api/" rel="nofollow">http://www.djangoproject.com/documentation/model_api/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5413</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 11 Oct 2006 07:18:33 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5413</guid>
		<description>The Castle Project, i.e. MonoRail or &quot;.NET on rails&quot;, has an implementation of ActiveRecord similar to RoR, except the underlying technology is provided by NHibernate which does allow you to create your database schema automatically from your attribute-based object markup.  It&#039;s an enormous timesaver during early-stage development when your data structures are constantly being refactored!</description>
		<content:encoded><![CDATA[<p>The Castle Project, i.e. MonoRail or &#8220;.NET on rails&#8221;, has an implementation of ActiveRecord similar to RoR, except the underlying technology is provided by NHibernate which does allow you to create your database schema automatically from your attribute-based object markup.  It&#8217;s an enormous timesaver during early-stage development when your data structures are constantly being refactored!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thom Shannon</title>
		<link>http://aralbalkan.com/764/comment-page-1#comment-5392</link>
		<dc:creator>Thom Shannon</dc:creator>
		<pubDate>Tue, 10 Oct 2006 23:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/764#comment-5392</guid>
		<description>I&#039;m having the same problems trying to find a decent ORM for .net, you basically have to design your object model in the db and code gen it into your DAO layer if you want a quick and easy way. But then you ROR kids aren&#039;t interested in that stuff ;)</description>
		<content:encoded><![CDATA[<p>I&#8217;m having the same problems trying to find a decent ORM for .net, you basically have to design your object model in the db and code gen it into your DAO layer if you want a quick and easy way. But then you ROR kids aren&#8217;t interested in that stuff ;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
