<?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>Meta Bates &#187; tests</title>
	<atom:link href="http://www.metabates.com/tag/tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.metabates.com</link>
	<description>The technical ramblings of Mark Bates.</description>
	<lastBuildDate>Sun, 15 Aug 2010 12:49:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fixtures v. Factories &#8211; Can&#8217;t We All Just Get Along?</title>
		<link>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/</link>
		<comments>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 12:49:37 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[factories]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=358</guid>
		<description><![CDATA[Testing in Ruby on Rails is incredibly easy. I mean stupidly easily. So easy that if you&#8217;re not doing it, you are a very, very bad developer and should re-evaluate your career choices. (Yes, I believe in testing that much!) One thing that is not all that easy, however, is object creation and populating your [...]]]></description>
			<content:encoded><![CDATA[<p>Testing in Ruby on Rails is incredibly easy. I mean stupidly easily. So easy that if you&#8217;re not doing it, you are a very, very bad developer and should re-evaluate your career choices. (Yes, I believe in testing that much!) One thing that is not all that easy, however, is object creation and populating your test database. Five years ago when I first started working with Rails the only options we had to get data into the database were fixtures, or hastily written &#8216;factory&#8217;-esque methods custom to each application.</p>
<p>Fixtures, for those who don&#8217;t know, are YAML files that contain YAML-ized versions of objects that then get loaded into the test database when you run your test suite. These objects can then be pulled back from the database during your tests. Sounds great, doesn&#8217;t it? Well, not everybody thinks so. One of the biggest problems with fixtures is they can very quickly get out of control. Keeping track of all the different scenarios your tests needs can get very confusing and frustrating to deal with.</p>
<p><img class="alignleft" title="Factory Workers" src="http://www.uni.edu/schneidj/webquests/adayinthelife/lotsofworkers.jpg" alt="" width="360" height="283" />So how do we fix this problem? Well, most developers have turned to using factories. Factories allow us to quickly build the data we need for each test, now the building of the data you need for your test is right there in a setup or before method. Easy to manage and keep track of. Now there are a plethora of different factory libraries meant to make this task nicer, a few of the popular ones are <a href="http://github.com/thoughtbot/factory_girl" target="_blank">Factory Girl</a>, <a href="http://github.com/notahat/machinist">Machinist</a>, and <a href="http://github.com/flogic/object_daddy" target="_blank">Object Daddy</a>. The problem with this approach, however, is that it can slow down your tests as you are building database objects for nearly every test, and as we all know, object creation and database inserting can be expensive.</p>
<p>So, what can we do to help solve both of these problems? Well, we can use both of these technologies. Together. Yeah, that&#8217;s right I&#8217;m saying you should use fixtures as well as factories. Sound crazy? Not really. Let me explain.</p>
<p>Most Rails applications have most, if not all, of their functionality behind a login. So whenever we&#8217;re testing some controller action that sites behind a login we need a user to login with. If we were using factories we would have a setup or before method that would create a new User object and save it to the database, and it would do that for every variant of the test, as well as every other test in our suite that needs a user object.</p>
<p>Why not, create one user object and use that repeatedly through our tests? What I like to do is stick one or two users in my fixtures, so that they&#8217;re there whenever I need one. I like to do this with most of my major models. Then, when I need to have some custom scenarios, I can break out the factories and build those custom scenarios.</p>
<p>So what does this achieve? Well, I&#8217;ve sped up my tests by already having a few objects in the database, and not having to create them (and roll them back) with each single test. I&#8217;ve also cleaned up my tests significantly by eliminating a lot of setup and/or before methods where these objects were being created. I&#8217;ve also eliminated the biggest problems with fixtures, that they can get overwhelming, because we are only keeping one or two objects in them and using factories for the rest.</p>
<p>I hoped this helped you to understand that we don&#8217;t have to throw the baby out with the bath water when it comes to fixtures and factories, we can use both. Not go forth and test! Test like your life depends on it (because it does!!).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CoverMe &#8211; Code Coverage for Ruby 1.9</title>
		<link>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/</link>
		<comments>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 17:49:44 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rcov]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=343</guid>
		<description><![CDATA[Ruby 1.9(.2) is an amazing language to develop applications in. It&#8217;s faster, more powerful, cleaner, and a huge improvement over Ruby 1.8.x. Because of those reasons every Ruby developer should move to this exciting new version of our language. When making a move of this size it&#8217;s important to have the right tools to help [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby 1.9(.2) is an amazing language to develop applications in. It&#8217;s faster, more powerful, cleaner, and a huge improvement over Ruby 1.8.x. Because of those reasons every Ruby developer should move to this exciting new version of our language.</p>
<div id="_mcePaste">When making a move of this size it&#8217;s important to have the right tools to help us along. Unfortunately, one of the most useful tools as a Ruby developer, <a href="http://github.com/relevance/rcov">RCov</a>, does not work with Ruby 1.9.</div>
<div id="_mcePaste">RCov, for those unfamiliar analyzes your code and tells you which part of your code was not executed. This is INCREDIBLY useful when hooked up to your test suite. While, it&#8217;s not the only metric you should use when determining how good your test coverage it, it certainly is a great first step to point out exactly which parts of your code haven&#8217;t been touched at all!</div>
<p>Enter <a href="http://github.com/markbates/cover_me">CoverMe</a>.</p>
<h2>History</h2>
<p>While working on a Ruby 1.9/Rails 3 project, and loving everything about it (except for the lack of RCov), I came across a <a href="http://engineering.attinteractive.com/2010/08/code-coverage-in-ruby-1-9/">post</a> by Aaron Patterson (of <a href="http://github.com/tenderlove/nokogiri">Nokogiri</a> fame). In this post he quickly outlined a very basic coverage tool using the new built-in Coverage module in Ruby 1.9.</p>
<p>After spending a morning playing with it, I was quickly able to grow the idea into something useful for the project. Later that day the company I was consulting for (<a href="http://www.biddingforgood.com">BiddingForGood.com</a>), and in particular their chief architect, <a href="http://twitter.com/stuartmg">Stuart Garner</a>, told me to take a day or two and clean it up and release it for the world to use, and so <a href="http://github.com/markbates/cover_me">here</a> it is.</p>
<h2>Features</h2>
<p>Here is a brief overview of the features of CoverMe:</p>
<h3>Index Page</h3>
<ul>
<li>Sortable column headers (File, Lines, Lines of Code, Tested %).</li>
<li>Searching/filtering by file name.</li>
<li>Filtering by coverage percent.</li>
<li>Color coded list of files to quickly see which ones are 100% covered, &gt; 90% covered, or less than 90% covered.</li>
<li>Large color coded average coverage percent, for quick reference.</li>
</ul>
<h3>Detail Page</h3>
<ul>
<li>Line by line coverage report</li>
<li>Color coded lines to quickly see which lines where executed and which ones were not.</li>
<li>Side by side viewing with the corresponding test/spec file (if one exists).</li>
</ul>
<p>See the <a href="http://github.com/markbates/cover_me">README</a> file for more information on installation and usage.</p>
<h2>Thanks</h2>
<p>I would just quickly like to give another quick thanks to Aaron Patterson for pointing out the Coverage module in Ruby 1.9 and inspiring this, hopefully, helpful little gem. Also another big thanks to Stuart Garner for pushing me to package this up and release it to the world.</p>
<h2>Screenshots</h2>

<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/detail_side_by_side/' title='detail_side_by_side'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/detail_side_by_side-150x150.png" class="attachment-thumbnail" alt="detail_side_by_side" title="detail_side_by_side" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/detail/' title='detail'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/detail-150x150.png" class="attachment-thumbnail" alt="detail" title="detail" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index_filter/' title='index_filter'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index_filter-150x150.png" class="attachment-thumbnail" alt="index_filter" title="index_filter" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index_search/' title='index_search'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index_search-150x150.png" class="attachment-thumbnail" alt="index_search" title="index_search" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index/' title='index'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index-150x150.png" class="attachment-thumbnail" alt="index" title="index" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Testing is NOT an Option</title>
		<link>http://www.metabates.com/2010/07/01/testing-is-not-an-option/</link>
		<comments>http://www.metabates.com/2010/07/01/testing-is-not-an-option/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 14:04:38 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=337</guid>
		<description><![CDATA[Five years ago I left the world of contracting and reentered the world of the full time employee, and I enjoyed every minute of it (well, almost). Now fast forward five years and I find myself once again at a crossroads. Do I continue on as an FTE or do I become a contractor, and [...]]]></description>
			<content:encoded><![CDATA[<p>Five years ago I left the world of contracting and reentered the world of the full time employee, and I enjoyed every minute of it (well, almost). Now fast forward five years and I find myself once again at a crossroads. Do I continue on as an FTE or do I become a contractor, and play the field, so to speak? Looks like I&#8217;m going to go with the hired gun route for a little while, but that&#8217;s not really the point of this post.</p>
<p>During the past week or so I&#8217;ve spoken with many great companies and people. I&#8217;ve been fortunate enough to have a high degree of interest in what I can bring to the table. During those discussions I talked with a really nice guy at a what seems to be a really cool company, I won&#8217;t name names, because this isn&#8217;t about either the person or the company, but rather something the engineer said during our phone conversation that got me to thinking.</p>
<p><img class="alignleft" title="Failure Testing" src="http://www.commercialventvac.com/finao/failure_testing.jpg" alt="" width="400" height="240" />&#8220;We don&#8217;t have any tests because I couldn&#8217;t convince the company to allocate the time for them.&#8221; That statement really hung with me. After I got off the phone I started thinking really hard about that statement, and all I could think of was how testing is not an option and people shouldn&#8217;t need to be convinced to have time allocated to them.</p>
<p>As developers it is our responsibility to insist on testing. Always include testing in your time estimates. Never give the client (or your company) an option that includes a time estimate without testing. If a feature takes 2 days to code and a day to write tests, then your estimate is 3 days, never 2. You should never say, &#8220;Well, I can get it done in two days if I don&#8217;t write any tests.&#8221; That&#8217;s just an unacceptable thing to say. What you should be saying is, &#8220;That feature will take three days to code&#8221;.</p>
<p>I don&#8217;t feel I should sit here and tell you all the reasons why you should test, you should know them already, and frankly, they&#8217;re all very obvious! But, if you need a few bullet points to &#8216;convince&#8217; your client, here are a few:</p>
<ul>
<li>Less bugs &#8211; The more tests you have the less bugs you will have. It&#8217;s just a fact. You won&#8217;t have 100% bug free code, that&#8217;s a nearly impossible goal, but you highly reduce the likely hood that as soon as you get your code into production your users will find all the breaking points of your code.</li>
<li>Better maintainability, means faster feature turn around &#8211; When you have a large test suite it means adding, updating, or even removing features because a whole lot easier, which means it SAVES time! Why? Simple, you don&#8217;t have to go through and manually test every aspect of your code to make sure you didn&#8217;t break something elsewhere by adding that validation, or by refactoring that bit of code, etc&#8230; That translates into real $ savings.</li>
<li>Test driven development saves time &#8211; this isn&#8217;t quite the same as my last bullet point. Imagine, if you will, you are writing a four step wizard in your application. If you write a few test scripts using something like Cucumber first before you write your code you can simply keep re-running those to make sure your code is working. If you don&#8217;t have those test scripts written then you continually have to keep going to a browser and entering all the information in each of the steps so you can test something in step four. Which one do you think takes longer, having a few test scripts you can run, or manually going through the four page wizard each time you make a change?</li>
<li>It&#8217;s an investment &#8211; thinking of having test scripts like owning a house. When you don&#8217;t have tests and you just keep testing in the browser or the command line what you are doing is a kin to &#8220;renting&#8221;. There is money being spent, but at the end of the day you have nothing to show for it. You&#8217;ve spent hours &#8220;testing&#8221;, but tomorrow when you come in you have to do it all over again. When you spend those hours writing tests you are actually &#8220;buying&#8221; something. You have something to show for that time and money you&#8217;ve spent. Tomorrow, next week, next month, next year, those scripts will still be there, they&#8217;ll still be working for you, giving  you a return on your investment.</li>
</ul>
<p>Well, I hope I have hopefully made a case to you the engineer as to why you should insist on testing. It&#8217;s the right thing to do, for you, for your application and for you client. If if anyone tries to give you grief about it, send them my way, I&#8217;ll sort em out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/07/01/testing-is-not-an-option/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Temporary fix for the DataMapper bug</title>
		<link>http://www.metabates.com/2008/04/09/temporary-fix-for-the-datamapper-bug/</link>
		<comments>http://www.metabates.com/2008/04/09/temporary-fix-for-the-datamapper-bug/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 01:36:49 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[data mapper]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=56</guid>
		<description><![CDATA[If like me you&#8217;re plagued by this DataMapper bug that kills your test cases. I&#8217;ve packaged up a temporary version of the DataMapper gem that seems to fix the problem. WARNING: This gem is NOT sanctioned by the DataMapper team. Use at your own risk. If you use this gem and find any issues, please [...]]]></description>
			<content:encoded><![CDATA[<p>If like me you&#8217;re plagued by this DataMapper bug that kills your test cases. I&#8217;ve packaged up a temporary version of the DataMapper gem that seems to fix the problem.</p>
<p>WARNING: This gem is NOT sanctioned by the DataMapper team. Use at your own risk.</p>
<p>If you use this gem and find any issues, please let me know. Also, if you use this gem and things seem to be working just fine, then please let me know that too. Good luck!</p>
<p><a href="http://www.mackframework.com/wp-content/uploads/2008/04/datamapper-0301gem.zip">DataMapper-0.3.0.1.gem</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/04/09/temporary-fix-for-the-datamapper-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Horrible bug in DataMapper 0.3.0</title>
		<link>http://www.metabates.com/2008/04/09/horrible-bug-in-datamapper-030/</link>
		<comments>http://www.metabates.com/2008/04/09/horrible-bug-in-datamapper-030/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 16:14:19 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[comparable]]></category>
		<category><![CDATA[data mapper]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=53</guid>
		<description><![CDATA[http://wm.lighthouseapp.com/projects/4819-datamapper/tickets/185-including-comparable-in-class-class-breaks-test-unit-and-probably-more#ticket-185-8 In the gem at the bottom of lib/data_mapper/support/typed_set.rb there is the following code: class Class Â Â include Comparable Â Â def &#60;=&#62;(other) Â Â  Â name &#60;=&#62; other.name Â Â end end This causese Test::Runner to through up an error similar to this: /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:25:in `collect': undefined method `suite' for Gem::LoadError:Class (NoMethodError) from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `each_object' from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `collect' from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:58 from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:213:in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wm.lighthouseapp.com/projects/4819-datamapper/tickets/185-including-comparable-in-class-class-breaks-test-unit-and-probably-more#ticket-185-8" target="_blank">http://wm.lighthouseapp.com/projects/4819-datamapper/tickets/185-including-comparable-in-class-class-breaks-test-unit-and-probably-more#ticket-185-8</a></p>
<p>In the gem at the bottom of lib/data_mapper/support/typed_set.rb there is the following code:</p>
<pre>class Class
Â Â include Comparable
Â Â def &lt;=&gt;(other)
Â Â  Â name &lt;=&gt; other.name
Â Â end
end</pre>
<p>This causese Test::Runner to through up an error similar to this:</p>
<pre>/usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:25:in `collect': undefined method `suite' for Gem::LoadError:Class (NoMethodError)
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `each_object'
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `collect'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:58
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:213:in `[]'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:213:in `run'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /usr/local/lib/ruby/1.8/test/unit.rb:278
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5
rake aborted!</pre>
<p>It also causes your tests to blow up and not run. Which, if you&#8217;re trying to do any development causes some real problems! If you comment out &#8216;include Comparable&#8217; from Class things seem to work just fine. I say seem, because I haven&#8217;t done any real extensive testing with this. The other thing you can do is revert to 0.2.5, but that&#8217;s up to you. Either way, it&#8217;s not really optimal. Let&#8217;s hope they fix this soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/04/09/horrible-bug-in-datamapper-030/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s talk DataMapper</title>
		<link>http://www.metabates.com/2008/04/07/lets-talk-data-mapper/</link>
		<comments>http://www.metabates.com/2008/04/07/lets-talk-data-mapper/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 19:19:08 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[data mapper]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=50</guid>
		<description><![CDATA[As you may, or may not know, DataMapper is the new ORM framework on the scene these days in the Ruby world. It&#8217;s getting a lot of hype for being clean, fast, simple, and feature rich. Oh, and it&#8217;s not ActiveRecord. I think that seems to be the real thing that is driving people to [...]]]></description>
			<content:encoded><![CDATA[<p>As you may, or may not know, DataMapper is the new ORM framework on the scene these days in the Ruby world. It&#8217;s getting a lot of hype for being clean, fast, simple, and feature rich. Oh, and it&#8217;s not ActiveRecord. I think that seems to be the real thing that is driving people to DataMapper, the fact that it&#8217;s not ActiveRecord.</p>
<p>I will say DataMapper is clean, simple, and feature rich. In 0.3.0 they&#8217;ve added migrations, which is great. Btw, a little off topic, but I&#8217;m working on migration support for both ActiveRecord and DataMapper in Mack as we speak. It should, hopefully, be out sometime this week. What I won&#8217;t give DataMapper is that it&#8217;s fast. In my tests, and I&#8217;ll provide some number below, DataMapper only seems to win on inserts, after that ActiveRecord beats it hands down. In all fairness to DataMapper I&#8217;m starting to think that the problems are not at the DataMapper layer, but at the underlying Data Objects layer that DataMapper uses. As you&#8217;ll see from my tests DataMapper seems very heavilyÂ optimizedÂ towards MySQL over PostgreSQL. This, to me, leans towards a difference in the underlying adapters.</p>
<p>Another problem I have with DataMapper is that I have to set the &#8216;properties&#8217; of the model inside the model itself. It&#8217;s an old school approach, and it does have the benefit of being self documenting, but it also has the drawbacks of constantÂ maintenanceÂ and clutter at the top of your model. Not to mention potential conflicts when running through migrations, etc&#8230;</p>
<p>I&#8217;m also having one other little problem these days. This has only been a problem since I&#8217;ve gone DataMapper 0.3.0. At the end of some of rake tasks, if I have DataMapper required, I get this:</p>
<p>Â </p>
<pre>/usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:25:in `collect': undefined method `suite' for Gem::VerificationError:Class (NoMethodError)
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `each_object'
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:23:in `collect'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:58
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:213:in `[]'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:213:in `run'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /usr/local/lib/ruby/1.8/test/unit.rb:278</pre>
<p>The rake task completed successfully, but I get this fairly random error message. If anyone out there is also getting this message, please let me know what it is. I&#8217;m open for ideas on this one.</p>
<p>Despite these issues I have with DataMapper, I&#8217;m going to keep striving to provide support for both it and ActiveRecord in Mack. I think it&#8217;s important to give people a choice and not force them to use the one I think is either easier to code for, or better. Both of which I&#8217;m not saying about ActiveRecord, but in technologies in general.</p>
<p>Anyway, enough of my blather, here are the test results I was speaking about:</p>
<p>Â </p>
<p><span style="color: #800000;">Running time 1.693881 seconds. [MESSAGE]: DM: postgresql: Inserts</span><br />
Running time 2.799189 seconds. [MESSAGE]: AR: postgresql: Inserts</p>
<p>Running time 1.368185 seconds. [MESSAGE]: DM: postgresql: Individual Reads<br />
<span style="color: #800000;">Running time 0.734143 seconds. [MESSAGE]: AR: postgresql: Individual Reads</span></p>
<p>Running time 0.917551 seconds. [MESSAGE]: DM: postgresql: Bulk Reads<br />
<span style="color: #800000;">Running time 0.121198 seconds. [MESSAGE]: AR: postgresql: Bulk Reads</span></p>
<p>Running time 2.309244 seconds. [MESSAGE]: DM: postgresql: Updates<br />
<span style="color: #800000;">Running time 2.079578 seconds. [MESSAGE]: AR: postgresql: Updates</span></p>
<p>Running time 1.802914 seconds. [MESSAGE]: DM: postgresql: Deletes<br />
<span style="color: #800000;">Running time 1.708714 seconds. [MESSAGE]: AR: postgresql: Deletes</span></p>
<p><span style="color: #800000;">Running time 0.433761 seconds. [MESSAGE]: DM: mysql: Inserts</span><br />
Running time 2.621093 seconds. [MESSAGE]: AR: mysql: Inserts</p>
<p>Running time 1.073741 seconds. [MESSAGE]: DM: mysql: Individual Reads<br />
<span style="color: #800000;">Running time 0.207305 seconds. [MESSAGE]: AR: mysql: Individual Reads</span></p>
<p>Running time 0.827842 seconds. [MESSAGE]: DM: mysql: Bulk Reads<br />
<span style="color: #800000;">Running time 0.073593 seconds. [MESSAGE]: AR: mysql: Bulk Reads</span></p>
<p><span style="color: #800000;">Running time 1.204845 seconds. [MESSAGE]: DM: mysql: Updates</span><br />
Running time 1.738602 seconds. [MESSAGE]: AR: mysql: Updates</p>
<p><span style="color: #800000;">Running time 1.010774 seconds. [MESSAGE]: DM: mysql: Deletes</span><br />
Running time 1.251691 seconds. [MESSAGE]: AR: mysql: Deletes</p>
<p>Â </p>
<p>Â </p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/04/07/lets-talk-data-mapper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.355 seconds -->
