<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Four types of database abstraction layers</title>
	<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/</link>
	<description>Stay curious!</description>
	<pubDate>Sat, 17 May 2008 00:37:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Daniel Lathrop</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-2244</link>
		<author>Daniel Lathrop</author>
		<pubDate>Fri, 20 Oct 2006 23:08:08 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-2244</guid>
		<description>&lt;p&gt;This is really sharp. Looking forward to the ORM article. I think howere, there may be a contingent defense of type 3 ...  it is a &lt;i&gt;good thing&lt;/i&gt; for writing code that inovled schlepping data from one place to another.  After all, this kind of code tends not to neeed maximum efficiency and the simple fact that you are writing code to move data from one place to another means that you are functioning in a heterogenous data environment. In this situation, DBIx:Abstract is a real boon.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>This is really sharp. Looking forward to the ORM article. I think howere, there may be a contingent defense of type 3 &#8230;  it is a <i>good thing</i> for writing code that inovled schlepping data from one place to another.  After all, this kind of code tends not to neeed maximum efficiency and the simple fact that you are writing code to move data from one place to another means that you are functioning in a heterogenous data environment. In this situation, DBIx:Abstract is a real boon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GrantPalin.com &#187; Blog Archive &#187; Simple .NET data abstraction</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1595</link>
		<author>GrantPalin.com &#187; Blog Archive &#187; Simple .NET data abstraction</author>
		<pubDate>Thu, 24 Aug 2006 01:25:04 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1595</guid>
		<description>&lt;p&gt;[...] For related reading, I recently read an article  discussing four types of data abstraction layers, ranging from simple to complex, and points out their similarities and differences. For those interested in learning more about different data abstraction layers, this article is a good read. It also has several links to other related articles, so there&#8217;s a lot of reading to do on the subject! [...]&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>[&#8230;] For related reading, I recently read an article  discussing four types of data abstraction layers, ranging from simple to complex, and points out their similarities and differences. For those interested in learning more about different data abstraction layers, this article is a good read. It also has several links to other related articles, so there&#8217;s a lot of reading to do on the subject! [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1490</link>
		<author>Xaprb</author>
		<pubDate>Mon, 14 Aug 2006 15:06:31 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1490</guid>
		<description>&lt;p&gt;Funny you mention it because mine is called SqlConnection too :-)&lt;/p&gt;

&lt;p&gt;Maybe I'll get onto a train of thought here and actually post a couple more things I have drafted along these same lines -- my own code, my ORM article, and some neat things ORM-ish systems can actually be great for, such as an in-database, single-query ACL system.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Funny you mention it because mine is called SqlConnection too :-)</p>
<p>Maybe I&#8217;ll get onto a train of thought here and actually post a couple more things I have drafted along these same lines &#8212; my own code, my ORM article, and some neat things ORM-ish systems can actually be great for, such as an in-database, single-query ACL system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Pipes</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1489</link>
		<author>Jay Pipes</author>
		<pubDate>Mon, 14 Aug 2006 14:30:28 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1489</guid>
		<description>&lt;p&gt;I agree with Peter Z on this one, and I think the recent SqlConnection class I posted in the CacheEngine article is an example of a Type "1.5".  Nothing you don't need, real simple, lazy loading...  It's worked fast and true for me for years with only a few modifications needed for certain projects at certain times...  Also, over the years, I've used all of the different types of DBAL detailed above.  I've found, just through doing this stuff a while, that my personal taste is the Type 2 and below.  That doesn't mean that the others aren't good.  I think a lot of it often comes down to personal preference and what is more important to you, from a feature perspective...&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I agree with Peter Z on this one, and I think the recent SqlConnection class I posted in the CacheEngine article is an example of a Type &#8220;1.5&#8243;.  Nothing you don&#8217;t need, real simple, lazy loading&#8230;  It&#8217;s worked fast and true for me for years with only a few modifications needed for certain projects at certain times&#8230;  Also, over the years, I&#8217;ve used all of the different types of DBAL detailed above.  I&#8217;ve found, just through doing this stuff a while, that my personal taste is the Type 2 and below.  That doesn&#8217;t mean that the others aren&#8217;t good.  I think a lot of it often comes down to personal preference and what is more important to you, from a feature perspective&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1487</link>
		<author>Xaprb</author>
		<pubDate>Mon, 14 Aug 2006 11:07:32 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1487</guid>
		<description>&lt;p&gt;Peter, I wrote my own Type 2 system for PHP and have used it for many years, since I was so averse to PEAR.  I added some of those features into it when needed, so I see what you are saying.&lt;/p&gt;

&lt;p&gt;I enjoy my Type 2 (maybe 2.5 because it does have a feature to auto-generate an INSERT/UPDATE) system because it makes more sense for me to code with.  It works the way I think.  I've never tested, but I think it has barely any overhead.  But it also only connects to MySQL.  I never had to connect to anything else, so I only wrote one back-end.  If I were working with a system that I wanted to support several different databases, I'd write the new back-end, and then ship the product with two sets of queries.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Peter, I wrote my own Type 2 system for PHP and have used it for many years, since I was so averse to PEAR.  I added some of those features into it when needed, so I see what you are saying.</p>
<p>I enjoy my Type 2 (maybe 2.5 because it does have a feature to auto-generate an INSERT/UPDATE) system because it makes more sense for me to code with.  It works the way I think.  I&#8217;ve never tested, but I think it has barely any overhead.  But it also only connects to MySQL.  I never had to connect to anything else, so I only wrote one back-end.  If I were working with a system that I wanted to support several different databases, I&#8217;d write the new back-end, and then ship the product with two sets of queries.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1485</link>
		<author>Xaprb</author>
		<pubDate>Mon, 14 Aug 2006 10:58:34 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1485</guid>
		<description>&lt;p&gt;Hi Lukas,&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;You are also not writing code that will have horrible performance if you stick to portable ANSI SQL.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That is not true.  In every system I've worked with, there are examples of ANSI standard SQL queries -- and simple ones at that -- which are terribly optimized.  This is why I won't use auto-generated code for anything beyond a one-row select with a simple WHERE clause, and even then only if I know there's no way it will burn me.&lt;/p&gt;

&lt;p&gt;I agree that they help you in the common case, if your common case is those one-row selects.  As I mentioned at my previous job, there was about a 4-to-1 ratio of those in one specific system.  However, I've written other systems where the "common case" is between 100 and 5,000 lines of SQL.  I've done more systems like that than systems with one-row selects.&lt;/p&gt;

&lt;p&gt;As for "you minimize the effort required to port to a different product," again that's not a benefit for anything I have ever worked on.  Telling my bosses we should make it easy to switch from SQL Server to MySQL if we ever wanted to would have been hilarious.  The company ran on SQL Server.  They ported from a UNIX system to Windows ten or fifteen years ago, when they probably had 5% of their current codebase, and it took many, many years.  To port to anything else now would be completely impossible.  That may sound like an overstatement, but if you saw how huge the codebase is, you'd agree.  The portability argument in a company like that is completely irrelevant.  It's an enormous undertaking even to upgrade versions of SQL Server and make sure things don't break.  Nobody wants to hear about anything worse than that.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi Lukas,</p>
<blockquote><p>You are also not writing code that will have horrible performance if you stick to portable ANSI SQL.</p>
</blockquote>
<p>That is not true.  In every system I&#8217;ve worked with, there are examples of ANSI standard SQL queries &#8212; and simple ones at that &#8212; which are terribly optimized.  This is why I won&#8217;t use auto-generated code for anything beyond a one-row select with a simple WHERE clause, and even then only if I know there&#8217;s no way it will burn me.</p>
<p>I agree that they help you in the common case, if your common case is those one-row selects.  As I mentioned at my previous job, there was about a 4-to-1 ratio of those in one specific system.  However, I&#8217;ve written other systems where the &#8220;common case&#8221; is between 100 and 5,000 lines of SQL.  I&#8217;ve done more systems like that than systems with one-row selects.</p>
<p>As for &#8220;you minimize the effort required to port to a different product,&#8221; again that&#8217;s not a benefit for anything I have ever worked on.  Telling my bosses we should make it easy to switch from SQL Server to MySQL if we ever wanted to would have been hilarious.  The company ran on SQL Server.  They ported from a UNIX system to Windows ten or fifteen years ago, when they probably had 5% of their current codebase, and it took many, many years.  To port to anything else now would be completely impossible.  That may sound like an overstatement, but if you saw how huge the codebase is, you&#8217;d agree.  The portability argument in a company like that is completely irrelevant.  It&#8217;s an enormous undertaking even to upgrade versions of SQL Server and make sure things don&#8217;t break.  Nobody wants to hear about anything worse than that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Zaitsev</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1481</link>
		<author>Peter Zaitsev</author>
		<pubDate>Mon, 14 Aug 2006 08:39:26 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1481</guid>
		<description>&lt;p&gt;You seems to have missed type 1.5, that is what I typically use for my application :) &lt;/p&gt;

&lt;p&gt;Meaning you still keep interface like mysqli but extend it with goodness needed for your own application.  In my case I extend it with profiling logging, debugging, handling slave failure etc.     You also can extend it to do lazy connecting if you want to.&lt;/p&gt;

&lt;p&gt;Type 2 could be good but in PHP there was no fast uniform access for all databases for years. We'll see how PDO goes. Also I  surely do not care about code working with other databases - there would be many changes needed If I decide to do a switch as I'm actively using MySQL only feature. So I would rather adjust my isolated database access code in this case. &lt;/p&gt;

&lt;p&gt;One more good thing about such approach -  you can plug it in into third party code very easily,   Have got application which uses MySQLi object ? And it gets trivial to make this code go via your abstraction library.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>You seems to have missed type 1.5, that is what I typically use for my application :) </p>
<p>Meaning you still keep interface like mysqli but extend it with goodness needed for your own application.  In my case I extend it with profiling logging, debugging, handling slave failure etc.     You also can extend it to do lazy connecting if you want to.</p>
<p>Type 2 could be good but in PHP there was no fast uniform access for all databases for years. We&#8217;ll see how PDO goes. Also I  surely do not care about code working with other databases - there would be many changes needed If I decide to do a switch as I&#8217;m actively using MySQL only feature. So I would rather adjust my isolated database access code in this case. </p>
<p>One more good thing about such approach -  you can plug it in into third party code very easily,   Have got application which uses MySQLi object ? And it gets trivial to make this code go via your abstraction library.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lukas</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1480</link>
		<author>Lukas</author>
		<pubDate>Mon, 14 Aug 2006 06:33:21 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1480</guid>
		<description>&lt;p&gt;What should also be mentioned when talking about layers like these: They help you in the common case. So you probably are not writing 10-way joins most of the time. You are also not writing code that will have horrible performance if you stick to portable ANSI SQL. So these layers help you get done faster and in a more portable fashion for the common case.&lt;/p&gt;

&lt;p&gt;But obviously even if you use a DBAL you can put in some code that is RDBMS specific, or you can hand write some joins even if you use an ORM for those extreme cases. The result is that you get fast performance, fast development time and you minimize the effort required to port to a different product.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>What should also be mentioned when talking about layers like these: They help you in the common case. So you probably are not writing 10-way joins most of the time. You are also not writing code that will have horrible performance if you stick to portable ANSI SQL. So these layers help you get done faster and in a more portable fashion for the common case.</p>
<p>But obviously even if you use a DBAL you can put in some code that is RDBMS specific, or you can hand write some joins even if you use an ORM for those extreme cases. The result is that you get fast performance, fast development time and you minimize the effort required to port to a different product.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: me talking out loud</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1469</link>
		<author>me talking out loud</author>
		<pubDate>Sun, 13 Aug 2006 23:08:45 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1469</guid>
		<description>&lt;p&gt;[...] Found this article through planet MySQL. In it he goes over 4 different &#8220;types&#8221; of abstraction layers that typically are collectively called a &#8220;database abstraction layer&#8221; - though they are very different from one another. I found it an interesting read. [...]&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>[&#8230;] Found this article through planet MySQL. In it he goes over 4 different &#8220;types&#8221; of abstraction layers that typically are collectively called a &#8220;database abstraction layer&#8221; - though they are very different from one another. I found it an interesting read. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1468</link>
		<author>Xaprb</author>
		<pubDate>Sun, 13 Aug 2006 22:47:54 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/#comment-1468</guid>
		<description>&lt;p&gt;On further thought, still in reply to Lukas, I should point out that like any categorization scheme, mine is arbitrary and imperfect.  There's definitely an in-between for any library.  I don't mean to pigeon-hole any specific code library.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>On further thought, still in reply to Lukas, I should point out that like any categorization scheme, mine is arbitrary and imperfect.  There&#8217;s definitely an in-between for any library.  I don&#8217;t mean to pigeon-hole any specific code library.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
