<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dynamic and Concise &#187; programming</title>
	<atom:link href="http://yiwenandsoftware.wordpress.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://yiwenandsoftware.wordpress.com</link>
	<description>Everything about my experience with Software Development</description>
	<lastBuildDate>Sat, 14 Mar 2009 22:05:25 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='yiwenandsoftware.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/fa9ad49ca1c5d02890788e46a95fe979?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Dynamic and Concise &#187; programming</title>
		<link>http://yiwenandsoftware.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://yiwenandsoftware.wordpress.com/osd.xml" title="Dynamic and Concise" />
		<item>
		<title>Less is Better</title>
		<link>http://yiwenandsoftware.wordpress.com/2008/02/25/less-is-better/</link>
		<comments>http://yiwenandsoftware.wordpress.com/2008/02/25/less-is-better/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 20:43:57 +0000</pubDate>
		<dc:creator>Yi Wen</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[ruby o rails]]></category>

		<guid isPermaLink="false">http://yiwenandsoftware.wordpress.com/?p=23</guid>
		<description><![CDATA[A great blog post by Szczepan Faber talked about 10 rules of unit testing. In this post, I want to discuss on the second rule in his post, which is: &#8220;It’s not only about test code but I need to say that anyway: Best improvements are those that remove code. Be budget-driven. Improve by removing. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yiwenandsoftware.wordpress.com&blog=2109631&post=23&subd=yiwenandsoftware&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://monkeyisland.pl/2008/01/31/10rules/">A great blog post</a> by Szczepan Faber talked about 10 rules of unit testing. In this post, I want to discuss on the second rule in his post, which is: &#8220;It’s not only about test code but I need to say that anyway: Best improvements are those that remove code. Be budget-driven. Improve by removing. The only thing better than simple code is no code.&#8221;</p>
<p>To me, it means one fundamental thinking in coding in general, that is, &#8220;do the simplest thing that could possibly work&#8221;. I also refer this rule as <a href="http://en.wikipedia.org/wiki/Occam%27s_Razor">Occam&#8217;s Razor</a>.</p>
<p>This rule can apply to Rails migrations strategy as well. If your application is already in production, then you have no choice but using migrations. But if it&#8217;s still in development, I always avoid to add a migration script for any tiny change to my schema, instead, I would just change existing migration scripts. </p>
<p>So the rule for doing migration becomes: for each table, or tables associated by their function areas gets their own migration. To make changes, modify your scripts. For example, if I change column name from user_id to login_id, I will just change my script from
<pre>t.integer :user_id</pre>
<p> to
<pre>t.integer :login_id</pre>
<p>The downside of this approach is that each time you change it, you need to do a migrate:reset. But since it&#8217;s in development, who cares.</p>
<p>The gain is big, by doing this, my migrate directory always keeps small and clean. And this also solves a problem <a href="http://obiefernandez.com/">Obie Fernanandez</a> mentioned in his great book &#8220;The Rails Way&#8221; which is, in a large team, developers can step into each other&#8217;s toes by having conflict sequence numbers, with huge number of migrations, that could be a nightmare. But if we just change scripts themselves, all we need to do is merging the same file, instead of renaming a lot of files. </p>
<p>You don&#8217;t have to find a mechanism to archive your migrations because you don&#8217;t need to archive.</p>
<p>As long as I can use this rule to achieve the same functionality that full migration approach offers, then it is a simpler way and, thus, better.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/yiwenandsoftware.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/yiwenandsoftware.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yiwenandsoftware.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yiwenandsoftware.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yiwenandsoftware.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yiwenandsoftware.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yiwenandsoftware.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yiwenandsoftware.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yiwenandsoftware.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yiwenandsoftware.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yiwenandsoftware.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yiwenandsoftware.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yiwenandsoftware.wordpress.com&blog=2109631&post=23&subd=yiwenandsoftware&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://yiwenandsoftware.wordpress.com/2008/02/25/less-is-better/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f711c24e96cbc441b0c94141f22f2d23?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hayafirst</media:title>
		</media:content>
	</item>
	</channel>
</rss>