<?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>Fremus.co.za &#187; ORM</title>
	<atom:link href="http://www.fremus.co.za/blog/tag/orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fremus.co.za/blog</link>
	<description>Demistifying Life and Web Development</description>
	<lastBuildDate>Sun, 27 Nov 2011 15:56:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Building a case for ORM</title>
		<link>http://www.fremus.co.za/blog/2009/09/building-a-case-for-orm/</link>
		<comments>http://www.fremus.co.za/blog/2009/09/building-a-case-for-orm/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 14:50:29 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=411</guid>
		<description><![CDATA[Okay, so I have been guilty in the past for not implementing any form of ORM (Object Relational Model) for some of the projects I have written. The main reason for this is/was that the projects I have worked on have never really used them. But the more I code the more I realise I [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so I have been guilty in the past for not implementing any form of ORM (Object Relational Model) for some of the projects I have written. The main reason for this is/was that the projects I have worked on have never really used them. But the more I code the more I realise I sometimes find myself re-coding the same stuff. I mean my understanding of an ORM tool is that it creates a set or sets of classes that map to one or more databases. But why is this beneficial and why does this improve my life as a developer. I started out by reading <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Object-relational_mapping?referer=');">this article on Wikipedia</a>, which is not as detailed as I had hoped, but I guess its a starting point, because it lead me to <a href="http://www.alachisoft.com/articles/orm.html" onclick="urchinTracker('/outgoing/www.alachisoft.com/articles/orm.html?referer=');">this article</a>. I also found <a href="http://www.lalitbhatt.com/tiki-index.php?page=Introduction+to+ORM" onclick="urchinTracker('/outgoing/www.lalitbhatt.com/tiki-index.php?page=Introduction+to+ORM&amp;referer=');">this article</a> and watched the video and from it got to understand that for the relational world to co-exist with the OO world several things need to be considered:</p>
<ul>
<li>Inheritance: In the OO world a User object might serve as a base class for users of type teacher or student. How do you map this relationship in the relational database? </li>
<li>Granularity: This happens if the classes do not match up to the tables in the database. You might for example have a situation where a User is associated to a country. In your database you might represent this as two tables, but in your class you might represent the country as a property or field of the User class. So there exists a mismatch. How do you map this situation?</li>
<li>Identity and Equality: Lets say you query a database for a User with ID 100. The result you get back will always point to user with ID 100. If you look at it from an OO perspective, will a User with ID point to the same object, or multiple instances of it?</li>
<li>Association (directionality): In an OO model you associate classes with each other by placing references in each class of the other. In a relational model you create the associations by placing a foreign key in a table.</li>
<li>Type systems: The types in a database are quite different from those in an OO environment. For instance a VARCHAR with a size of 100 is not the same as a string, because a string is dependant on the amount of memory available.</li>
</ul>
<p>I then read two StackOverflow topics, <a href="http://stackoverflow.com/questions/194147/are-there-good-reasons-not-to-use-an-orm" onclick="urchinTracker('/outgoing/stackoverflow.com/questions/194147/are-there-good-reasons-not-to-use-an-orm?referer=');">one here</a> and <a href="http://stackoverflow.com/questions/885974/reasons-for-not-using-an-orm" onclick="urchinTracker('/outgoing/stackoverflow.com/questions/885974/reasons-for-not-using-an-orm?referer=');">one here</a>. From what I could gather ORM&#8217;s are not great at performing bulk operations, but what they lack in that area they make up for in developer productivity. </p>
<p>I remember coming across an article that compared the performance between various ORM mappers on <a href="http://blog.dataobjects.net/2009/07/preliminary-orm-performance-comparison.html" onclick="urchinTracker('/outgoing/blog.dataobjects.net/2009/07/preliminary-orm-performance-comparison.html?referer=');">this website</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/09/building-a-case-for-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

