<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.3" -->
<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/"
	>

<channel>
	<title>Deterministic Musings</title>
	<link>http://www.rickylui.com/blog</link>
	<description>Musings through my coloured lenses.  Or you can call this Ricky Bobby's musings.</description>
	<pubDate>Tue, 29 Jul 2008 15:59:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.3</generator>
	<language>en</language>
			<item>
		<title>Cuil indexes 120 billion Web pages, but it forgot to index itself.</title>
		<link>http://www.rickylui.com/blog/2008/07/29/cuil-indexes-120-billion-web-pages-but-it-forgot-to-index-itself/</link>
		<comments>http://www.rickylui.com/blog/2008/07/29/cuil-indexes-120-billion-web-pages-but-it-forgot-to-index-itself/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 15:59:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/07/29/cuil-indexes-120-billion-web-pages-but-it-forgot-to-index-itself/</guid>
		<description><![CDATA[I thought I&#8217;ll just give a new search engine, Cuil, a try, and so I tried to find a firefox plugin for it.

And while I&#8217;m thinking &#8220;Hmm&#8230; should I use Google to find whether there&#8217;s a firefox plugin for Cuil?&#8221;, then I realize the bottom link &#8220;Add Cuil to Firefox&#8221;.

]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;ll just give a new search engine, Cuil, a try, and so I tried to find a firefox plugin for it.</p>
<p><img src="http://www.rickylui.com/blog/wp-content/uploads/2008/07/cuil.png" /></p>
<p>And while I&#8217;m thinking &#8220;Hmm&#8230; should I use Google to find whether there&#8217;s a firefox plugin for Cuil?&#8221;, then I realize the bottom link &#8220;Add Cuil to Firefox&#8221;.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/07/29/cuil-indexes-120-billion-web-pages-but-it-forgot-to-index-itself/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>CodeJam@Thoughtworks Beijing</title>
		<link>http://www.rickylui.com/blog/2008/04/20/codejamthoughtworks-beijing/</link>
		<comments>http://www.rickylui.com/blog/2008/04/20/codejamthoughtworks-beijing/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 06:16:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Ruby</category>
	<category>Rails</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/04/21/codejamthoughtworks-beijing/</guid>
		<description><![CDATA[Ye Zheng wrote quite a detailed account (in Chinese) about our first CodeJam in the Beijing office already, so I&#8217;ll just be brief.  I had a great time pairing with other colleagues that I haven&#8217;t worked with before.  In hindsight I was quite amazed how much we accomplished and how smooth it went.
I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dreamhead.blogbus.com/">Ye Zheng</a> wrote quite a detailed <a href="http://dreamhead.blogbus.com/logs/19475526.html">account</a> (in Chinese) about our first CodeJam in the Beijing office already, so I&#8217;ll just be brief.  I had a great time pairing with other colleagues that I haven&#8217;t worked with before.  In hindsight I was quite amazed how much we accomplished and how smooth it went.</p>
<p>I saw many Agile practices condensed, surprisingly well, during this exercise. Examples:</p>
<ul>
<li>story and bug wall: a great tool for the Business Analysts and the client to have conversations and prioritize them</li>
<li>TDD</li>
<li>stand-up meetings twice a day</li>
<li>a mini-retrospective without the voting but just bringing up suggestions to improve</li>
<li>switching pairs to spread the code knowledge (for me, 3 times during 2 days).  Even for a short project like this, even though there isn&#8217;t a lot of historical knowledge.  When my pair knew about the acts_as_authenticated plugin and how they tweaked it, and I knew about one model object, Textmate, and a few rake tasks, we both became much more efficient when working on the next story.</li>
<li><a href="http://cruisecontrolrb.thoughtworks.com/">CruiseControl.rb</a> was set up and reminded of files that I forgot to check-in</li>
</ul>
<p>The client, the Director of IT of a non-profit organization dedicated to rural education in China, seemed to be very grateful for our volunteer work.  The quality and the amount of value we delivered to him seemed to have exceeded his expectations too. </p>
<p>Quoting him: &#8220;What you guys did will definitely be of help to us, and I can&#8217;t thank you enough. You let them all know that!&#8221;
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/04/20/codejamthoughtworks-beijing/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Don&#8217;t be a refactoring bigot (follow-up)</title>
		<link>http://www.rickylui.com/blog/2008/02/20/dont-be-a-refactoring-bigot-follow-up/</link>
		<comments>http://www.rickylui.com/blog/2008/02/20/dont-be-a-refactoring-bigot-follow-up/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 06:13:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>software development</category>
	<category>agile</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/02/20/dont-be-a-refactoring-bigot-follow-up/</guid>
		<description><![CDATA[Thanks to Justin and the comments on his post (No, Be a jerk), for expanding on my blog post and taking the discussion to a much more sophisticated level than I started.  Instead of &#8220;Don&#8217;t criticize code&#8221;, I think this will be more suitable title of the paragraph: &#8220;Give constructive criticism&#8221;.  I agree [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://thinkrelevance.com/">Justin</a> and the comments on his <a href="http://www.relevancellc.com/2008/1/29/no-be-a-jerk">post (No, Be a jerk)</a>, for expanding on my blog <a href="http://www.rickylui.com/blog/2008/01/28/dont-be-a-refactoring-bigot/">post</a> and taking the discussion to a much more sophisticated level than I started.  Instead of &#8220;Don&#8217;t criticize code&#8221;, I think this will be more suitable title of the paragraph: &#8220;Give constructive criticism&#8221;.  I agree completely with Justin that refactoring itself is a kind of criticism.  And it&#8217;s the constructive kind.</p>
<p>I also agree with Clinton&#8217;s point regarding team dynamics.  Communication is important to write better code  might not be well-received by your pair if you make him/her defensive, even though your point is clearly uttered and makes total sense.</p>
<p>Depending on your pair&#8217;s personality, criticizing the code could sometimes lead to a healthy debate, but other times could lead to too much negativity and too much judging.  I&#8217;d say that I&#8217;ll try to keep my pair engaged (being a jerk or not), do the necessary refactoring, while keeping a positive vibe.  Then I think it&#8217;ll pay off well to the code base, and to the team, in the long run.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/02/20/dont-be-a-refactoring-bigot-follow-up/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Services != Distributed Object</title>
		<link>http://www.rickylui.com/blog/2008/02/14/services-distributed-object/</link>
		<comments>http://www.rickylui.com/blog/2008/02/14/services-distributed-object/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 23:14:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Rails</category>
	<category>RESTful</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/02/14/services-distributed-object/</guid>
		<description><![CDATA[(The title quotes Joshua Graham&#8217;s comment here) I agree completely with Josh.  In a casual conversation with Tim Cochran of Thoughtworks, we both felt that using RESTful controllers does not mean exposing all of your model objects, or database tables.  Thoughts still need to go into designing the right interfaces.
In Rails, examples of [...]]]></description>
			<content:encoded><![CDATA[<p>(The title quotes <a title="Joshua Graham" href="http://grahamis.com/blog">Joshua Graham</a>&#8217;s comment <a href="http://www.rickylui.com/blog/2008/02/09/trying-out-activeresource-in-3-minutes/#comments">here</a>) I agree completely with Josh.  In a casual conversation with Tim Cochran of Thoughtworks, we both felt that using RESTful controllers does not mean exposing all of your model objects, or database tables.  Thoughts still need to go into designing the right interfaces.</p>
<p>In Rails, examples of RESTful controllers are usually CRUD controllers of ActiveRecord objects.  (and the ActiveRecord objects are just straight mapping to database columns).  My given example in the previous post is exactly like that, and that&#8217;s because script/generate and scaffolding just make it so easy.</p>
<p>However, that&#8217;s not an excuse not to think about what to expose, and what to hide.   In our current project we have a rails app (say an HR app) that needs to obtain/update the Account information on another rails app (say an sales app).  On the sales app side, let&#8217;s say Account is an ActiveRecord that has the following fields:<br />
<code><br />
id: integer<br />
number: integer<br />
name:string<br />
description: string<br />
balance:integer<br />
sales_person_number: integer</code></p>
<p>and there is already an AccountsController, with associated HTML forms, for CRUD-ing all the fields on an Account.</p>
<p>On the HR app, we are interested only in the sales_person_number of the account.  So we instead implemented a brand new SalesPersonAssignmentsController on the sales app, to assign a sales person, so that</p>
<p><code> POST http://sales.app/sales_person_assignments  params => {:sales_person_number => 666}  # Give sales_person an account to look after</code></p>
<p>returns an empty HTTP response, with status code 201 CREATED, and the &#8216;Location&#8217; header :  <code> "/sales_person_assignments/123"<br />
# The sales app had given account #123 for the salesperson to look after<br />
</code><br />
We haven&#8217;t implemented any security measures yet, to prevent the HR app to hit other actions on the sales app&#8217;s AccountsController.  But at least the intention is that the HR app will only hit the SalesPersonAssignmentsController only, and nothing else, on the sales app.  That hopefully limits the integration points, and make the change on one app have less impact on another app.</p>
<p>Conclusion: I think encapsulation, loosely-coupled systems, are good ideas.  They don&#8217;t call me Captain Obvious for nothing :)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/02/14/services-distributed-object/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>ActiveResource and handling a weird 204 response from a remote rails controller</title>
		<link>http://www.rickylui.com/blog/2008/02/09/activeresource-and-handling-a-weird-204-response-from-a-remote-rails-controller/</link>
		<comments>http://www.rickylui.com/blog/2008/02/09/activeresource-and-handling-a-weird-204-response-from-a-remote-rails-controller/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 21:07:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Ruby</category>
	<category>Rails</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/02/09/activeresource-and-handling-a-weird-204-response-from-a-remote-rails-controller/</guid>
		<description><![CDATA[In the examples given in ActiveResource Rails API, when ActiveResource does a PUT (e.g. update) to a remote RESTful rails controller, the rails controller is supposed to return a HTTP code of 204 (No Content).
But if the remote rails controller actually does that:
head :no_content #204
The Http response that ActiveResource receives is a Net::HTTPNoContent, with no [...]]]></description>
			<content:encoded><![CDATA[<p>In the examples given in <a href="http://api.rubyonrails.org/files/vendor/rails/activeresource/README.html">ActiveResource Rails API</a>, when ActiveResource does a PUT (e.g. update) to a remote RESTful rails controller, the rails controller is supposed to return a HTTP code of 204 (No Content).</p>
<p>But if the remote rails controller actually does that:<br />
<code>head :no_content #204</code></p>
<p>The Http response that ActiveResource receives is a Net::HTTPNoContent, with no body, but its Content-Length is, for some reason, &#8220;1&#8243; !!  So, ActiveResource will die in load_attributes_from_response(), when trying to call response.body.strip, but response.body is nil.</p>
<p>If you use Rails generated scaffolding for the remote rails controller though, the &#8216;update&#8217; action that handles PUT request actually returns a 200 HTTP response:<br />
<code>
<pre>head :ok</pre>
<p></code></p>
<p>And in this case, everything is good.</p>
<p>I didn&#8217;t delve enough in ActionController and the &#8216;net/http&#8217; stdlib to find out exactly why.  I did notice that in net/http.rb:<br />
<code><br />
class HTTPOK < HTTPSuccess                            # 200<br />
  HAS_BODY = true<br />
end<br />
class HTTPNoContent < HTTPSuccess                     # 204<br />
  HAS_BODY = false<br />
end<br />
</code></p>
<p>I think ActiveResource should handle this weird behaviour of &#8216;net/http&#8217; by doing a simple nil check of response.body in load_attributes_from_response(). I submitted a patch to<br />
<a href="http://dev.rubyonrails.org/ticket/11066" title="#11066 ([PATCH] ActiveResource should handle a weird HTTP 204 response from a remote RESTful rails controller) - Rails Trac - Trac">http://dev.rubyonrails.org/ticket/11066</a>, so for the interested reader, you can verify my patch (that it works), or give suggestions to a better way of fixing this?
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/02/09/activeresource-and-handling-a-weird-204-response-from-a-remote-rails-controller/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Trying out ActiveResource in 3 minutes</title>
		<link>http://www.rickylui.com/blog/2008/02/09/trying-out-activeresource-in-3-minutes/</link>
		<comments>http://www.rickylui.com/blog/2008/02/09/trying-out-activeresource-in-3-minutes/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 16:28:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Ruby</category>
	<category>Rails</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/02/09/trying-out-activeresource-in-3-minutes/</guid>
		<description><![CDATA[Recently I started using ActiveResource to talk to a RESTful controller (which is also done in Rails 2).  It is very nice and simplifies a lot.  With Rails 2, out of the box you can create a sample RESTful server and client in 3 minutes:
Server:

>> rails test_server
>> cd test_server
>> script/generate scaffold  Account [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I started using <a href="http://api.rubyonrails.org/files/vendor/rails/activeresource/README.html">ActiveResource</a> to talk to a RESTful controller (which is also done in Rails 2).  It is very nice and simplifies a lot.  With Rails 2, out of the box you can create a sample RESTful server and client in 3 minutes:</p>
<p>Server:<br />
<code><br />
>> rails test_server<br />
>> cd test_server<br />
>> script/generate scaffold  Account name:string balance:integer<br />
>> rake db:migrate<br />
>> script/server<br />
-- hit localhost:3000 with a browser and create some accounts<br />
</code></p>
<p>Client:<br />
<code><br />
>> rails test_client<br />
>> cd test_client<br />
-- create app/models/account.rb with the following:<br />
   class Account < ActiveResource::Base; self.site="http://localhost:3000";end<br />
>> script/console<br />
>> acc = Account.find(1) #script/console is now your text-based client :)<br />
</code></p>
<p>Voila!  That&#8217;s all you need to try out the different methods on ActiveResource.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/02/09/trying-out-activeresource-in-3-minutes/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Don&#8217;t be a refactoring bigot</title>
		<link>http://www.rickylui.com/blog/2008/01/28/dont-be-a-refactoring-bigot/</link>
		<comments>http://www.rickylui.com/blog/2008/01/28/dont-be-a-refactoring-bigot/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 06:14:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>software development</category>
	<category>agile</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2008/01/28/dont-be-a-refactoring-bigot/</guid>
		<description><![CDATA[Developers want to write simple and elegant code.  I do too, and so sometimes I catch myself being a little bit of a &#8220;refactoring bigot&#8221;, that when I came across code that I deemed not good, I became critical, or I just wanted to fix it all at once.  Not very smart.
So here [...]]]></description>
			<content:encoded><![CDATA[<p>Developers want to write simple and elegant code.  I do too, and so sometimes I catch myself being a little bit of a &#8220;refactoring bigot&#8221;, that when I came across code that I deemed not good, I became critical, or I just wanted to fix it all at once.  Not very smart.</p>
<p>So here are a few things to consider, to avoid being a &#8220;refactoring bigot&#8221;:</p>
<p><strong>Don&#8217;t criticize code by your team members </strong></p>
<p>Code that is already written in your project, was written under constraints that you might not know about. It could have been a critical time pressure to finish the feature at hand. Or there might have already been a discussion between two developers pairing on it, and they reached a comprise based on other technical considerations. Or merely a difference of opinion: what I think will be prettier code might have its downfalls too.  So, just like they say in <a title="Retrospectives" href="http://www.retrospectives.com/pages/retroPrimeDirective.html">Retrospectives</a>: &#8220;&#8230; that everyone did the best job they could, given&#8230; the situation at hand.&#8221;</p>
<p><strong>Do refactor, but do red-green-refactor</strong></p>
<p>Don&#8217;t criticize, but do improve the code base when you see fit. Do the refactoring, but don&#8217;t be tempted to just go ahead and re-organize everything, and deviate from red-green-refactor cycle.  You might come across a piece of code that you want to refactor while you&#8217;re trying to make a unit test pass.  Make a note of it, make the test pass first, and then come back to do the refactoring.  That way you can have the confidence that the tests will catch any errors during your refactoring.  And the developer who&#8217;s pairing with you will be more engaged too, when there&#8217;s a clear boundary of making a test pass, and refactoring.</p>
<p><strong>Still refactor to help understand code, and write more tests if necessary</strong></p>
<p>One reason to refactor is to help oneself understand the code better. Especially when you delve into a new part of the code base, you might find it hard to read, whereas your pair might already be very familiar with it.   If there is room for simplification, refactor to make it easier for you and others to understand.</p>
<p>With dynamic languages like Ruby and Javascript, I haven&#8217;t been using a true IDE with refactoring support.  So sometimes that means simple refactoring tasks like &#8220;Extract method&#8221; are a manual process.  Here I sometimes diverge from classic refactoring (keep tests unchanged, change the code, and have all tests still pass), and write an extra test, say, for the extracted method, or the newly created class.</p>
<p>This also break down the refactoring process into smaller manageable chunks, and having smaller chunks help your pair to see where you&#8217;re heading too.<br />
<strong><br />
Conclusion</strong><br />
Don&#8217;t be a refactoring bigot: don&#8217;t criticize, red-green-refactor, keep your pair engaged, keep refactoring in smaller chunks.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2008/01/28/dont-be-a-refactoring-bigot/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>JSON is valid YAML</title>
		<link>http://www.rickylui.com/blog/2007/12/10/json-is-valid-yaml/</link>
		<comments>http://www.rickylui.com/blog/2007/12/10/json-is-valid-yaml/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 03:25:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Ruby</category>
	<category>Rails</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2007/12/10/json-is-valid-yaml/</guid>
		<description><![CDATA[I was searching for  simple JSON  parsing in Rails and found only the Rails 2.0 way: ActiveSupport::JSON.decode.  In old version of Rails (1.2.6) there&#8217;s only JSON.encode&#8230;
So I googled and found here that you can do YAML::load &#8216;{&#8221;key&#8221;:&#8221;value&#8221;}&#8217;

]]></description>
			<content:encoded><![CDATA[<p>I was searching for  simple JSON  parsing in Rails and found only the Rails 2.0 way: ActiveSupport::JSON.decode.  In old version of Rails (1.2.6) there&#8217;s only JSON.encode&#8230;</p>
<p>So I googled and <a href="http://redhanded.hobix.com/inspect/yamlIsJson.html">found here </a>that you can do YAML::load &#8216;{&#8221;key&#8221;:&#8221;value&#8221;}&#8217;
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2007/12/10/json-is-valid-yaml/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>A few things I learned about ActiveRecord after_create (and other callbacks)</title>
		<link>http://www.rickylui.com/blog/2007/11/02/a-few-things-i-learned-about-activerecord-after_create-and-other-callbacks/</link>
		<comments>http://www.rickylui.com/blog/2007/11/02/a-few-things-i-learned-about-activerecord-after_create-and-other-callbacks/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 06:11:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>Ruby</category>
	<category>Rails</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2007/11/02/a-few-things-i-learned-about-activerecord-after_create-and-other-callbacks/</guid>
		<description><![CDATA[1. after_create does not get inherited
class Animal < ActiveRecord::Base
after_create :feed_on_milk
def feed_on_milk
self.immunity_level += 1
end
end
class Cat < Animal
end
The after_create does not get inherited, and so our poor little cats won't get milk!  To retain the after_create hook, you'll need to do:
class Cat < Animal
after_create :feed_on_milk
end
2. after_create is an array of symbols
If you call after_create on same [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1. after_create does not get inherited</strong><br />
class Animal < ActiveRecord::Base</p>
<blockquote><p>after_create :feed_on_milk<br />
def feed_on_milk</p>
<blockquote><p>self.immunity_level += 1</p></blockquote>
<p>end</p></blockquote>
<p>end</p>
<p>class Cat < Animal<br />
end</p>
<p>The after_create does not get inherited, and so our poor little cats won't get milk!  To retain the after_create hook, you'll need to do:<br />
class Cat < Animal</p>
<blockquote><p>after_create :feed_on_milk</p></blockquote>
<p>end</p>
<p><strong>2. after_create is an array of symbols</strong></p>
<p>If you call after_create on same symbol :foo twice, the &#8216;foo&#8217; method will be executed twice.  I had a bug in my code because I had something like:</p>
<p>class Animal < ActiveRecord::Base</p>
<blockquote><p>after_create :feed_on_milk</p></blockquote>
<p>end</p>
<p>and at the same time somewhere else I had something like:</p>
<p>klasses = [&#8230; ,Animal, &#8230;]<br />
klasses.each do |klass|</p>
<blockquote><p>klass.class_eval do</p>
<blockquote><p>after_create :feed_on_milk</p></blockquote>
<p>end</p></blockquote>
<p>end</p>
<p>So, :feed_on_milk symbol got added to the array twice, and so the method got executed twice, and I had to do this instead:</p>
<p>klass.class_eval do</p>
<blockquote><p>after_create(:feed_on_milk) unless self.after_create.include?(:feed_on_milk)</p></blockquote>
<p>end</p>
<p><strong>3. after_create is one of many ClassInheritableAttributes</strong></p>
<p>The reason behind 1. and 2. is that Rails extends Class to have these &#8220;attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of their parents&#8217; attributes, instead of just a pointer to the same.&#8221;</p>
<p>See vendor/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2007/11/02/a-few-things-i-learned-about-activerecord-after_create-and-other-callbacks/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>TDD is good for your happiness and well-being</title>
		<link>http://www.rickylui.com/blog/2007/10/19/tdd-is-good-for-your-happiness-and-well-being/</link>
		<comments>http://www.rickylui.com/blog/2007/10/19/tdd-is-good-for-your-happiness-and-well-being/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 21:36:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
	<category>software development</category>
	<category>agile</category>
		<guid isPermaLink="false">http://www.rickylui.com/blog/2007/10/19/tdd-is-good-for-your-happiness-and-well-being/</guid>
		<description><![CDATA[&#8220;Flow&#8221;, by Mihaly Csikszentmihalyi, is one of the pioneering books in the field of Positive Psychology, i.e. researching about what makes people happy and productive, instead of focusing of psychological diseases.
One of the key concepts in the book is that for an experience to be enjoyable, it has to be challenging at the right level, [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Flow&#8221;, by Mihaly Csikszentmihalyi, is one of the pioneering books in the field of Positive Psychology, i.e. researching about what makes people happy and productive, instead of focusing of psychological diseases.</p>
<p>One of the key concepts in the book is that for an experience to be enjoyable, it has to be challenging at the right level, and in the process you experience growth and become more &#8220;complex&#8221;. Therefore, one of the criteria of an enjoyable activity is that it gives feedback about how well one is doing, so that one can evaluate progress, and adjust one&#8217;s course of action to improve.</p>
<p>That&#8217;s why TDD (Test Driven Development) is good for your happiness and well-being.  By writing a test first, and then the code to pass the test, you&#8217;re getting feedback that you&#8217;re making progress.  Then at the refactoring stage of the &#8220;Red-Green-Refactor&#8221; cycle, it is essentially a chance for you to not only improve the code base, but also improve yourself as a coder. During a work day, every passing test counts as a tiny win in my mind, and they add up positively.</p>
<p>Speaking from personal experience of coding without TDD, TDD has definitely made coding more enjoyable for me than ever before.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.rickylui.com/blog/2007/10/19/tdd-is-good-for-your-happiness-and-well-being/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
