<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Rubberducking</title>
	
	<link>http://mathieuberube.net/blog</link>
	<description>Thoughts about programming, technology and agility</description>
	<lastBuildDate>Mon, 31 Jan 2011 20:08:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rubberducking" /><feedburner:info uri="rubberducking" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Deleting a User in Windows 7</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/bY0QiG6my2s/</link>
		<comments>http://mathieuberube.net/blog/2011/01/31/deleting-a-user-in-windows-7/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 20:08:41 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=125</guid>
		<description><![CDATA[Note to self: To delete a user in Windows 7, don&#8217;t use the UI (the postgres installer complains that the user still exists). Instead run the following command: NET USER postgres /DELETE]]></description>
			<content:encoded><![CDATA[<p>Note to self:</p>
<p>To delete a user in Windows 7, don&#8217;t use the UI (the postgres installer complains that the user still exists). Instead run the following command:</p>
<pre>NET USER postgres /DELETE</pre>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/bY0QiG6my2s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2011/01/31/deleting-a-user-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2011/01/31/deleting-a-user-in-windows-7/</feedburner:origLink></item>
		<item>
		<title>PyXtreme Genesis</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/2o3FXgVI3io/</link>
		<comments>http://mathieuberube.net/blog/2011/01/13/the-birth-of-a-team/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 14:56:32 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[practice]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pyxis]]></category>
		<category><![CDATA[pyXtreme]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=121</guid>
		<description><![CDATA[What if, instead of hiring individual developers, companies could hire a highly productive team of developers? My company has the dream that we could create such a team. How? Starting is simple: Get a bunch of people who want to work together Find a name Now comes the hard part: Make sure they can actually [...]]]></description>
			<content:encoded><![CDATA[<p>What if, instead of hiring individual developers, companies could hire a highly productive team of developers?</p>
<p>My company has the dream that we could create such a team. How? Starting is simple:</p>
<ul>
<li>Get a bunch of people who want to work together</li>
<li>Find a name</li>
</ul>
<p>Now comes the hard part:</p>
<ul>
<li>Make sure they can actually ship code in production every two weeks</li>
</ul>
<p>So I embark on a journey with <a href="http://pyxis-tech.com/en/ensemble/pyxtreme">PyXtreme</a>. We already know each other, a few of us have worked together. During next few weeks, we&#8217;ll do everything we can to form a really productive team. And there&#8217;s only one way we see to achieve it: we&#8217;ll work together and execute a project.</p>
<p>According to Tuckman, a team can only be productive once it goes through the following steps:</p>
<p><strong>Forming</strong> &#8211; unclear role and responsibilities, vague objectives, no purpose<br />
<strong>Storming</strong> &#8211; decisions are hard to make, cliques, factions and power struggles<br />
<strong>Norming</strong> &#8211; strong commitment and unity, clear role and responsibilities, respect, constructive criticism is possible<br />
<strong>Performing</strong> &#8211; shared vision, focus, autonomy, productivity</p>
<p>Every team goes through all these steps for each project. By hiring a team, you can go through the first three phases and have a performing team as fast as possible. Each project has at least one new team member (the client) that forces the team to go back to the forming phase. We can work on a standalone project. Or we could be part of a bigger team to bring your collaborators up to speed with Agile methods and engineering practices. Collaboration through <a href="http://pyxis-tech.com/en/our-offer/software-development/immersion">immersion</a>.</p>
<p>Technology is not the main challenge of a project, forming the right team is. By learning to work together beforehand, we believe we can quickly attain greater productivity.</p>
<p>We know each other. We trust each other. We have a common vocabulary for our project and technological environment. We&#8217;re a real team and we&#8217;re eager to find a project to work on.</p>
<p>What do you think about our approach? Contact us and we&#8217;ll talk.</p>
<p>PS: Thanks to Nicolas for helping with this post</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/2o3FXgVI3io" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2011/01/13/the-birth-of-a-team/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2011/01/13/the-birth-of-a-team/</feedburner:origLink></item>
		<item>
		<title>Gemsets and .rvmrc – Ruby Gem Management Made Easy</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/h4SWcYB6imk/</link>
		<comments>http://mathieuberube.net/blog/2011/01/10/gemsets-and-rvmrc-ruby-gem-management-made-easy/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 02:50:14 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=119</guid>
		<description><![CDATA[RVM is a tool that automatically manage your ruby versions. You can make 1.8.7 and 1.9.2 live together without issues. The installation process is a bit lacking &#8211; bash &#60; &#60;( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) is not really a command that looks safe at first sight. Blindly executing code from the Internet is not for the [...]]]></description>
			<content:encoded><![CDATA[<p>RVM is a tool that automatically manage your ruby versions. You can make 1.8.7 and 1.9.2 live together without issues. The installation process is a bit lacking &#8211; bash &lt; &lt;( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) is not really a command that looks safe at first sight. Blindly executing code from the Internet is not for the faint of heart but yep, rvm is really that useful.</p>
<p>I especially love gemsets. They allow you to completely separate your various development environments for each of your projects. Gem conflicts are a lot less common.</p>
<p>You can even automatically change to a gemset for each of your project by using the an .rvmrc file. I use ruby 1.9.2 by default but I have one project that uses ruby 1.8.7. I use a separate gemset called &#8216;mygemset&#8217;.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># create the gemset if it does not exist</span>
rvm_gemset_create_on_use_flag=<span style="color:#006666;">1</span>
<span style="color:#008000; font-style:italic;"># switch to default ruby version when exiting directory</span>
rvm_project_rvmrc_default=<span style="color:#006666;">1</span>
<span style="color:#008000; font-style:italic;"># use ruby 1.8.7 with a specific gemset</span>
rvm ruby<span style="color:#006600; font-weight:bold;">-</span>1.8.7<span style="color:#006600; font-weight:bold;">-</span>p302@mygemset</pre></div></div>

<p>Pretty neat. Since this file is committed, it also means everyone on the team has the same setup.</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/h4SWcYB6imk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2011/01/10/gemsets-and-rvmrc-ruby-gem-management-made-easy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2011/01/10/gemsets-and-rvmrc-ruby-gem-management-made-easy/</feedburner:origLink></item>
		<item>
		<title>A Preference for Flexibility</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/0ghWVt0PUVc/</link>
		<comments>http://mathieuberube.net/blog/2010/11/18/a-preference-for-flexibility/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 05:27:20 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=116</guid>
		<description><![CDATA[I came upon this example in an otherwise very good book. One example tried to test a main method by passing arguments: String&#91;&#93; args = new String&#91;2&#93;; args&#91;0&#93; = &#34;param1&#34;; args&#91;1&#93; = &#34;param2&#34;; MainApplication.main&#40;args&#41;; Whenever I write in this kind of code, I always prefer to create an array instead: List&#60;String&#62; list = new ArrayList&#60;String&#62;&#40;&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>I came upon this example in an otherwise very good book. One example tried to test a <code>main</code> method by passing arguments:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> = <span style="color: #0000ff;">&quot;param1&quot;</span><span style="color: #339933;">;</span>
args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> = <span style="color: #0000ff;">&quot;param2&quot;</span><span style="color: #339933;">;</span>
MainApplication.<span style="color: #006633;">main</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Whenever I write in this kind of code, I always prefer to create an array instead:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span> list = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ArrayList</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
list.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;param1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
list.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;param2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
MainApplication.<span style="color: #006633;">main</span><span style="color: #009900;">&#40;</span>list.<span style="color: #006633;">toArray</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span>list.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It&#8217;s a bit more verbose, but I find it offers a lot more flexibility as adding new parameters is simply a matter of adding a new element to the list. In the first example, adding a new parameter requires two steps : 1) modify the size of the array and 2) initialize an element of the array to the desired value.</p>
<p>I do whatever I can to remove a step, as small as it seems.</p>
<p>Modifying all the indexes is also a lot less fun when you need to add an element at index 0. And of course you&#8217;ll eventually copy/paste one line of the array and forget to modify either the size of the array or the index. </p>
<p>Using a list is a small improvement but in the long run, small things make the code a lot more maintainable.</p>
<p>PS : a friend noted that if you already use Google Collections (now Guava), you can get even more elegant code with</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">list = Lists.<span style="color: #006633;">newArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;param1&quot;</span>, <span style="color: #0000ff;">&quot;param2&quot;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/rubberducking/~4/0ghWVt0PUVc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/11/18/a-preference-for-flexibility/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/11/18/a-preference-for-flexibility/</feedburner:origLink></item>
		<item>
		<title>Programming is Hard, Shipping is Harder</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/t-M0a4C-xsk/</link>
		<comments>http://mathieuberube.net/blog/2010/11/13/programming-is-hard-shipping-is-harder/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 04:16:29 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[productivity]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=114</guid>
		<description><![CDATA[For the past year I&#8217;ve done lots of experimentation with various libraries and I had a lot of fun using ruby. Tinkering is fun, but it doesn&#8217;t get anything finished. I have a tendency to hop from pet project to pet project, never finishing anything (or worse yet in my deranged mind, releasing something half [...]]]></description>
			<content:encoded><![CDATA[<p>For the past year I&#8217;ve done lots of experimentation with various libraries and I had a lot of fun using ruby. Tinkering is fun, but it doesn&#8217;t get anything finished. I have a tendency to hop from pet project to pet project, never finishing anything (or worse yet in my deranged mind, releasing something half finished).</p>
<p>That&#8217;s basically what my <a href="http://www.agilegardener.com/">friend</a> forced me to understand by harassing me to ship an application online (or so my deranged mind remembers from our last conversation <img src='http://mathieuberube.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). Now I can thank him because it&#8217;s done.</p>
<p>I give you the <a href="http://pomodoroassistant.heroku.com//">The Pomodoro Assistant</a>.</p>
<p>Since I use the Pomodoro Technique at work, I went with a simple app that allows me to manage my pomodoros. The design is ugly and it&#8217;s still lacking many features. However it&#8217;s online and available for you to use if you desire. And I&#8217;m already using it at work so it must be kind of useful.</p>
<p>I&#8217;m eagerly waiting for comments and feedbacks.</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/t-M0a4C-xsk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/11/13/programming-is-hard-shipping-is-harder/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/11/13/programming-is-hard-shipping-is-harder/</feedburner:origLink></item>
		<item>
		<title>Python One Liner</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/BbhzNoE9pv0/</link>
		<comments>http://mathieuberube.net/blog/2010/10/18/python-one-liner/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 03:21:24 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=83</guid>
		<description><![CDATA[I keep forgetting this simple way to start a HTTP server to serve files from the current directory&#8230; Now it&#8217;s going to be here for eternity python -m SimpleHTTPServer Then point browser to http://localhost:8000 This blog shall become an extension of my brain&#8230;]]></description>
			<content:encoded><![CDATA[<p>I keep forgetting this simple way to start a HTTP server to serve files from the current directory&#8230; Now it&#8217;s going to be here for eternity</p>
<pre style="text-align: left;">python -m SimpleHTTPServer</pre>
<p>Then point browser to http://localhost:8000<br />
This blog shall become an extension of my brain&#8230;</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/BbhzNoE9pv0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/10/18/python-one-liner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/10/18/python-one-liner/</feedburner:origLink></item>
		<item>
		<title>Thin Line</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/kewfBMxs-OQ/</link>
		<comments>http://mathieuberube.net/blog/2010/09/21/thin-line/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 03:41:18 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=111</guid>
		<description><![CDATA[&#8220;Daddy, what are you doing on the computer?&#8221; How can I say that I&#8217;m installing rvm for ruby 1.8.7 + 1.9.2, rails 3 and postgres on a brand new Ubuntu installation? &#8220;Daddy is playing on the computer.&#8221; Don&#8217;t you just love it when the line between work and play is so thin?]]></description>
			<content:encoded><![CDATA[<p>&#8220;Daddy, what are you doing on the computer?&#8221;</p>
<p>How can I say that I&#8217;m installing rvm for ruby 1.8.7 + 1.9.2, rails 3 and postgres on a brand new Ubuntu installation?</p>
<p>&#8220;Daddy is playing on the computer.&#8221;</p>
<p>Don&#8217;t you just love it when the line between work and play is so thin?</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/kewfBMxs-OQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/09/21/thin-line/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/09/21/thin-line/</feedburner:origLink></item>
		<item>
		<title>Keep Your Code Where It Belongs</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/POK7FXsgFKA/</link>
		<comments>http://mathieuberube.net/blog/2010/09/15/keep-your-code-where-it-belongs/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 03:44:32 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=110</guid>
		<description><![CDATA[The Story I just bought a new computer. For the first time in ages I didn&#8217;t feel like spending hours deciding which parts I wanted, so I went for a big brand PC. Of course it came with Windows 7 installed. Like any self-respecting geek, the first thing I did was&#8230; to install Starcraft. No [...]]]></description>
			<content:encoded><![CDATA[<h3>The Story</h3>
<p>I just bought a new computer. For the first time in ages I didn&#8217;t feel like spending hours deciding which parts I wanted, so I went for a big brand PC. Of course it came with Windows 7 installed.</p>
<p>Like any self-respecting geek, the first thing I did was&#8230; to install Starcraft. No problem there.</p>
<p>The second thing was to install Ubuntu. Then things started to get hairy. I could reboot to Windows once. Then the Master Boot Record. In case you don&#8217;t know, the MBR is a very important part of your disk that tells it what to boot. I was stuck.</p>
<p>Time for google. Fortunately I came across <a href="http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Windows_Writes_To_MBR">this page</a>. It basically says &#8220;<a href="http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Windows_Writes_To_MBR#Cause">Some programs</a> write to the MBR, overriding Grub 2&#8242;s boot code&#8221;. It then goes on to explain how booting from another drive (not an option for me), using LILO or reverting to Legacy Grub. The last one worked for me.</p>
<h3>The Point of the Story</h3>
<p>Anyway that got me thinking about a golden rule of software development : <em>keep your code where it belongs! (</em>Most likely, it does not belong to the boot sector.)</p>
<p>I can&#8217;t remember how many times I saw software fail because someone decided it seems to be a good idea to modify the internals of a framework/platform and commit it. Then the day comes when you want to use a new feature &#8211; and all hell breaks loose.</p>
<p>There is always a better option. If you think your project is different, think again. 99.9% of the time you&#8217;re wrong. If you think you&#8217;re in the .1% &#8211; so does everybody else. Otherwise you end up with an unbootable PC, a Tomcat that cannot render .jsp (yeah I saw that) or an application that is stuck with an obsolete, unmaintained version of a library that you can&#8217;t get rid of.</p>
<p>Keep your code out of the framework. You&#8217;ll stay sane a lot longer.</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/POK7FXsgFKA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/09/15/keep-your-code-where-it-belongs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/09/15/keep-your-code-where-it-belongs/</feedburner:origLink></item>
		<item>
		<title>Retro</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/-FfUaB3mWRQ/</link>
		<comments>http://mathieuberube.net/blog/2010/09/01/retro/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 03:12:23 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[goals]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=106</guid>
		<description><![CDATA[In September 2009, I decided that for the next year, I would concentrate on three goals: Reading (12 books) Blogging (40 posts) Coding (4 projects) What did I learn about setting objectives? What do I need to improve? These questions will be answered in a few moments&#8230; and if you care you might even hear [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://mathieuberube.net/blog/2009/09/21/personnal-goals/">September 2009</a>, I decided that for the next year, I would concentrate on three goals:</p>
<ul>
<li>Reading (12 books)</li>
<li>Blogging (40 posts)</li>
<li>Coding (4 projects)</li>
</ul>
<p>What did I learn about setting objectives? What do I need to improve? These questions will be answered in a few moments&#8230; and if you care you might even hear how I fared.</p>
<h4>The results (drum roll)</h4>
<p>Overall I&#8217;m happy with what I accomplished. I read more books than what I planned (16 books that I remember plus tons of blogs), and I blogged as planned (*exactly* as planned if I include this post and another I posted only on the <a href="http://pyxis-tech.com/blog/2010/08/27/unit-testing-your-views-with-velocity/">Pyxis blog</a>). However I wanted to code a lot more than I did. I&#8217;m still pleased with the small projects that I worked on but I envisioned something bigger. I mostly did prototypes, katas and experimentation with Rails. No big projects, nothing on github (yet).</p>
<p>I did learn a lot about setting objectives for the future:</p>
<h4>Lesson #1 : Never write about goals other people set for you</h4>
<p>My wife convinced me to put something about losing a bit of weight. Fail. It wasn&#8217;t my goal, it should never have made the list</p>
<h4>Lesson # 2 : Keep your objectives focused</h4>
<p>For me, three goals was one too much. Very early on I could see that it was easier for me to write blogs or read books than it was to code &#8211; books were feeding me for blogs, blogs were giving me questions to read about. Coding felt lonely. Next time I&#8217;m going to go with two goals max to start with &#8211; and coding is going to be one of them.</p>
<h4>Lesson # 3 : Do it gradually</h4>
<p>Setting goals is definitely something that allowed me to improve. When I did it in the past, I usually started with a big goal in mind. I suggest you try it with small objectives at first and grow more ambitious as you go. Get started, have habits in place. Then think big.</p>
<h4>Lesson #4 : Think about your next goals in advance</h4>
<p>Especially if you plan on blogging about it on time. Shame on me.</p>
<p>I have a few ideas but I&#8217;m not fixed yet, so I&#8217;ll set a few very short term goals for now.</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/-FfUaB3mWRQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/09/01/retro/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/09/01/retro/</feedburner:origLink></item>
		<item>
		<title>Rediscovering ERB (without Rails)</title>
		<link>http://feedproxy.google.com/~r/rubberducking/~3/7bBUIfluZcI/</link>
		<comments>http://mathieuberube.net/blog/2010/08/26/rediscovering-erb-without-rails/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 03:40:35 +0000</pubDate>
		<dc:creator>Mathieu Berube</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mathieuberube.net/blog/?p=103</guid>
		<description><![CDATA[Since I discovered Haml for my HTML templates in Rails, I stopped using ERB. Haml is more intuitive and readable to me. I am rediscovering ERB though for something else completely &#8211; Java code generation. There is a lot of boilerplate code in most Java projects. A good IDE can help you alleviate some of [...]]]></description>
			<content:encoded><![CDATA[<p>Since I discovered Haml for my HTML templates in Rails, I stopped using ERB. Haml is more intuitive and readable to me.</p>
<p>I am rediscovering ERB though for something else completely &#8211; Java code generation.</p>
<p>There is a lot of boilerplate code in most Java projects. A good IDE can help you alleviate some of it but most (if not all) applications will have additional boilerplate very specific to your application. Using ERB, you can easily create cut down on mindless typing.</p>
<p>For example, let&#8217;s suppose you are writing many Java listeners. Just create a script that will do it for you. I&#8217;ll make an exemple with a ContactListener class that is notified when a user is added, removed or blacklisted from your contact list.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'erb'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># setup - could be initialized from script arguments</span>
classname = <span style="color:#996600;">&quot;Contact&quot;</span>
listener_methods = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;added&quot;</span>, <span style="color:#996600;">&quot;removed&quot;</span>, <span style="color:#996600;">&quot;blackListed&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># create file based on 'listener.java.erb'</span>
content = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'listener.java.erb'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
template = <span style="color:#CC00FF; font-weight:bold;">ERB</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>content<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{classname}Listener.java&quot;</span>, <span style="color:#996600;">'w'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> f.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>template.<span style="color:#9900CC;">result</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>If I run this using listener.java.erb:</p>
<pre>public interface &lt;%= classname %&gt;Listener {
  &lt;% listener_methods.each do |method|  %&gt;
  void &lt;%= method %&gt;(&lt;%= classname %&gt;Event event);
  &lt;% end %&gt;
}</pre>
<p>Then I generate this file:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> ContactListener <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">void</span> added<span style="color: #009900;">&#40;</span>ContactEvent event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">void</span> removed<span style="color: #009900;">&#40;</span>ContactEvent event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">void</span> blackListed<span style="color: #009900;">&#40;</span>ContactEvent event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That was easy &#8211; and it&#8217;s not that useful I admit. I&#8217;m sure you can create your own listeners just as fast in your own IDE. Probably even faster.</p>
<p>However here comes the fun part &#8211; the same script can be used to create lots of other classes:</p>
<ul>
<li>The ContactAdapter class</li>
<li>The ContactEvent class</li>
<li>The ContactController</li>
<li>The Contact model</li>
<li>The ContactRepository (maybe even with a few methods to add/remove/retrieve a contact by id)</li>
<li>The ContactView through which users will be able to trigger ContactEvents (maybe with a simple UI &#8211; even buttons to trigger each events on the ContactHandler)</li>
<li>Registration of the ContactHandler and the ContactView by your favorite IOC framework</li>
<li>Registration of the ContactView so it is accessible from your application&#8217;s menu</li>
<li>Test classes for all of the above (including failing test cases that you&#8217;re going to have to write)</li>
</ul>
<p>And probably other bits here and there to glue everything together.</p>
<p>Your mileage may vary, but code generation might be a great way to make your path shorter.</p>
<p>Can your IDE do that?</p>
<img src="http://feeds.feedburner.com/~r/rubberducking/~4/7bBUIfluZcI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mathieuberube.net/blog/2010/08/26/rediscovering-erb-without-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://mathieuberube.net/blog/2010/08/26/rediscovering-erb-without-rails/</feedburner:origLink></item>
	</channel>
</rss>
