<?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>The Hobo Blog &#187; Motivation</title>
	<atom:link href="http://hobocentral.net/blog/category/motivation/feed/" rel="self" type="application/rss+xml" />
	<link>http://hobocentral.net/blog</link>
	<description>Hobo - the web app builder for Rails</description>
	<lastBuildDate>Tue, 24 Apr 2012 15:48:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>All You Need is CRUD?</title>
		<link>http://hobocentral.net/blog/2006/11/17/all-you-need-is-crud/</link>
		<comments>http://hobocentral.net/blog/2006/11/17/all-you-need-is-crud/#comments</comments>
		<pubDate>Fri, 17 Nov 2006 22:09:23 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Motivation]]></category>

		<guid isPermaLink="false">http://hobotek.net/blog/2006/11/17/all-you-need-is-crud/</guid>
		<description><![CDATA[DHH, as you probably heard, has learnt to stop worrying and love the CRUD. I&#8217;m very much in agreement. The idea of replacing the actions add_member and remove_member (or would that be join_group and leave_group?) with Membership#create and Membership#destroy was the final light switch that got me to a place I&#8217;d been striving for.

The generic [...]]]></description>
			<content:encoded><![CDATA[<p>DHH, as you probably heard, has learnt to stop worrying and love the CRUD. I&#8217;m very much in agreement. The idea of replacing the actions <code>add_member</code> and <code>remove_member</code> (or would that be <code>join_group</code> and <code>leave_group</code>?) with <code>Membership#create</code> and <code>Membership#destroy</code> was the final light switch that got me to a place I&#8217;d been striving for.</p>

<p>The generic controller. A standard implementation of the CRUD actions that can be used out-of-the-box in a large majority of cases.</p>

<p><span id="more-12"></span></p>

<p>The idea is that the concrete controllers that make up an application will need no custom code at all &#8212; just a few declarations:  I need an auto-completer for this attribute, an ajax-setter for that one&#8230; I don&#8217;t see why this can&#8217;t be done.</p>

<p>Of course if an application needs to do something unusual, then sure you might want a custom action or two. But a huge number of apps are really nothing more than a web-interface to a database, and nearly all apps have at least some parts that fit this description.</p>

<p>There are a couple of challenges though. Firstly, what should these standard actions render? It&#8217;s all very well to have a single URL that you hit to, say, create a new event in your calendar, but depending on where in your app you&#8217;re coming from, you&#8217;re likely to want a different page (or ajax update) to follow.</p>

<p>Simple answer &#8211; parameterise it. Have the browser request &#8220;create me a new event, then refresh parts a, b, and c of my page&#8221;. That functionality is now part of Hobo and seems to work great. As well as getting us closer to a fully generic controller, this idea has also yielded a very simple approach to ajax.</p>

<p>Another problem I&#8217;ve hit is that sometimes an application feature requires a whole graph of related models be created in one go. The solution to that one has been to extend the way ActiveRecord handles the hash you pass to <code>MyModel.new</code>. With Hobo&#8217;s ActiveRecord extensions, that single call to <code>new</code> can set up arbitrary relationships with other models, either existing or new.</p>

<p>This post is light on technical details (all will be revealed), but it sets the stage for what I want to waffle about next &#8212; Hobo&#8217;s support for ajax. I think Hobo&#8217;s approach will make ajax programming easier than with anything else out there.</p>

<p>Just had a good week delivering a Rails training course for Skills Matter in London, but of course that meant little progress with Hobo. Next week it&#8217;s full steam ahead!</p>
]]></content:encoded>
			<wfw:commentRss>http://hobocentral.net/blog/2006/11/17/all-you-need-is-crud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why DRYML?</title>
		<link>http://hobocentral.net/blog/2006/11/10/why-dryml/</link>
		<comments>http://hobocentral.net/blog/2006/11/10/why-dryml/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 16:30:55 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Motivation]]></category>

		<guid isPermaLink="false">http://hobotek.net/blog/?p=6</guid>
		<description><![CDATA[DRYML: The Dont-Repeat-Yourself Markup Language. In case you hadn&#8217;t guessed, we&#8217;re intending to bring a higher level of re-use to Rails&#8217; views.

Why? Rails already has a bunch of mechanisms for re-use within views. Namely: layouts, partials and helpers. Each serves a different purpose, and yet, IMHO, there&#8217;s still a gap. I find that small fragments [...]]]></description>
			<content:encoded><![CDATA[<p>DRYML: The Dont-Repeat-Yourself Markup Language. In case you hadn&#8217;t guessed, we&#8217;re intending to bring a higher level of re-use to Rails&#8217; views.</p>

<p>Why? Rails already has a bunch of mechanisms for re-use within views. Namely: layouts, partials and helpers. Each serves a different purpose, and yet, IMHO, there&#8217;s still a gap. I find that small fragments of mark-up tend to crop up over and over in my views. Yes I could extract them into paritals or helpers, but I find myself disinclined to do so.</p>

<p><span id="more-6"></span></p>

<p>Helpers are good for small bits of dynamic content, but not so convenient for re-use of HTML fragments &#8211; I don&#8217;t really want to embed loads of HTML in strings in Ruby source. Nor do I want to make excessive use of the <code>tag</code> helper. I want to put mark-up in mark-up files.</p>

<p>So partials would be appropriate. But each partial needs it&#8217;s own file, which again discourages me from making heavy use of them.</p>

<p>Finally, and prefixed with a big ol&#8217; IMHO &#8212; dang are those ERB scriptlets ever ugly! If you ever needed to call a helper passing in HTML mark-up in the parameters, that&#8217;s HTML within Ruby within HTML &#8212; not pretty. Hey, it works right? This is not a criticism of ERB. The syntax used (<code>&lt;%= ... %&gt;</code>) is like that for a reason. ERB doesn&#8217;t need fixing. DRYML supports ERB scriptlets, but allows you to hide them away behind nice clean custom tags, leaving you with beautiful clean templates [swoon] where you can see what&#8217;s going on at a glance. </p>

<p>Defining a tag essentially just creates a new helper method for you, and a use of that tag is nothing more than a call to that helper. This is just syntax. Witness:</p>

<h4>hello_world.dryml</h4>

<pre><code>&lt;def tag="hello"&gt;Hello World!&lt;/def&gt;

&lt;p&gt;Here it is: &lt;hello/&gt;&lt;/p&gt;

&lt;p&gt;And here it is again: &lt;%= hello %&gt;&lt;/p&gt;
</code></pre>

<p>Groovy baby :-)</p>

<p>(check out the <a href="/blog/2006/11/10/hello-world-2/">Hello World</a> post to see how to get set up so you can try this)</p>

<p>And just as you can call a tag from Ruby instead of mark-up, you can define them in Ruby if you wish. You can do so in your helpers. Try this</p>

<h4>app/helpers/application_helper.rb</h4>

<pre><code>module ApplicationHelper

  include Hobo::DefineTags

  def_tag :from_ruby do
    "As easy as that eh?"
  end

end
</code></pre>

<p>That will give you a <code>&lt;from_ruby/&gt;</code> tag in all of your DRYML templates. If your tag contains more code than mark-up, it&#8217;s cleaner to define it in a module like this.</p>

<p>You could even define the tag in a helper module and call it from an ERB scriptlet, but that would be kinda strange&#8230; Hey &#8212; knock yourself out, it&#8217;s all good :-)</p>

<p>I&#8217;m trying not to get ahead of myself because there&#8217;s a <a href="/blog/2006/11/10/guide-to-dryml/">Quick Guide to DRYML</a> coming right up. I just want to show you that this is just a thin layer on top of your regular Rails template. They&#8217;re just purdier is all. </p>

<p>Actually there&#8217;s a lot more under the hood in DRYML &#8212; it&#8217;s not just syntax. We&#8217;ll get there.</p>
]]></content:encoded>
			<wfw:commentRss>http://hobocentral.net/blog/2006/11/10/why-dryml/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How fast is fast enough?</title>
		<link>http://hobocentral.net/blog/2006/11/06/how-fast-is-fast-enough/</link>
		<comments>http://hobocentral.net/blog/2006/11/06/how-fast-is-fast-enough/#comments</comments>
		<pubDate>Mon, 06 Nov 2006 15:25:22 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Motivation]]></category>

		<guid isPermaLink="false">http://hobotek.net/blog/?p=3</guid>
		<description><![CDATA[

Bud Fox: How much is enough?

Gordon Gekko: It&#8217;s not a question of enough, pal. It&#8217;s a zero sum game, somebody wins, somebody loses. Money itself isn&#8217;t lost or made, it&#8217;s simply transferred from one perception to another.



I&#8217;m a bit of a Gordon Gekko myself when it comes to programming. Greed is good. Remember? Greed works. [...]]]></description>
			<content:encoded><![CDATA[<blockquote>

<p><b><a href="http://www.imdb.com/name/nm0000221/">Bud Fox</a></b>: How much is enough?</p>

<p><b><a href="http://www.imdb.com/name/nm0000140/">Gordon Gekko</a></b>: It&#8217;s not a question of enough, pal. It&#8217;s a zero sum game, somebody wins, somebody loses. Money itself isn&#8217;t lost or made, it&#8217;s simply transferred from one perception to another.</p>

</blockquote>

<p>I&#8217;m a bit of a Gordon Gekko myself when it comes to programming. Greed is good. Remember? Greed works. I&#8217;m greedy for speed. Seems to me pretty reasonable that I should be able to build a nice looking, usable, fully-ajaxified database app in what? A couple of hours? That would be fast enough. Then I&#8217;d be satisfied [grin].</p>

<p><span id="more-3"></span></p>

<p>To be clear, I&#8217;m only talking about a basic front end to a database here. You know the drill: create, update, delete, link things together. A blog, a simple content management system, a shop, an events diary, an issue tracker&#8230; The list goes on and on. All these kinds of sites are overwhelmingly similar. If I&#8217;m having to sweat a lot of code to get a site like this working, surely I must be repeating myself from the last site I built? Real programmers don&#8217;t repeat themselves. (Got that? I said: real programmers don&#8217;t repeat themselves)</p>

<p>Of course, any <em>interesting</em> web app is going to need a bunch of code to make it tick. Your job aint going anywhere just yet Mr. Programmer (except to Bangalore of course). I just don&#8217;t want to waste my life hacking on <em>uninteresting</em> sites. Or to be more accurate, on the uninteresting parts (there are a lot!) of my otherwise brain-meltingly exciting sites.</p>

<p>In fact there&#8217;s a bunch of stuff out there that will <i>build a database front-end for you</i>, in an instant. The Python world has Django, and the same for Rails is not far off. The Streamlined guys seem to be doing a great job. With one caveat: it&#8217;s called an Admin Interface. Not for public consumption.</p>

<p>So if an admin interface can be derived automatically from the data model, surely a genuine end-user interface can&#8217;t take that long? They are mere mortals, I believe, these administrators.</p>

<p>This is exactly what Hobo is trying to achieve &#8211; to take the automation of the out-of-the-box admin interface along with the flexibility of hand-coded views, and mix &#8216;em up in a big &#8216;ol pot to see what comes out.</p>

<p>Like the Scriptaculous guys have it &#8211; it&#8217;s about the user interface, baby!</p>

<p>This pretty much reflects my experience with hacking on Rails apps. The data-layer has been reduced to blissful simplicity. The move to CRUD as a design strategy makes the idea of a one-size-fits-all controller look pretty doable. But the views&#8230; I seem to spend 80% of my time hacking view code.</p>

<p>Not for much longer! :-)</p>

<p>Soon I&#8217;ll be able to say:</p>

<pre><code>&lt;page title="search"&gt;
  &lt;hey_cut_the_drama_and_give_me_a_search_page_already/&gt;
&lt;/page&gt;
</code></pre>

<pre><code>&lt;page tile="Search"&gt;
  &lt;hey_cut_the_drama_and_give_me_a_search_page_already/&gt;
&lt;/page&gt;</code></pre>

<p>Of course, it&#8217;s all open-source so if it works, please help yourselves :-)</p>

<p>Feeling greedy?</p>

<p>(p.s. What a load of old waffle eh?! I&#8217;ll make sure the next post has some actual content. Y&#8217;know, like, er, code and stuff)</p>
]]></content:encoded>
			<wfw:commentRss>http://hobocentral.net/blog/2006/11/06/how-fast-is-fast-enough/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

