<?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>hasan&#039;s blog (বল্গ) &#187; best practice</title>
	<atom:link href="http://we4tech.wordpress.com/category/best-practice/feed/" rel="self" type="application/rss+xml" />
	<link>http://we4tech.wordpress.com</link>
	<description>work for fun!!!</description>
	<lastBuildDate>Wed, 25 Jan 2012 11:56:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='we4tech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/77f5f3e5f84d83c83da12540728f5cb3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>hasan&#039;s blog (বল্গ) &#187; best practice</title>
		<link>http://we4tech.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://we4tech.wordpress.com/osd.xml" title="hasan&#039;s blog (বল্গ)" />
	<atom:link rel='hub' href='http://we4tech.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Fat Refactoring: use include module to reduce number of lines</title>
		<link>http://we4tech.wordpress.com/2007/11/03/fat-refactoring-use-include-module-to-reduce-number-of-lines/</link>
		<comments>http://we4tech.wordpress.com/2007/11/03/fat-refactoring-use-include-module-to-reduce-number-of-lines/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 04:48:01 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[best practice]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/fat-refactoring-use-include-module-to-reduce-number-of-lines</guid>
		<description><![CDATA[if i didn&#8217;t mention that before, i should tell it now, here at somewhere in&#8230; rnd team we are playing a lot with ruby on rails. these days our rails team is completely focusing on a product(which is secret for the time being ) where we found a lot of interesting stuffs, for instance. few &#8230; <a href="http://we4tech.wordpress.com/2007/11/03/fat-refactoring-use-include-module-to-reduce-number-of-lines/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=380&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>if i didn&#8217;t mention that before, i should tell it now, here at <a title="somewhere in..." href="http://www.somewherein.net/">somewhere in&#8230;</a> rnd team we are playing a lot with ruby on rails. these days our rails team is completely focusing on a product(which is secret for the time being <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) where we<br />
found a lot of interesting stuffs, for instance.</p>
<p>few days back, we found our application_helper and few controllers are growing too fast and getting extra fat (lines of code). so we had few refactoring to reduce the extra fat.</p>
<p>now have a look on the code we had with in application_helper.rb taken from tag/v-0.3<br />
<img class="alignnone size-medium wp-image-438" title="fat_refactoring_before" src="http://we4tech.files.wordpress.com/2007/11/fat_refactoring_before.gif?w=102&#038;h=300" alt="fat_refactoring_before" width="102" height="300" /><br />
this code is not completely visible over the screen snap, this is 340 number of lines. which was the output of our 3 iterations.</p>
<p>though these number of lines are not that much problematic, but we had a scenario which was difficult to make it more concern aware and single concerned.</p>
<p>now have a look on our code which is taken from the current trunk,<br />
<img class="alignnone size-medium wp-image-439" title="fat_reforing_after" src="http://we4tech.files.wordpress.com/2007/11/fat_reforing_after.gif?w=215&#038;h=300" alt="fat_reforing_after" width="215" height="300" /><br />
Wow, now it is 50 lines only including the header copyright information.<br />
the trick was very simple, we followed the following conventions -</p>
<p>1. find out all related and same concerned functions<br />
2. stick team together in a module<br />
3. include the module to statically import all functions<br />
no integration error, nothing has occurred.<br />
we are happy with this <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>i think, our ruby learning process is going smooth <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><!--6af55683b5bcff206d455f3a7c9cf4fc--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/380/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/380/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=380&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/11/03/fat-refactoring-use-include-module-to-reduce-number-of-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2007/11/fat_refactoring_before.gif?w=102" medium="image">
			<media:title type="html">fat_refactoring_before</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2007/11/fat_reforing_after.gif?w=215" medium="image">
			<media:title type="html">fat_reforing_after</media:title>
		</media:content>
	</item>
		<item>
		<title>split out test case into &#8220;preparation&#8221; and &#8220;verification&#8221; state.</title>
		<link>http://we4tech.wordpress.com/2007/10/28/split-out-test-case-into-preparation-and-verification-state/</link>
		<comments>http://we4tech.wordpress.com/2007/10/28/split-out-test-case-into-preparation-and-verification-state/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 03:13:35 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[best practice]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/split-out-test-case-into-preparation-and-verification-state</guid>
		<description><![CDATA[i was wondering how i could make my test method more organized and DR(Y)ied. so i had a nice time while i was writing test to ensure my current modification works ok with existing setup. i don&#8217;t know whether any design pattern or best practice is already exist on this topic. i came up with &#8230; <a href="http://we4tech.wordpress.com/2007/10/28/split-out-test-case-into-preparation-and-verification-state/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=373&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i was wondering how i could make my test method more organized and DR(Y)ied.<br />
so i had a nice time while i was writing test to ensure my current modification works ok with existing setup.</p>
<p>i don&#8217;t know whether any design pattern or best practice is already exist on this topic.<br />
i came up with something that is really good for me. here is a bit about my task and also the explanation about what i did.</p>
<p>i have a model &#8220;category&#8221; where i have the following relations -</p>
<blockquote><p>has_many :category_mappings, :dependent =&gt; :destroy<br />
has_many :items, :through =&gt; :category_mappings</p>
<p>has_many :categories, :foreign_key =&gt; &#8220;parent_id&#8221;, :dependent =&gt; :destroy</p>
<p>has_many :attribute_category_mappings, :dependent =&gt; :destroy<br />
has_many :properties, :through =&gt; :attribute_category_mappings</p>
<p>belongs_to :category</p></blockquote>
<p>i was applying :dependent = &gt; :destroy with the mapping model and child categories, which are needs to be removed as a part of the category destroy process.</p>
<p>so i had a messy unit test method to ensure this is working fine. sorry for not keeping my old code snaps otherwise i could show the messy one. anyway here what i wrote later to make it bit cleaner than the previous messy version -</p>
<blockquote><p>def test_destroy_category_with_dependent<br />
category = Category.find(3)</p>
<p># prepare for verification<br />
prepare_for_verifying_related_property_mappings(category)<br />
prepare_for_verifying_category_mappings(category)<br />
prepare_for_verifying_child_category(category)</p>
<p># perform action<br />
category.destroy</p>
<p># ensure the action<br />
assert_raise(ActiveRecord::RecordNotFound) {<br />
Category.find(category.id)<br />
}</p>
<p># perform verification<br />
verify_related_property_mappings(category)<br />
verify_related_category_mappings(category)<br />
verify_related_child_category(category)<br />
end</p></blockquote>
<p>here i just sliced my test method in 2 different roles,</p>
<p>1. preparation stage<br />
2. verification stage</p>
<p>1. preparation stage -<br />
in this stage, i just keep log for current state or other steps which are important for later testing.</p>
<p>2. verification stage -<br />
in this stage, i just verified my new state comparing with the old state (which was kept during preparation stage).<br />
so let&#8217;s have a look on the typical code which i wrote in  my preparation and verification stage -</p>
<div style="margin-left:40px;">def prepare_for_verifying_child_category(p_category)<br />
puts &#8220;Prepare for verifying related child category &#8211; #{p_category}.&#8221;<br />
@old_category_count = Category.count<br />
@old_child_category_count = p_category.categories.count<br />
@old_child_categories = Category.find_all_by_parent_id(p_category.id)<br />
assert_not_equal(0, @old_child_categories.length, &#8220;No child category found.&#8221;)<br />
end</div>
<p style="margin-left:40px;">def verify_related_child_category(p_category)<br />
puts &#8220;verify related child categories &#8211; #{p_category}&#8221;<br />
now_category_count = Category.count<br />
assert_equal(true, ((@old_category_count &#8211; now_category_count) &gt; 1),<br />
&#8220;No category has been removed.&#8221;)<br />
end</p>
<p>this seem pretty good for me, as long as i can make my code bunch simple and easy to change.</p>
<p>best wishes,</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/373/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/373/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=373&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/10/28/split-out-test-case-into-preparation-and-verification-state/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>EiD recipe special : few conventions and best practice for software developer</title>
		<link>http://we4tech.wordpress.com/2007/10/15/eid-recipe-special-few-conventions-and-best-practice-for-software-developer/</link>
		<comments>http://we4tech.wordpress.com/2007/10/15/eid-recipe-special-few-conventions-and-best-practice-for-software-developer/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 07:54:42 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[best practice]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/eid-recipe-special-few-conventions-and-best-practice-for-software-developer</guid>
		<description><![CDATA[i just gathered a few of my known conventions and best practices. i belief this will help many of us. few of my previously written posts - usages of &#8220;final&#8221; keyword in java - http://www.somewhereinblog.net/blog/hasan/28708715 usages of comment and coding http://www.somewhereinblog.net/blog/hasan/28704020 let&#8217;s check out my recipes - 1. code from your peer developer perspective view. &#8230; <a href="http://we4tech.wordpress.com/2007/10/15/eid-recipe-special-few-conventions-and-best-practice-for-software-developer/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=369&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i just gathered a few of my known conventions and best practices. i belief this will help many of us.</p>
<blockquote><p>
few of my previously written posts -<br />
usages of &#8220;final&#8221; keyword in java -</p>
<p>http://www.somewhereinblog.net/blog/hasan/28708715</p>
</p>
</blockquote>
<blockquote><p>
usages of comment and coding<br />
http://www.somewhereinblog.net/blog/hasan/28704020</p>
</p>
</blockquote>
<p>let&#8217;s check out my recipes -</p>
<p><strong> 1. code from your peer developer perspective view.</strong><br />
while you writing your code, always think your code will be reviewed by some other developers, who is not like you,<br />
who is very serious in simple fault and ignorance in writing code. your code will reflect who you are, so better be careful while you exposing yourselves (through writing code).</p>
<p><strong>2. variable convention -</strong><br />
never write short variable name, always write variable which reflects it usages.<br />
for example -</p>
<blockquote><p>
$user = new User() instead of $u = new User(). follow same convention when you have nested &#8220;loop&#8221;</p>
</p>
</blockquote>
<p><strong>3. source file naming convention (except java)</strong><br />
set your file name in such a way that will reflect the usages of the file.<br />
for example -</p>
<blockquote><p>
verify_user_authentication.php (or in a packaging manner &#8211; user_util_verify_authentication.php). in java you better know how to write package.</p>
</p>
</blockquote>
<p><strong><br />
4. keep your url domain centric</strong><br />
all urls should be inherited by some specific problem domain for example -</p>
<blockquote><p>http://abc.com/user/login</p>
<p>http://abc.com/user/register</p>
<p>http://abc.com/user/update</p>
</p>
</blockquote>
<p>here &#8220;user&#8221; is problem domain and &#8220;login|register|update&#8221; are actions or you could say problem.</p>
<p><strong>5. method naming convention -</strong><br />
write method name in such a format that will reflect it usages. or simply make it self describing.<br />
for example -</p>
<blockquote><p>
<strong>function</strong> verify_user_credentials() {}<br />
<strong>def</strong> verify_whether_user_profile_is_complete() {}<br />
<strong>private</strong> void checkUserFlyLimit() {}</p>
</p>
</blockquote>
<p><strong>6. don&#8217;t write query from controller:</strong><br />
build or execute query from DAO or helper or utility or domain itself. don&#8217;t put it over controller which limits the reuability and later extendability and interception</p>
<p><strong>7. single concern</strong><br />
while coding, keep your method slim and less concerned about other implementation. for example -</p>
<blockquote><p>
private void isAuthorizedUser(pUser, pAction) {<br />
if (userAlreadyLoggedOn(pUser) &amp;&amp; userIsNotBlocked(pUser) &amp;&amp; userHasPermission(pUser, pAction)) {<br />
// boooooooooooooooomm&#8230;<br />
}<br />
}</p>
</p>
</blockquote>
<p><strong>8. think from testability</strong><br />
while writing your code always think from testable perspective view. this means, how you could testify your work or module<br />
or bunch of code which your company is paying for.</p>
<p><strong>9. follow coding norms -</strong><br />
i. think before coding</p>
<blockquote><p>
whatever you want to put on your code try to think or imagine before start coding.</p>
</p>
</blockquote>
<p>ii. dump your think in comment</p>
<blockquote><p>
whatever you thought just write it down over comment or paper or in a common place where you or future developers could have look on. (better place in comment)</p>
</p>
</blockquote>
<p>iii. write your algorithm in comment.</p>
<blockquote><p>
whatever you planned write in comment before kick start your coding.</p>
</p>
</blockquote>
<p>iv. set up your unit test case.</p>
<blockquote><p>
find all probable assertion points from use case, put them over your unit test case.</p>
</p>
</blockquote>
<p>v. write your code<br />
vi. coding routine -</p>
<blockquote><p>
(1) test -&gt; (2) code &#8211; go to &gt; (1) [recursively]</p>
</p>
</blockquote>
<p><strong>10. always put your tag over the source file,</strong><br />
whatever you wrote, that reflects your confident and work efficiency, so better you tag your name over every source code you have written or modified. good for tech lead or project manager, because tagging each file with author name, it creates a hidden responsibility for the author <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  good for both parties.<br />
for example -</p>
<blockquote><p>
/**<br />
* @author someone<br />
*/</p>
</p>
</blockquote>
<p><!--7e470a64f907b914df4ea1da80ed7076--></p>
</p>
<p><!--8a66c7a17469a1d33340db5a4d3efca1-->
</p>
<p><!--f94b42ad9fc910c14d38c03db3aa3cd7--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/369/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/369/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=369&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/10/15/eid-recipe-special-few-conventions-and-best-practice-for-software-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>where to invoke &#8220;layout&#8221;? AppllicationController or ChildController?</title>
		<link>http://we4tech.wordpress.com/2007/10/06/where-to-invoke-layout-appllicationcontroller-or-childcontroller/</link>
		<comments>http://we4tech.wordpress.com/2007/10/06/where-to-invoke-layout-appllicationcontroller-or-childcontroller/#comments</comments>
		<pubDate>Sat, 06 Oct 2007 13:43:45 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[best practice]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/where-to-invoke-layout-appllicationcontroller-or-childcontroller</guid>
		<description><![CDATA[these days i am having a lot of fun with Ruby on Rails. it seems to be like an open ground with lot of handful tools, now come up with ideas and build them up. handful ruby based tools really helping me to let my smile back. anyway, while i was writing code on rails &#8230; <a href="http://we4tech.wordpress.com/2007/10/06/where-to-invoke-layout-appllicationcontroller-or-childcontroller/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=361&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>these days i am having a lot of fun with Ruby on Rails. it seems to be like an open ground with lot of handful tools, now come up with ideas and build them up.</p>
<p>handful ruby based tools really helping me to let my smile back. anyway, while i was writing code on rails i am feeling something can be better practice something is not good. from now on, i will try to put them over the my blog.</p>
<p>their is method called &#8220;layout&#8221; which is used to define the based layout for the controller. this can be used from ApplicationController and other domain specific controller for example : &#8220;UserController&#8221;.</p>
<p>my team and me was used to define layout over the domain specific controller, but i belief, as we are repeating same &#8220;layout &#8216;template1&#8242;&#8221; code over and over, it must be better to keep inside the ApplicationController, as because all domain specific controllers are extending application controller, more over it is easy to change.</p>
<p>you may get a question about ajax based response, the better answer is, use render .., layout =&gt; false, that will get rid of base layout.</p>
<p>best wishes,
</p>
<p><!--6dd10d887e1e5243dbfe0e12281c18db--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/361/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/361/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=361&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/10/06/where-to-invoke-layout-appllicationcontroller-or-childcontroller/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
