<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thinking In Rails &#187; Fear</title>
	<atom:link href="http://thinkinginrails.com/category/fear/feed/" rel="self" type="application/rss+xml" />
	<link>http://thinkinginrails.com</link>
	<description>A Perl Programmer&#039;s Exploration of The World of Ruby on Rails</description>
	<lastBuildDate>Thu, 12 Apr 2012 03:37:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building a New Site With Rails Part 1</title>
		<link>http://thinkinginrails.com/2010/06/building-a-new-site-with-rails-part-1/</link>
		<comments>http://thinkinginrails.com/2010/06/building-a-new-site-with-rails-part-1/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 06:14:03 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=554</guid>
		<description><![CDATA[You may have noticed that my &#8216;blog 6 days a week&#8217; has lately been kinda lax lately, but I finally, finally, started work on Ruby-idioms.com.  Nothing out there public yet, but I&#8217;ve finally found the time and energy, and quite frankly, got through that old friend of mine, fear of getting stuff done instead of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Fear on the Brain" src="http://static.howstuffworks.com/gif/fear-9.gif" alt="Fear on the Brain" width="240" height="216" />You may have noticed that my &#8216;blog 6 days a week&#8217; has lately been kinda lax lately, but I finally, <em>finally</em>, started work on Ruby-idioms.com.  Nothing out there public yet, but I&#8217;ve finally found the time and energy, and quite frankly, got through that old friend of mine, fear of getting stuff done instead of watching TV and reading RSS feeds, and actually got some code down on&#8230; uhm&#8230; an editor.</p>
<p>I figure that it&#8217;d be a good idea to start blogging the experience of building a site from scratch with Rails by a newbie (not that there aren&#8217;t a hundred of those already).  <a href="http://readmycode.org/">Read My Code</a> was done in 24 hours, I figure a week or so, or heck, a day or two per feature, ought to be enough.</p>
<p>I started by breaking things into some steps:</p>
<ol>
<li>Create the Idiom scaffold, model validation, etc</li>
<li>User authentication and login</li>
<li>User integration (edit your own Idioms)</li>
<li>Site layout, look and feel</li>
<li>Commenting</li>
<li>Tagging</li>
<li>More site layout stuff (I&#8217;m thinking this might be the hardest part for me, as I am a programmer and not a designer for a <em>very good</em> reason <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p>That&#8217;s of course a bit over simplified, and I&#8217;m probably missing out something huge, but that&#8217;s the current attack plan.  All things are flexible of course.  My grand plan is to code one day, blog the results and anything interesting or challenging that I find. I&#8217;ll make sure I push things up to the <a href="http://github.com/arcterex/ruby-idioms.com">GitHub project page</a> as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/06/building-a-new-site-with-rails-part-1/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Best Laid Plans</title>
		<link>http://thinkinginrails.com/2010/05/best-laid-plans/</link>
		<comments>http://thinkinginrails.com/2010/05/best-laid-plans/#comments</comments>
		<pubDate>Sat, 29 May 2010 03:24:38 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=532</guid>
		<description><![CDATA[So minimal posting this week cause I&#8217;ve been hit with the cold/flu/sinus-torture-from-hell I did get some design done on the two projects I&#8217;ve had rattling around in my head for the last few weeks and months.  Only problem was, when I really thought about it, they are both kinda silly and pointless. My idea for [...]]]></description>
			<content:encoded><![CDATA[<p>So minimal posting this week cause I&#8217;ve been hit with the cold/flu/sinus-torture-from-hell <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  I did get some design done on the two projects I&#8217;ve had rattling around in my head for the last few weeks and months.  Only problem was, when I really thought about it, they are both kinda silly and pointless.</p>
<ul>
<li>My idea for a memory capture (ie: put in memories of your past) is, I realized, essentially a blog with a better way of adding by date (fuzzy dates).  Really, just a blog.  Do I want to end up re-writing <a href="http://wordpress.org">wordpress</a> or <a href="http://movabletype.org">movable type</a> again, poorly?</li>
<li>The ruby-idioms site that I spoke about a while ago appears to have been written already over at <a href="http://readmycode.org">http://readmycode.org</a>.  While I applaud the author for getting the site out in 24 hours, he also basically created what I wanted to.  Grrr&#8230;..</li>
</ul>
<p>Now, that&#8217;s not to say that I don&#8217;t have passion for the projects, and definitely doesn&#8217;t mean I won&#8217;t still do them (nothing says you can&#8217;t <a href="http://vaynermedia.com/2009/11/build-an-application-even-if-it-already-exists/">create something if it exists already</a>).  Shows the dangers of not committing and waiting, instead of getting stuff done NOW.</p>
<p>Guess it&#8217;s just a bummer to get to the realization that my fantastic ideas maybe aren&#8217;t that wonderful&#8230;. Bleah.</p>
<p>Anyway, keep on coding out there, got some ideas here for some hopefully interesting posts coming up next week as I get better and closer to upright!</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/05/best-laid-plans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doing it Now</title>
		<link>http://thinkinginrails.com/2010/05/doing-it-now/</link>
		<comments>http://thinkinginrails.com/2010/05/doing-it-now/#comments</comments>
		<pubDate>Tue, 25 May 2010 01:33:52 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=506</guid>
		<description><![CDATA[It might sound like a bit of cliché from one of those high energy seminars where you&#8217;re encouraged to Take Control Of Your Life! and Actualize Now! or Create Your Own Reality!, more and more I&#8217;m finding that one of the best ways to get things done, programming wise, is just to [expletive] do it. One [...]]]></description>
			<content:encoded><![CDATA[<p>It might sound like a bit of cliché from one of those high energy seminars where you&#8217;re encouraged to Take Control Of Your Life! and Actualize Now! or Create Your Own Reality!, more and more I&#8217;m finding that one of the best ways to get things done, programming wise, is just to [expletive] do it.</p>
<p>One of the big challenges I have myself is that I get mired down in details.  For example, I have this idea to do a Ruby Idioms site, and the setup seems pretty simple.  User login model, an Idiom model, thrown in something like <a href="http://github.com/mbleigh/acts-as-taggable-on">acts_as_taggable-on</a> or whatever&#8217;s <a href="http://www.google.com/search?hl=en&amp;safe=off&amp;qscrl=1&amp;q=ruby+gem+taggable&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=">hot right now</a>, a bit of layout, some begging for real design from some helpful designer(s), a short beta with some real users to flesh out the bugs and fill in the database, and then release, iterate, release, iterate, done.</p>
<p>For a Rails project this isn&#8217;t overly complex, hell, an intermediate coder could probably hack that out (up to the design part) in an afternoon.</p>
<p>And yet a week after coming up with, and getting all excited by, the idea of doing it, I&#8217;ve only gotten as far as registering the domain.  What the hell is wrong with me!?  Heck, I started this post half a week ago and still haven&#8217;t posted it, or gotten around to doing anything more.</p>
<p>So why?</p>
<p>There are a few different reasons <a href="http://www.psychologytoday.com/articles/200308/procrastination-ten-things-know">why people procrastinate</a>.  I&#8217;d put them in a random order chosen out of my brain:</p>
<ul>
<li>You&#8217;d have to finish if you start</li>
<li>Easier to sit on the couch and watch the new Blue Ray <a href="http://www.imdb.com/title/tt1014759/">Alice in Wonderland</a></li>
<li>Too many other things to learn first</li>
</ul>
<p>The last point is the big one for me, and for a few people I know too.  When I say &#8220;to learn&#8221; I don&#8217;t mean that in the &#8220;oh I have these awesome new technologies to get through&#8221; sort of way, but more in the &#8220;well, I can&#8217;t write a rails app until I learn rails, but I have to learn ruby first, and there&#8217;s all these libraries, and I hear that 1.9 is coming out soon, so maybe I&#8217;ll wait for that to be released, and I hear Rails 3.0 is almost out, so it makes <em>no</em> sense to learn Rails 2 now if the next version is only a couple of weeks or months down the road&#8230;&#8221;</p>
<p>I believe the seminars call this (among other things) the &#8220;whoah busy&#8221; syndrome.  With a scary task ahead of you, it&#8217;s really easy to end up bogging yourself down in the minutia of it all cause if you have to mow the lawn/do the dishes/clean the house/do the litter box/cook dinner/get lunch for tomorrow ready then it&#8217;s really easy to put off starting that new project&#8230;</p>
<p>That&#8217;s my issue anyway, I&#8217;m sure it&#8217;s not unique, but I don&#8217;t want to put any of my own issues on people out there.  I think if you look deep down in your own psyche you&#8217;ll figure out what it is that&#8217;s stopping you.</p>
<p>Ok, so in the time of reading this and a few seconds contemplation, you now have figured out what issues you have stopping you from getting your stuff done, so what now?</p>
<p>The most obvious is to just do it.  Seriously, close the browser, shut down your RSS reader and open up Vim/TextMate/EMACS/whatever and start coding.</p>
<p>Still reading? Stop, close the browser and get out and do whatever it is you need to do.  Think about that feeling you get when a project is done and how good it feels to tick something off your todo list (legitimately of course, <a href="http://playhappy.files.wordpress.com/2009/03/unemployed-to-do-list.jpg">not like this guy</a>).  You&#8217;re a lot closer to that ticking off feeling after you start, not before right?</p>
<p>My best example of this from my own past was working with <a href="http://twitter.com/milesforrest">@milesforrest</a> at an early FV.rb meeting and it was just the two of us, and we started into the typical geeking out, surfing <a href="http://reddit.com">reddit</a>, etc.  I put my foot down and said &#8220;lets make something&#8221;.  We set up the site&#8217;s website onto heroku, put it up <a href="http://github.com/arcterex/fvrb.org">on github</a> and worked on stuff.  It actually sucked&#8230; there&#8217;s nothing to show you the difference between having read a bunch of Rails books and blogs and <em>actually coding it</em>.  I did a lot of cursing that day, as all the stuff that should be just super easy turned out to be really friggin&#8217; hard, or at least hard from a &#8220;I have no clue how to do this&#8221; point of view.</p>
<p>We persevered though, and worked on it and by the end of the night had  a lot better understanding of some of the Rails insides that now (months after this initial ordeal) are second nature and super simple to do.</p>
<p>Moral of the story?  Each journey begins with just one step, and each new web project begins with typing in &#8220;rails &lt;projectname&gt;&#8221;&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/05/doing-it-now/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Incoming, Another Week Of Coding</title>
		<link>http://thinkinginrails.com/2010/05/incoming-another-week-of-coding/</link>
		<comments>http://thinkinginrails.com/2010/05/incoming-another-week-of-coding/#comments</comments>
		<pubDate>Mon, 10 May 2010 05:42:10 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=448</guid>
		<description><![CDATA[Of course, I&#8217;m lying a bit when I say &#8220;another&#8221;, because for the last few my rails coding has been&#8230;. &#8220;minimal&#8221; at best.  Seems no matter where I am I just can&#8217;t get my brain back into a coding mode.  I&#8217;ve done a few minor updates for my perl clients, but when I&#8217;m done I [...]]]></description>
			<content:encoded><![CDATA[<p>Of course, I&#8217;m lying a bit when I say &#8220;another&#8221;, because for the last few my rails coding has been&#8230;. &#8220;minimal&#8221; at best.  Seems no matter where I am I just can&#8217;t get my brain back into a coding mode.  I&#8217;ve done a few minor updates for my perl clients, but when I&#8217;m done I just head off away from wherever I am to the couch, to TV, or a video game, or whatever.  Gotta break out of that this week, get some coding on either <a href="http://github.com/arcterex/Referee-Management">refsite</a> or my little <a href="http://github.com/arcterex/Twitter-2-HTML">Twitter XML</a> projects done.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/05/incoming-another-week-of-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Goal Setting and Getting Things Done</title>
		<link>http://thinkinginrails.com/2010/04/goal-setting-and-getting-things-done/</link>
		<comments>http://thinkinginrails.com/2010/04/goal-setting-and-getting-things-done/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 16:06:26 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=144</guid>
		<description><![CDATA[Here&#8217;s a bit of a diversion from the Ruby and Rails talk.  Back in the day I took a couple of the LGAT courses that covered life skills, goal setting, etc.  Other than taking a ton of money out of my bank account, they did teach me some fairly good skills and more importantly ways of [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a bit of a diversion from the Ruby and Rails talk.  Back in the day I took a couple of the <a href="http://en.wikipedia.org/wiki/LGAT">LGAT</a> courses that covered life skills, goal setting, etc.  Other than taking a ton of money out of my bank account, they did teach me some fairly good skills and more importantly <em>ways of thinking</em> about things that I thought I&#8217;d share here.  Note that just reading may not be as effective as taking a course and getting the feel of them in the exercises.</p>
<ul>
<li><strong>Taking Responsibility</strong></li>
<li>&#8220;I hate my job&#8221;.  &#8220;I don&#8217;t have enough time&#8221;.  &#8220;That&#8217;s too early/late&#8221;.  &#8220;I&#8217;m too tired to&#8230;&#8221;  These are all excuses we use all the time.  The concept of taking responsibility is pretty simple.  Instead of making excuses, realize that if you hate your job, that&#8217;s because you are <em>choosing</em> to stay at it.  If you don&#8217;t have enough time that might be because you <em>choose</em> to watch Lost and America&#8217;s Top Model in the evenings, and if it&#8217;s &#8220;too early&#8221; that&#8217;s because you are <em>choosing</em> to not get up that early.We all have rationalizations&#8230; we can&#8217;t quit our job because the economy is in the shitter, and we really like Lost, and we went out with our friends last night so we want more than 3 hours of sleep.  Blah blah blah.  There&#8217;s all sorts of rationalizations, but sometimes it just comes down to if you it was that bad, or if you wanted it enough, you&#8217;d do it.  Until then, you have to take responsibility for your circumstances (or at least some of them).</li>
<li><strong>Goal Setting</strong></li>
<li>Setting &#8220;<a href="http://www.projectsmart.co.uk/smart-goals.html">SMART</a>&#8221; goals was a major part of these courses.  This means that you need to set goals that are <strong>S</strong>pecific, <strong>M</strong>easurable, <strong>A</strong>greed On, <strong>R</strong>ealistic and <strong>T</strong>ime based.  IE:Your goal has to be <strong>Specific</strong>, like &#8220;I will lose 10 pounds&#8221; not &#8220;I will lose weight.&#8221;  Or &#8220;My next job will pay me more than $75,000 a year&#8221; not &#8220;I will get a raise in my next job&#8221;.  Being vauge means your results will be vauge.  Having something specific will give your brain something to lock into.Tied into this is <strong>Measurable</strong>.  If you can&#8217;t measure it, or know where you are in relation to success or failure, it&#8217;s harder to achieve.  So making a goal based on something you can measure is needed.  If your goal is to get to Vancouver, you need to know where you are to know how far you have to go yet.  So unmeasurable goals are the touchy feely ones that you can&#8217;t tell if you get them or not.If you can&#8217;t <strong>Agree</strong> upon the goals, or if there is any ambiguity about them with the people you&#8217;re making the agreements with, they&#8217;ll be harder to achieve, or be enforced.
<p>If you&#8217;re not realistic and your goal isn&#8217;t <strong>Realistic</strong>, you&#8217;ll just be frustrated.  &#8220;Make a billion dollars&#8221;, &#8220;run a 2 minute mile&#8221; or &#8220;become a playboy centerfold&#8221; is probably not attainable, and you&#8217;ll end up frustrated.  Sometimes that means that smaller and more bite sized goals means you get more success and feel better about yourself.</p>
<p>If there&#8217;s not a <strong>Time</strong> limit on the goals, you won&#8217;t be able to know when you are done.  I&#8217;m sure I could make a billion dollars given enough time, but saying &#8220;I will lose 10 pounds in the next month&#8221; instead of &#8220;I will lose 10 pounds&#8221;, because at the end of the month if you don&#8217;t weigh 10 pounds less, you&#8217;ll know that you didn&#8217;t achieve your goal.  Giving yourself a time limit also gives you a kick in the ass if you see that finish line approaching.</li>
</ul>
<p>I think that&#8217;s probably enough for now.  I know it&#8217;s a bit outside of the normal TiR fare, but this sort of thing has been rolling around in my head recently <em>a lot</em> all in related to my own struggles to get stuff done and getting over the fear (not exactly the right word to be honest, more like &#8220;super delay and procrastination ability&#8221;) of new things like Rails.</p>
<p>If you can use any of this, great.  Set yourself a goal to get something done code wise, even a small one, just to get the feel of it.  Maybe &#8220;smart&#8221; goals aren&#8217;t your style, find something else that doe work.</p>
<p>Hopefully that info will help some of you out there.  Check out <a href="http://www.lifehack.org/">LifeHack.org</a> for lots more stuff like this.  It&#8217;ll be back to the code stuff tomorrow, promise <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/04/goal-setting-and-getting-things-done/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pushing Through The Wall</title>
		<link>http://thinkinginrails.com/2010/04/pushing-through-the-wall/</link>
		<comments>http://thinkinginrails.com/2010/04/pushing-through-the-wall/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 15:24:57 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=146</guid>
		<description><![CDATA[This entry was almost titled &#8220;In Which it All Comes Apart&#8221; because lately I&#8217;ve felt like all my previous forward motion with my Rails project has come to a crashing halt.  It seemed like the only time that I got work done was at the FV.rb meetups, but in the evenings I just didn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>This entry was almost titled &#8220;<strong>In Which it All Comes Apart</strong>&#8221; because lately I&#8217;ve felt like all my previous forward motion with my Rails project has come to a crashing halt.  It seemed like the only time that I got work done was at the <a href="http://www.meetup.com/fvruby/">FV.rb</a> meetups, but in the evenings I just didn&#8217;t have any drive to do anything, and on the weekend when I did, I&#8217;d think about the current couple of tasks on my plate and get&#8230; scared is about the only real word for it, and just go back to watching TV, websurfing, or whatever other thing that <em>wasn&#8217;t</em> programming Ruby and Rails.  Not a good way to go.</p>
<p>Last night I finally broke through this a bit.  Amidst my mother-in-law drilling and cutting (she&#8217;s helping my wife put up cabinets) and my brother-in-law on the couch oohing and awwing over <a href="http://vancouver.en.craigslist.ca/search/?areaID=16&amp;subAreaID=&amp;query=excavator&amp;catAbbreviation=sss">heavy equipment ads on craigslist</a>, I managed to get things done.  I figure a bit of post-mortem might help me for the next time it happens.</p>
<p>The two things that I had on my plate were not, in fact, the only things needing to be done, but they were the two things that are fairly isolated and sort of simple.</p>
<p>The first was adding &#8216;areas&#8217; to my referee site.  Each club has many fields, each field has many games.  I wanted to expand this so that each club has many areas, and each area has many fields, and so on.  Basically this allows you to break up the &#8220;Langley&#8221; club into say, north south east and west, and assign users to various areas and make things a bit more manageable.  IE: Assignor Bob manages the north zone, while Manager Sue takes care of South and East.</p>
<p><a href="http://thinkinginrails.com/wp-content/uploads/2010/04/failingtests1.png"><img class="alignright" title="Failing Tests" src="http://thinkinginrails.com/wp-content/uploads/2010/04/failingtests1.png" alt="Failing Tests" width="461" height="166" /></a>Code wise it&#8217;s pretty simple, add a new model, add the &#8220;has_many&#8221; and &#8220;belongs_to&#8221; relationships, and create the management pages.  Simple stuff, so what&#8217;s the problem?</p>
<p>I think it might have come into the testing part again.  Because I&#8217;d have to rearrange some of my queries to ensure that users get the right games from the right fields from the (now) right areas from (<em>breath)</em> the right club, having no testing set up means that I&#8217;d have to go to all the pages that access that code, redo the queries, re-test, etc.  Ugh.</p>
<p>The second task that was a real stumbling block was the user and role management.  I had set up user authentication a while back, and if you log in as one of two user types you&#8217;d end up being sent to the &#8220;correct&#8221; page, and the two different controllers (/bids and /assignments) are protected through a before_filter as well, but I hadn&#8217;t gotten around to &#8220;Management&#8221; stuff (editing games, fields, etc) yet.</p>
<p>The big mental block that I had in this area was that I had 3 fairly clearly defined roles, 4 if you include the &#8220;unauthenticated&#8221; users.  I had</p>
<ul>
<li>Referee (can bid on games)</li>
<li>Assignor (approves/edits referee bids)</li>
<li>Club Admin (club management stuff)</li>
</ul>
<p>All the stuff in the User model is geared towards these, a club_id is defined and required, email is required, etc.</p>
<p>The role that <em>wasn&#8217;t</em> so easily defined was the &#8220;master&#8221; admin.  This is the main user that would manage the whole site, set up clubs, and basically have access to <strong>everything</strong>.  I faced the challenge of either creating a new type of authentication and model (ignoring the DRY principle), putting a bunch of exceptions in (ie: requires validation of club_id <strong>unless</strong> this user has a role type of &#8216;masteradmin&#8217;) and making things ugly.</p>
<p>I managed to push through the first one, or at least start to.  I&#8217;ve managed to get to the scaffolding part anyway.  Also in my lunch hours I&#8217;ve started going at the failing tests too.  That&#8217;s a whole other blog post though, probably involving me going back to the simplest cases that are in the <a href="http://www.railstutorial.org/">Rails Tutorial</a> book and figuring out how to deal with speccing out password protected pages <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/04/pushing-through-the-wall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Need For Testing</title>
		<link>http://thinkinginrails.com/2010/04/the-need-for-testing/</link>
		<comments>http://thinkinginrails.com/2010/04/the-need-for-testing/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 03:44:30 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=137</guid>
		<description><![CDATA[In which I discover that yes Virginia, there is a good reason to write tests from the start. I think I saw testing originally as a really nice thing to do in theory, but something that was quickly glossed over when you have your boss looking over your shoulder and wondering just why your project [...]]]></description>
			<content:encoded><![CDATA[<p>In which I discover that yes Virginia, there <em>is</em> a good reason to write tests from the start.</p>
<p>I think I saw testing originally as a really nice thing to do in theory, but something that was quickly glossed over when you have your boss looking over your shoulder and wondering just why your project was late, just write the damn thing.</p>
<p>I actually discovered testing in Perl around 2003 with Test::Unit, when I was working at a company that did an online game site for school students.  I read about testing, grabbed Test::Unit and Test::More and proceeded to do add some rudimentary tests to the model to do things like ensure that instantiating a new User model always created an object of the right type, that sort of thing.</p>
<p>I proudly told my boss this.  His response was something like &#8220;neat&#8221;, with the unspoken subtext of &#8220;why aren&#8217;t you doing your work and wasting time doing this&#8221;.</p>
<p>Fast forward to the TDD happy fun world of rails.</p>
<p>I&#8217;m now a couple of weeks into my referee management site.  It&#8217;s got a non-trivial, but not hugely complex set of models and interactions and I want to make some (moderately) major changes in some of the architecture.  It <em>terrifies</em> me (well, maybe terrify is too strong a word) to make these changes without being able to just hit a button and know, <strong>know</strong>, that everything still works properly.</p>
<p>I started creating my models and controllers based on the <a href="http://www.railstutorial.org">Rails Tutorial</a> site and using the &#8220;rspec_&#8221; syntax.  IE:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">script<span style="color:#006600; font-weight:bold;">/</span>generate rspec_controller Foo</pre></div></div>

<p>This creates a set of default <a href="http://rspec.info/">RSpec</a> tests.  Of course, the defaults are standard stuff, making sure that creating the object returns the right type of object, etc. Luckily a bit later on in the book there is a section on <a href="http://www.railstutorial.org/chapters/static-pages#sec:first_tests">setting up your first tests</a>.</p>
<p>The first challenge I have to create some of my tests (again harkening back to my &#8220;rails makes it seem <em>sooo</em> easy, but when you do it it&#8217;s a lot harder&#8221; rant), is that most of the pages on the site (that do interesting things anyway) are password protected. So now it&#8217;s a trek to find out how to deal with speccing out pages that are password protected to help fix the 24 failed tests I have sitting now when I run &#8216;spec spec&#8217; <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So let that be a lesson to you all&#8230;. do your testing from the start, and set it up <strong><em>from the start</em></strong> like I should have (and knew I should have).</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/04/the-need-for-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsing URLs in Ruby and Learning to Love the Source</title>
		<link>http://thinkinginrails.com/2010/03/parsing-urls-in-ruby-and-learning-to-love-the-source/</link>
		<comments>http://thinkinginrails.com/2010/03/parsing-urls-in-ruby-and-learning-to-love-the-source/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 05:18:51 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=135</guid>
		<description><![CDATA[I&#8217;ve always heard that reading others Ruby source code is a great way to learn the language, but until recently this, like many other things that are &#8220;commonly known&#8221;, was something outside my realm of grokking. However today I was looking to convert user input URLs into something reasonable, ie: &#8220;foo.com&#8221; should be saved as [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always heard that reading others Ruby source code is a great way to learn the language, but until recently this, like many other things that are &#8220;commonly known&#8221;, was something outside my realm of grokking.  However today I was looking to convert user input URLs into something reasonable, ie: &#8220;foo.com&#8221; should be saved as &#8220;http://foo.com&#8221;, and &#8220;http://foo.com&#8221; should be stored as, well, &#8220;http://foo.com&#8221;.</p>
<p>So my mentor, or more accurately, the guy I bug with annoying noobie Ruby questions, <a href="http://twitter.com/dkubb">@dkubb</a>, pointed me to the <a href="http://addressable.rubyforge.org/">Addressable.URI</a> library.</p>
<p>I started out with his suggestion of:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">&#93;</span> = Addressable::<span style="color:#CC00FF; font-weight:bold;">URI</span>.<span style="color:#9900CC;">heuristic_parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">normalize</span></pre></div></div>

<p>But found it didn&#8217;t work quite as I wanted.  After a bit of searching <a href="http://www.ruby-forum.com/topic/140101">some blog posts</a> I found that the function I wanted was the <a href="http://addressable.rubyforge.org/api/classes/Addressable/URI.html#M000005">heuristic_parse</a>, which will try to intelligentally create a valid URI.</p>
<p>Since I&#8217;d been &#8220;in&#8221; Ruby for a few weeks now, I figured why not, and hit the &#8216;view source&#8217; button on the API page.  This was the grokking moment.  The &#8220;thinking in rails&#8221; as it were.</p>
<p>The problem I&#8217;d had before wasn&#8217;t that I didn&#8217;t read Ruby all that well, but that I didn&#8217;t have a <em>direction</em> to do it.  Randomly opening up functions, or the Rails core code, or someone&#8217;s library didn&#8217;t make nearly as much sense unless you had a reason for it.</p>
<p>You know how they say the best way to learn something is to need to use it (well, someone say something like that anyway)?  Well, this was it. I knew what I needed to do (turn &#8220;foo.com&#8221; into &#8220;http://foo.com&#8221;, I had played around with it in IRB so I knew it worked, and now I was a mouse click away from being able to read how someone did it.</p>
<p>The heuristic_parse function is only about 30 lines long, and if you can remotely read regexes, it&#8217;s competely readable.  Now I have a place to start reading, seeing how other people write code and start learning some of the common idioms that I might be missing.</p>
<p>Short story long, reading others source code is a great thing to do, as long as you have a place and a reason to start, otherwise you may just confuse yourself more.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/03/parsing-urls-in-ruby-and-learning-to-love-the-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code It Now, Fix It Later?</title>
		<link>http://thinkinginrails.com/2010/03/code-it-now-fix-it-later/</link>
		<comments>http://thinkinginrails.com/2010/03/code-it-now-fix-it-later/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 18:11:38 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=116</guid>
		<description><![CDATA[So over the last week I&#8217;ve dug into my referee site project quite a few times, mostly in small chunks over the weekend.  I&#8217;ve noticed that I have slightly less fear now, but also that now I&#8217;m starting to reach my limit of knowledge of Ruby and Rails, and find myself starting to fall back [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thinkinginrails.com/wp-content/uploads/2010/03/unicorn.jpg"><img class="alignright size-full wp-image-131" title="What My Code Will Do" src="http://thinkinginrails.com/wp-content/uploads/2010/03/unicorn.jpg" alt="What My Code Will Do" width="246" height="300" /></a>So over the last week I&#8217;ve dug into my referee site project quite a few times, mostly in small chunks over the weekend.  I&#8217;ve noticed that I have slightly less fear now, but also that now I&#8217;m starting to reach my limit of knowledge of Ruby and Rails, and find myself starting to fall back to my old hack-and-slash perl practices.</p>
<p>This isn&#8217;t all bad though.  To quote the great <a href="http://twitter.com/curtismchale">@curtismchale</a>:</p>
<blockquote><p>&#8220;getting code out is better than sitting on it forever to make it &#8216;perfect&#8217;&#8221;</p></blockquote>
<p>The idea that has permiated rails from the time I started reading about it in 2004 till now is &#8220;iterate&#8221;.  So is it bad that I have multiple authentication methods in multiple controllers, all of which do the same thing, when I can just go back and fix it later?</p>
<p>I would say, &#8220;kinda&#8221;.  The old axiom of &#8220;make it work, then make it fast&#8221; applies here, but within reason.  You don&#8217;t want to over-design, but you also don&#8217;t want to under-design.  I think the key to the iterative process is two-fold:</p>
<ol>
<li>Iterating only works if you do it fairly quickly, not say to yourself that you&#8217;ll go back and fix it and don&#8217;t get to it until the project is over.  From what I&#8217;ve seen personally it works best if I:
<ul>
<li>Finish a task</li>
<li>Go back and make it work better<small><sup>(see point 2)</sup></small></li>
<li>Or:</li>
<li>Work on something else that&#8217;s related or could affect the previous tasks design</li>
<li>&#8230;. then go back and make the first task better<small><sup>(see point 2)</sup></small></li>
</ul>
</li>
<li>You almost need, <strong><em>neeeeeeed</em><span style="font-weight: normal;"> a test driven design or at minimum, some tests.  Without tests, it can be <em>very</em> hard to tell if you&#8217;re breaking anything when you iterate.  So in a perfect world you would:</span></strong>
<ul>
<li>Write your tests</li>
<li>Code until the tests all pass</li>
<li>Go back and make it work better</li>
<li>Ensure your tests all pass</li>
</ul>
</li>
</ol>
<p>If you write code and do nothing but refactor and refactor and refactor, but never release it, is it any different than not writing the code at all?  Do you need to make it perfect before you release it to the world (note: this answer varies if you&#8217;re writing a blog entry, a web app to count your shoelace collection, or the space shuttle launch sequence)?  Does it have to be 100% optimized before you release it to the world?  Thinking of the last one, I&#8217;d say there&#8217;s a huge case for writing tests here!</p>
<p>Sometimes though, I think it&#8217;s OK to just move on the the next part of the project.  Depending on the goals (ie: is it &#8220;real&#8221; work, a personal project, a web-app just for learning, etc) it might be better use of your time to move onto the next big part of the project and know that you&#8217;ll come back later to make sure that your code is like a rainbow puking unicorn like it should be <img src='http://thinkinginrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/03/code-it-now-fix-it-later/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Letting Go the Fear Of Programming and Just Starting</title>
		<link>http://thinkinginrails.com/2010/03/letting-go-the-fear-of-programming-and-just-starting/</link>
		<comments>http://thinkinginrails.com/2010/03/letting-go-the-fear-of-programming-and-just-starting/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 18:16:41 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Fear]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thinkinginrails.com/?p=96</guid>
		<description><![CDATA[&#8230; well, the start of grokking it anyway.  Maybe it&#8217;s because I&#8217;ve finally made it over The Goatee Plateau, or maybe it just sort of clicked and all the bits and pieces that I&#8217;ve been reading about since 2004 started coming into play. More likely though, is I finally got around to stopping worrying about [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_98" class="wp-caption alignright" style="width: 257px"><a href="http://thinkinginrails.com/wp-content/uploads/2010/03/alanb.jpg"><img class="size-medium wp-image-98" title="I grew a beard, now I know Rails." src="http://thinkinginrails.com/wp-content/uploads/2010/03/alanb-247x300.jpg" alt="" width="247" height="300" /></a><p class="wp-caption-text">Over the Goatee Plateau</p></div>
<p>&#8230; well, the start of grokking it anyway.  Maybe it&#8217;s because I&#8217;ve finally made it over <a href="http://www.reddit.com/r/programming/comments/96cko/the_true_secret_to_becoming_a_better_programmer/">The Goatee Plateau</a>, or maybe it just sort of clicked and all the bits and pieces that I&#8217;ve been reading about since 2004 started coming into play.</p>
<p>More likely though, is I finally got around to stopping worrying about coding and started coding.</p>
<p>I could tell you that going through the excellent <a href="http://www.railstutorial.org">Rails Tutorial</a> site by the most awesome <a href="http://www.michaelhartl.com/">Michael Hartl</a>, gave me some confidence or addressed things differently than the thousands of other free Ruby on Rails sites out there.</p>
<p>So here&#8217;s the story.  About 3 months ago a web designer I&#8217;d worked with before brought me a project.  The project was a relatively simple, but still complex enough to be interesting, site to allow scheduling of referee&#8217;s for the local sports division.  Basically there was the need for users to schedule the games, referees to bid on the games they want to ref, and then &#8220;assignors&#8221; to select the refs to games.  There&#8217;s more to it, but that&#8217;s enough for here (I&#8217;m sure I&#8217;m boring you already).</p>
<p>The point of that is that it&#8217;s a small project without the need for any really crazy stuff, but not a super simple &#8220;we need a <a href="http://rubyonrails.org/screencasts">weblog in 15 minutes</a>&#8221; type requests.  Additionally, there was enough complexity in the project that doing it in my primary language and framework, Perl and <a href="http://www.masonhq.com/">HTML::Mason</a> was something that I&#8217;d consider actual &#8220;work&#8221;, and I got the same cold shiver I get when contract clients come to me with &#8220;just one quick little change&#8230;&#8221;.</p>
<p>So I told her that I&#8217;d do it, and work on it.  There wasn&#8217;t a deadline, or any agreement on money, and I took this as a learning &#8220;fun&#8221; project with the only thing that I was planning to <em>really</em> get out of it was knowledge.  A couple of days later I set up a <a href="http://heroku.com">Heroku</a> account, and uploaded an initial set of files (the result of a &#8220;rails &lt;sitename&gt;&#8221; essentially) without any changes or additions.</p>
<p>And it sat there for 2 months.</p>
<p>I was <em>terrified</em> of doing something with it.  As I&#8217;ve written before the Ruby on Rails world has changed since 2004.  It used to be a relatively small ecosystem around 2004 when all your code was auto-generated and all you needed to know was the syntax of an &#8220;each&#8221; loop in Ruby.  Now it&#8217;s a huge and complex world of Cucumber tests that write their own tests, NoSQL and Mongo databases, Markdown and Textile, and about a thousand other gems, plugins and libraries that may or may not help you out with whatever it is you&#8217;re doing.</p>
<p>Terrified by the choices available maybe?</p>
<p>A couple of weeks later I actually started out doing a bit of work while at a <a href="http://tr.im/ruby">Fraser Valley Ruby Brigade</a> meeting.  Nothing special, just creating some of the models required and trying to get them properly related to each other.  However, after creating the scaffolding I still had that feeling that I really didn&#8217;t know what I was up to, I froze up again.  My brain kept on jumping forward into all the &#8220;hows&#8221;.</p>
<p>&#8220;How will I put all this under the old familiar &#8220;/admin&#8221; setup when all the routes are /referees/ and /fields/ and /games/?&#8221;</p>
<p>&#8220;If I set up all the smaller models (ie: a list of pay scales) do I need to set up scaffolding for those too? Where do they go?&#8221;</p>
<p>&#8220;How will I set up the user authentication?  What will I use?  How do I set up my models ahead of time to make sure I don&#8217;t shoot myself in the foot for this?&#8221;</p>
<p>And it sat there for another month.</p>
<p>Then last week I made a breakthrough of sorts.  I&#8217;m not sure if it was going through the <a href="http://www.railstutorial.org">Rails Tutorial</a>, or the awesome <a href="http://datamapper.org/">DataMapper</a> ninja <a href="http://twitter.com/dkubb">@dkubb</a> giving me the great advice of (paraphrased)</p>
<blockquote><p>&#8220;Just do it in as simple a way as possible, whatever design you come up with will be wrong, so make sure you do the minimum of work to get it working so there&#8217;s that less code to change when you come up with a better design.&#8221;</p></blockquote>
<p>Something in there got through and I just started&#8230; &#8220;getting&#8221; it.  I started with the highest level of object I could think of (in this case, the fields that the games would be played on) and created that, then created a main page that would show them.  Then the next level of object (games) and connected them.  Then the next and the next.  So far I&#8217;ve really not done a huge amount more than hand writing the scaffolding that rails does for you anyway, but using some of the techniques in the Rails Tutorial I have slowly been iterating my way forward.</p>
<p>One big hole in this project has been testing.  Even though the Rails Tutorial starts almost right away with doing <a href="http://rspec.info/">RSpec</a> tests I haven&#8217;t put those in.  I also have avoided doing any &#8220;real&#8221; work on the site, doing other than the scaffolding type stuff.  But still, not having to worry about needing the generators to create views, and knowing what I need to add to a controller to have something start working has been an amazing weight off my shoulders.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinginrails.com/2010/03/letting-go-the-fear-of-programming-and-just-starting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

