<?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/"
		>
<channel>
	<title>Comments on: Barney and the Holy Grail</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-161823</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Mon, 09 Feb 2009 16:34:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-161823</guid>
		<description>Haven&#039;t in a long while.  It&#039;s hard to dive heavily into tech that I can&#039;t use at work, ya know?  And now with CFGroovy providing seamless inline Groovy scripting and Hibernate support to CFML apps, the benefits are even less.</description>
		<content:encoded><![CDATA[<p>Haven't in a long while.  It's hard to dive heavily into tech that I can't use at work, ya know?  And now with CFGroovy providing seamless inline Groovy scripting and Hibernate support to CFML apps, the benefits are even less.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bell</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-161820</link>
		<dc:creator>Peter Bell</dc:creator>
		<pubDate>Mon, 09 Feb 2009 16:21:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-161820</guid>
		<description>Hi Barney,

Just wondering if you still play around with Grails these days?
Peter</description>
		<content:encoded><![CDATA[<p>Hi Barney,</p>
<p>Just wondering if you still play around with Grails these days?<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marnen Laibow-Koser</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-124964</link>
		<dc:creator>Marnen Laibow-Koser</dc:creator>
		<pubDate>Thu, 18 Sep 2008 20:08:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-124964</guid>
		<description>OK, now I see your point. There are two issues here, then: query syntax and decoupling entity names from the database.

Query syntax is less problematic then you seem to suppose. Even without using find_by_sql, Rails has dynamic finder methods that will cover even fairly complex cases (you can do things like find_by_first_name_and_zip_code if you really need to, for example).

As far as entity names go, it&#039;s easy to use set_table_name and set_primary_key to tell Rails that the names of the table and primary key field are not what you&#039;d think from the class name, so the only stumbling block is the attribute names. It&#039;s not well known, but a little digging unearthed the alias_attribute method, which allows you to easily create an alias for any attribute, so that you can do

class Customer &lt; ActiveRecord::Base
  set_table_name &#039;tbl_Customrz&#039;
  set_primary_key &#039;int_cust_id&#039;

  alias_attribute :name, :varchar_firstname_lastname
end

This will let you read and write to Customer#name. That leaves dynamic finder methods as the only real issue -- in the current version (2.1.0), they don&#039;t appear to work with aliased attributes, but there&#039;s a patch at http://dev.rubyonrails.org/ticket/11354 that apparently fixes that problem (although I haven&#039;t tried it).

For one model made up of multiple tables, I would probably just create a DB view, or an abstraction layer of mediating objects. composed_of might come in handy here.

My point, then, is that Rails ActiveRecord does indeed have a suitable query language that can be uncoupled from the database. You don&#039;t hear much about it because Rails developers don&#039;t tend to use it that way, but it *does* exist.</description>
		<content:encoded><![CDATA[<p>OK, now I see your point. There are two issues here, then: query syntax and decoupling entity names from the database.</p>
<p>Query syntax is less problematic then you seem to suppose. Even without using find_by_sql, Rails has dynamic finder methods that will cover even fairly complex cases (you can do things like find_by_first_name_and_zip_code if you really need to, for example).</p>
<p>As far as entity names go, it's easy to use set_table_name and set_primary_key to tell Rails that the names of the table and primary key field are not what you'd think from the class name, so the only stumbling block is the attribute names. It's not well known, but a little digging unearthed the alias_attribute method, which allows you to easily create an alias for any attribute, so that you can do</p>
<p>class Customer &lt; ActiveRecord::Base<br />
  set_table_name 'tbl_Customrz'<br />
  set_primary_key 'int_cust_id'</p>
<p>  alias_attribute :name, :varchar_firstname_lastname<br />
end</p>
<p>This will let you read and write to Customer#name. That leaves dynamic finder methods as the only real issue &#8212; in the current version (2.1.0), they don't appear to work with aliased attributes, but there's a patch at <a href="http://dev.rubyonrails.org/ticket/11354" rel="nofollow">http://dev.rubyonrails.org/ticket/11354</a> that apparently fixes that problem (although I haven't tried it).</p>
<p>For one model made up of multiple tables, I would probably just create a DB view, or an abstraction layer of mediating objects. composed_of might come in handy here.</p>
<p>My point, then, is that Rails ActiveRecord does indeed have a suitable query language that can be uncoupled from the database. You don't hear much about it because Rails developers don't tend to use it that way, but it *does* exist.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-124945</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 18 Sep 2008 18:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-124945</guid>
		<description>Marnen,

The distiction is that with SQL you have to understand the tables and columns, while with HQL (for example) you have to understand your classes and properties.  Maybe I&#039;ve got some nasty mappings to a legacy schema, or I need to segment a single entity into three tables for performance, or my DBA&#039;s are crazy and insist that all tables start with &quot;TBL_&quot; and columns use Hungarian Notation.  All of these things should be transparent to the application: that&#039;s the point of ORM.  But by using SQL I&#039;m forced to deal with them.  Using HQL, which is above the ORM layer, ensures that all that garbage stays hidden from the application.  This is a hugely powerful distinction that often doesn&#039;t make much of a case for itself in simple applications, particularly top-to-bottom one.  

You also save yourself from any database-specific stuff, which I&#039;ve found incredibly useful because I can use Hypersonic (a crazy fast, in-JVM, memory-only DB) for unit tests, but deploy to a real DB without having to care about dialect differences.</description>
		<content:encoded><![CDATA[<p>Marnen,</p>
<p>The distiction is that with SQL you have to understand the tables and columns, while with HQL (for example) you have to understand your classes and properties.  Maybe I've got some nasty mappings to a legacy schema, or I need to segment a single entity into three tables for performance, or my DBA's are crazy and insist that all tables start with "TBL_" and columns use Hungarian Notation.  All of these things should be transparent to the application: that's the point of ORM.  But by using SQL I'm forced to deal with them.  Using HQL, which is above the ORM layer, ensures that all that garbage stays hidden from the application.  This is a hugely powerful distinction that often doesn't make much of a case for itself in simple applications, particularly top-to-bottom one.  </p>
<p>You also save yourself from any database-specific stuff, which I've found incredibly useful because I can use Hypersonic (a crazy fast, in-JVM, memory-only DB) for unit tests, but deploy to a real DB without having to care about dialect differences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marnen Laibow-Koser</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-124941</link>
		<dc:creator>Marnen Laibow-Koser</dc:creator>
		<pubDate>Thu, 18 Sep 2008 17:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-124941</guid>
		<description>As far as I can tell, you&#039;re right that Rails ActiveRecord doesn&#039;t really support queries of the conceptual object store *as distinct from the database*, but I&#039;m not convinced that that&#039;s a problem. I&#039;m not really sure how this feature would be useful in Rails in actual practice. I think there&#039;s a feeling that the database *is* the conceptual object store, for all practical purposes. Besides, the ORM is complete enough that it&#039;s trivial to add objects to and remove objects from the database as necessary, and this way there&#039;s no issue of persistence.

If I understand correctly what you mean by &quot;business-model-centric way of querying&quot;, it should be possible to add that to your Rails models quite easily.

Also remember that Ruby classes are always open. It probably wouldn&#039;t be *that* difficult to extend Rails ActiveRecord to do Hibernate-style queries, although no one has done it so far as I can tell.

Or am I misunderstanding?</description>
		<content:encoded><![CDATA[<p>As far as I can tell, you're right that Rails ActiveRecord doesn't really support queries of the conceptual object store *as distinct from the database*, but I'm not convinced that that's a problem. I'm not really sure how this feature would be useful in Rails in actual practice. I think there's a feeling that the database *is* the conceptual object store, for all practical purposes. Besides, the ORM is complete enough that it's trivial to add objects to and remove objects from the database as necessary, and this way there's no issue of persistence.</p>
<p>If I understand correctly what you mean by "business-model-centric way of querying", it should be possible to add that to your Rails models quite easily.</p>
<p>Also remember that Ruby classes are always open. It probably wouldn't be *that* difficult to extend Rails ActiveRecord to do Hibernate-style queries, although no one has done it so far as I can tell.</p>
<p>Or am I misunderstanding?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-74405</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 10 Apr 2008 15:06:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-74405</guid>
		<description>Marnen,

Groovy doesn&#039;t have any sort of ORM framework itself, though it does have a slick-seeming SQL interface.  I haven&#039;t actually used it, so I can&#039;t say for sure though.

Grails uses Hibernate under the hood, so you have access to the full Hibernate stack, including HQL.  I suppose picking up the dialect is a bit of work, but it&#039;s never been an issue for me, even when starting.  More troubling is thinking in terms of querying objects, rather than tables.  That&#039;s a conceptual hurdle that took me a while to get my head around (and I still sometimes butt up against).  However it does allow a far more business-model-centric way of querying which is quite nice, as well as providing an abstraction layer that allows you to extend the query language in an application-specific (and DB neutral) way.

When I said ActiveRecord didn&#039;t have a query language, I was referring specifically to querying the conceptual object store to select instances.  find_by_sql doesn&#039;t even come close to that: it&#039;s nothing more than a way to do raw SQL queries against the DB connection configured for ActiveRecord.  It&#039;s really more analogous to getting a Connection object from Hibernate and doing SQL against it (using Groovy&#039;s SQL stuff, or plain JDBC).</description>
		<content:encoded><![CDATA[<p>Marnen,</p>
<p>Groovy doesn't have any sort of ORM framework itself, though it does have a slick-seeming SQL interface.  I haven't actually used it, so I can't say for sure though.</p>
<p>Grails uses Hibernate under the hood, so you have access to the full Hibernate stack, including HQL.  I suppose picking up the dialect is a bit of work, but it's never been an issue for me, even when starting.  More troubling is thinking in terms of querying objects, rather than tables.  That's a conceptual hurdle that took me a while to get my head around (and I still sometimes butt up against).  However it does allow a far more business-model-centric way of querying which is quite nice, as well as providing an abstraction layer that allows you to extend the query language in an application-specific (and DB neutral) way.</p>
<p>When I said ActiveRecord didn't have a query language, I was referring specifically to querying the conceptual object store to select instances.  find_by_sql doesn't even come close to that: it's nothing more than a way to do raw SQL queries against the DB connection configured for ActiveRecord.  It's really more analogous to getting a Connection object from Hibernate and doing SQL against it (using Groovy's SQL stuff, or plain JDBC).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marnen Laibow-Koser</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-74401</link>
		<dc:creator>Marnen Laibow-Koser</dc:creator>
		<pubDate>Thu, 10 Apr 2008 14:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-74401</guid>
		<description>I just wanted to comment on something you said about Rails ActiveRecord. Like you, I&#039;ve switched away from CF for a variety of reasons; unlike you, I&#039;m currently using Rails, and I very much like Ruby&#039;s syntax -- it&#039;s certainly different from a lot of other languages, but I think it&#039;s extremely well designed.

Anyway, you said that ActiveRecord doesn&#039;t have a query language. If I understand correctly what you&#039;re getting at, that&#039;s not quite true, at least in the sense that you can pass native SQL code to ActiveRecord.find_by_sql . There&#039;s certainly nothing in Rails like EJBQL, but to my mind that&#039;s OK -- who needs to learn yet &lt;em&gt;another&lt;/em&gt; dialect of SQL?

How does Groovy deal with this? I&#039;ve never worked with it, although my last job	was with a company that created what as far as they knew was the largest Groovy project to date. But I wasn&#039;t working on that project.</description>
		<content:encoded><![CDATA[<p>I just wanted to comment on something you said about Rails ActiveRecord. Like you, I've switched away from CF for a variety of reasons; unlike you, I'm currently using Rails, and I very much like Ruby's syntax &#8212; it's certainly different from a lot of other languages, but I think it's extremely well designed.</p>
<p>Anyway, you said that ActiveRecord doesn't have a query language. If I understand correctly what you're getting at, that's not quite true, at least in the sense that you can pass native SQL code to ActiveRecord.find_by_sql . There's certainly nothing in Rails like EJBQL, but to my mind that's OK &#8212; who needs to learn yet <em>another</em> dialect of SQL?</p>
<p>How does Groovy deal with this? I've never worked with it, although my last job	was with a company that created what as far as they knew was the largest Groovy project to date. But I wasn't working on that project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-60552</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Wed, 13 Feb 2008 17:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-60552</guid>
		<description>Mike,

Eight years ago, CF was awesome.  It blew the pants off other languages available for developing web apps quickly and easily.  These days, it&#039;s a far less compelling choice.  I doubt it&#039;s market share has diminished, but I feel that it&#039;s relevance has.

I wasn&#039;t referring specifically to Grails as the reason for it; I&#039;ve had that opinion for quite a while.  There are a whole pile of web toolkits out there now, and they&#039;re breaking some cool new ground.  I wouldn&#039;t care to use a number of them, but I do appreciate what they&#039;re doing.  CF, on the other hand, has done little.  CFC&#039;s were a step in the right direction, but the implementation is poor in many ways.  Other than that, almost all improvements have just been reinventing the wheel with CFML syntax, and often in a very limited way (consider the mess that is CFTHREAD, or the breaking of CFMAIL when CFMAILPARAM was added).</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>Eight years ago, CF was awesome.  It blew the pants off other languages available for developing web apps quickly and easily.  These days, it's a far less compelling choice.  I doubt it's market share has diminished, but I feel that it's relevance has.</p>
<p>I wasn't referring specifically to Grails as the reason for it; I've had that opinion for quite a while.  There are a whole pile of web toolkits out there now, and they're breaking some cool new ground.  I wouldn't care to use a number of them, but I do appreciate what they're doing.  CF, on the other hand, has done little.  CFC's were a step in the right direction, but the implementation is poor in many ways.  Other than that, almost all improvements have just been reinventing the wheel with CFML syntax, and often in a very limited way (consider the mess that is CFTHREAD, or the breaking of CFMAIL when CFMAILPARAM was added).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Brunt</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-60548</link>
		<dc:creator>Mike Brunt</dc:creator>
		<pubDate>Wed, 13 Feb 2008 16:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-60548</guid>
		<description>I hate to drag out a discussion Barney but why do you believe that CF&#039;s relevance is waning?  This is a genuine question because from my end of things in the server tuning business I see large entities that were not CF users needing help.  Also I don&#039;t see any of the associated companies pulling back or financially in trouble (New Atlanta for instance).  None of the companies which were spawned from the Macromedia Consulting division have gone.  Webapper, Universal Mind etc, in fact Universal Mind were recently listed in the Fortune 500.

I have no doubt that Groovy and/on Grails is an exciting track to go down but I am not sure that relates to CF being less relevant; just my opinion from indicators that I see.  Thanks again.</description>
		<content:encoded><![CDATA[<p>I hate to drag out a discussion Barney but why do you believe that CF's relevance is waning?  This is a genuine question because from my end of things in the server tuning business I see large entities that were not CF users needing help.  Also I don't see any of the associated companies pulling back or financially in trouble (New Atlanta for instance).  None of the companies which were spawned from the Macromedia Consulting division have gone.  Webapper, Universal Mind etc, in fact Universal Mind were recently listed in the Fortune 500.</p>
<p>I have no doubt that Groovy and/on Grails is an exciting track to go down but I am not sure that relates to CF being less relevant; just my opinion from indicators that I see.  Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/comment-page-1/#comment-60467</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Wed, 13 Feb 2008 07:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2008/02/11/barney-and-the-holy-grail/#comment-60467</guid>
		<description>Sean,

I&#039;m not going to call it either way, but Grails definitely provides a lot of stuff that a certain set of CF developers have been crying out for, and does it without requiring as large a shift as other alternatives.  I haven&#039;t done it, but I see no reason that you couldn&#039;t easily build a hybrid CF/Groovy/Grails app, and with enormously less pain than CF/Java hybrids.

I know I&#039;m going to be doing CF for a good while since Mentor&#039;s heavily entrenched.  CF&#039;s relevance is definitely waning (regardless of Adobe&#039;s sales figures).  Perhaps an influx of good ideas could buoy it.</description>
		<content:encoded><![CDATA[<p>Sean,</p>
<p>I'm not going to call it either way, but Grails definitely provides a lot of stuff that a certain set of CF developers have been crying out for, and does it without requiring as large a shift as other alternatives.  I haven't done it, but I see no reason that you couldn't easily build a hybrid CF/Groovy/Grails app, and with enormously less pain than CF/Java hybrids.</p>
<p>I know I'm going to be doing CF for a good while since Mentor's heavily entrenched.  CF's relevance is definitely waning (regardless of Adobe's sales figures).  Perhaps an influx of good ideas could buoy it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
