<?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"
	>

<channel>
	<title>jan.varwig</title>
	<atom:link href="http://jan.varwig.org/feed" rel="self" type="application/rss+xml" />
	<link>http://jan.varwig.org</link>
	<description>Somewhere between Hello World and Hal 9000</description>
	<pubDate>Sun, 04 May 2008 15:03:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Reverse ORM</title>
		<link>http://jan.varwig.org/archiv/reverse-orm</link>
		<comments>http://jan.varwig.org/archiv/reverse-orm#comments</comments>
		<pubDate>Sun, 04 May 2008 15:03:45 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/?p=81</guid>
		<description><![CDATA[That Object-Relational-Mapping is a difficult Problem is not news.

The usual criticisms are all valid, but what occured to me, after thinking a while about this, is that all approaches I&#8217;ve seen so far seem oriented to the object-oriented modeling, trying to map the OO-models to database relations.

What about tackling the problem from the other side? [...]]]></description>
			<content:encoded><![CDATA[<p>That Object-Relational-Mapping is a difficult Problem is <a href="http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx">not news</a>.</p>

<p>The usual criticisms are all valid, but what occured to me, after thinking a while about this, is that all approaches I&#8217;ve seen so far seem oriented to the object-oriented modeling, trying to map the OO-models to database relations.</p>

<p>What about tackling the problem from the other side? Relations can have huge benefits over object graphs, why not leverage their strengths and, instead of mapping OO to relations, just try to use OO to make dealing with relations easier and more natural in OO languages?</p>

<p>Relational logic is powerful and relatively easy to understand. There are just a few annoyances that should be addressed:</p>

<ul>
<li>Validation</li>
<li>Mapping relations to forms</li>
<li>Keeping track of associations</li>
</ul>

<p>This wasn&#8217;t in any way thought through by me, it just came to my mind. Maybe there are already some solutions that go this route, maybe someone even proved this to be impractical. The approach seems worth investigating.</p>

<p>&#8230;as soon as I find the time :(</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/reverse-orm/feed</wfw:commentRss>
		</item>
		<item>
		<title>Language design philosophy: more than one way?</title>
		<link>http://jan.varwig.org/archiv/language-design-philosophy-more-than-one-way</link>
		<comments>http://jan.varwig.org/archiv/language-design-philosophy-more-than-one-way#comments</comments>
		<pubDate>Tue, 04 Mar 2008 09:40:03 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<category><![CDATA[perl]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/language-design-philosophy-more-than-one-way</guid>
		<description><![CDATA[Ola Bini manages to express my feelings about the difference between Ruby and Python:


  So what&#8217;s the point? Well, the point is Ruby. In fact, Ruby has almost all of the flexibility of Perl to do things in different ways. But at the end of the day, none of the Perl problems tend to [...]]]></description>
			<content:encoded><![CDATA[<p>Ola Bini manages to express my feelings about the difference between Ruby and Python:</p>

<blockquote>
  <p>So what&#8217;s the point? Well, the point is Ruby. In fact, Ruby has almost all of the flexibility of Perl to do things in different ways. But at the end of the day, none of the Perl problems tend to show up. Why is this? And why do I feel so comfortable in Ruby&#8217;s &#8220;There is more than one way to do it&#8221; philosophy, while the Perl one scares me?</p>
  
  <p>I think it comes down to language design. The Python approach is impossible for the simple reason that what the language designer chooses is going to be the &#8220;one way&#8221;, by fiat. Some people will agree, and some will not. But what I&#8217;m seeing in Ruby is that the many ways have been transformed into idioms and guidelines. There are no hard rules, but the community have evolutionary evolved idioms that work and found out many of the ways that doesn&#8217;t work. This seems to be the right way - if you do the choice as a language designer, you have actually chosen the people that will use your language: that&#8217;s going to be the persons who doesn&#8217;t dislike the language designers choices. But if you leave it open enough for evolutionary community design to happen you can actually get the best of both world: both a best way to do things, and something that works for a much larger percentage of the programmer world.</p>
</blockquote>

<p>&#8211; <a href="http://ola-bini.blogspot.com/2008/02/language-design-philosophy-more-than.html">http://ola-bini.blogspot.com/2008/02/language-design-philosophy-more-than.html</a></p>

<p>I like constraints, they can be liberating, but I also want to be treated as a grownup when it comes to breaking them. So Ruby&#8217;s socially suggested guidelines are much more comfortable to work with than Python&#8217;s enforced style.</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/language-design-philosophy-more-than-one-way/feed</wfw:commentRss>
		</item>
		<item>
		<title>I need to give this emacs-thingie a shot</title>
		<link>http://jan.varwig.org/archiv/i-need-to-give-this-emacs-thingie-a-shot</link>
		<comments>http://jan.varwig.org/archiv/i-need-to-give-this-emacs-thingie-a-shot#comments</comments>
		<pubDate>Thu, 24 Jan 2008 21:02:25 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/i-need-to-give-this-emacs-thingie-a-shot</guid>
		<description><![CDATA[http://platypope.org/yada/emacs-demo/ ;-)

I actually tried emacs before but didn&#8217;t stick with it long enough to really learn anything.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://platypope.org/yada/emacs-demo/">http://platypope.org/yada/emacs-demo/</a> ;-)</p>

<p>I actually tried emacs before but didn&#8217;t stick with it long enough to really learn anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/i-need-to-give-this-emacs-thingie-a-shot/feed</wfw:commentRss>
		</item>
		<item>
		<title>Reg Braithwaite: Which theory fits the evidence?</title>
		<link>http://jan.varwig.org/archiv/reg-braithwaite-which-theory-fits-the-evidence</link>
		<comments>http://jan.varwig.org/archiv/reg-braithwaite-which-theory-fits-the-evidence#comments</comments>
		<pubDate>Wed, 16 Jan 2008 09:26:22 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/reg-braithwaite-which-theory-fits-the-evidence</guid>
		<description><![CDATA[  One school is that everything is fully deterministic in practice (“Theory D”). If development appears, from the outside, to be probabilistic, it is only because we haven’t discovered the “hidden variables” that fully determine the outcome of software development projects. And, since we are talking about development in practice, it is practical to [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>One school is that everything is fully deterministic in practice (“Theory D”). If development appears, from the outside, to be probabilistic, it is only because we haven’t discovered the “hidden variables” that fully determine the outcome of software development projects. And, since we are talking about development in practice, it is practical to measure the variables that determine the outcome such that we can predict that outcome in advance.</p>
  
  <p>The other school of thought is that development is fully probabilistic in practice (“Theory P”), that there are no hidden variables that could be used to predict with certainty the outcome of a software development project. Theory P states that the time and effort required to measure all of the variables influencing a software development project precisely enough to predict the outcome with certainty and in advance exceeds the time and effort required develop the software.</p>
</blockquote>

<p>&#8230;</p>

<blockquote>
  <p>To date, Theory P is the clear winner on the evidence, and it’s not even close. Like any reasonable theory, it explains what we have observed to date and makes predictions that are tested empirically every day.</p>
  
  <p>Theory D, on the other hand, is the overwhelming winner in the marketplace, and again it’s not even close. The vast majority of software development projects are managed according to Theory D, with large, heavyweight investments in design and planning in advance, very little tolerance for deviation from the plan, and a belief that good planning can make up for poor execution by contributors.</p>
  
  <p>Does Theory D reflect reality? From the perspective of effective software development, I do not believe so. However, from the perspective of organizational culture, theory D is reality, and you ignore it at your peril.</p>
</blockquote>

<p>&#8211; <a href="http://weblog.raganwald.com/2007/06/which-theory-first-evidence.html">http://weblog.raganwald.com/2007/06/which-theory-first-evidence.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/reg-braithwaite-which-theory-fits-the-evidence/feed</wfw:commentRss>
		</item>
		<item>
		<title>One of those nights</title>
		<link>http://jan.varwig.org/archiv/one-of-those-nights</link>
		<comments>http://jan.varwig.org/archiv/one-of-those-nights#comments</comments>
		<pubDate>Thu, 03 Jan 2008 14:27:31 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[on Rails]]></category>

		<category><![CDATA[avi bryant]]></category>

		<category><![CDATA[evan phoenix]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[randal schwartz]]></category>

		<category><![CDATA[rubinius]]></category>

		<category><![CDATA[seaside]]></category>

		<category><![CDATA[smalltalk]]></category>

		<category><![CDATA[zed shaw]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/one-of-those-nights</guid>
		<description><![CDATA[Last night Zed Shaws Rails is a Ghetto Shitstorm was brought to my attention.
Zeds rant provides enough meat for a post of its own but it&#8217;s not what I want to write about today.
Following some comments on Zed article on Technorati I stumbled (again) into one of those evenings full of great discoveries.

Git

Shortly before Git [...]]]></description>
			<content:encoded><![CDATA[<p>Last night Zed Shaws <a href="http://www.zedshaw.com/rants/rails_is_a_ghetto.html">Rails is a Ghetto</a> Shitstorm was brought to my attention.
Zeds rant provides enough meat for a post of its own but it&#8217;s not what I want to write about today.
Following some comments on Zed article on Technorati I stumbled (again) into one of those evenings full of great discoveries.</p>

<h2>Git</h2>

<p>Shortly before <a href="http://git.or.cz/">Git</a> became really popular some months ago, I had become interested in <a href="http://www.darcs.net/">darcs</a> and distributed revision control systems in general.
The topic is kinda difficult though and none of the texts I was reading at the time could really communicate the benefits of DRCS to me.
I always had some gripes about svn but it wasn&#8217;t clear to me how DRCS were able to solve them.</p>

<p>I lost interest, following posts about git only loosely until last night a colleague pointed me to <a href="http://video.google.com/videoplay?docid=1251251453592758541">Randal Schwartz&#8217; Git presentation at Google Tech Talks</a>. Holy crap, I need to check this out. What appeals most to me:</p>

<ul>
<li><strong>The ability to have the entire repository available locally</strong><br />
I was extremely sceptical when I first heard about this, but when Schwartz claimed that the entire repository of the linux kernel is half the size of a checkout I was sold.</li>
<li><strong>Subversion interoperability</strong><br />
Didn&#8217;t know about this before. Makes the transition much easier.</li>
<li><strong>Having local-only repositories inside your working dir</strong><br />
I have many smaller projects that I&#8217;d love to keep locally contained. In Subversion I always had to create a repository on my server for everything.</li>
<li><strong>Other small things</strong><br />
High compression, the simple database system behind git, the optimization for speed, staged commits, the ability to completely erase files from a repository (e.g. stuff not intended for publication, something that was very hard to do on subversion), the placement of <em>all</em> metadata in a single directory (opposed to littering every dir in the working copy with <code>.svn</code> directories)</li>
</ul>

<p>Despite some shortcomings that was enough to make me install git on my mac (<code>sudo port install git-core</code>). I&#8217;m eager to check it out later today.</p>

<h2>Smalltalk and Seaside</h2>

<p>Ever since watching Evan Phoenix <a href="http://rubyconf2007.confreaks.com/d2t1p3_rubinius.html">Rubinius Presentation</a> at RubyConf 2007 and listening to Avi Bryants <a href="http://itc.conversationsnetwork.org/shows/detail3432.html">Smalltalk&#8217;s Lessons for Ruby</a> Keynote from RailsConf 2007 I&#8217;ve been curious about Smalltalk. I mean, I was curious about it before, after all it&#8217;s probably the language that has the most influence on what I&#8217;m doing today (through its promotion of object-orientation and through providing key principles behind ruby), but since listening to Avi and Evan I&#8217;ve become really interested in VM implementations (see <a href="http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_imp_toc.html">Smalltalk-80: The Language and Its Implementation</a> for an excellent in-depth description of the orignal Smalltalk-80 interpreter) and real world usage of smalltalk.</p>

<p>To be honest, as much as I love Ruby as a language, its implementations all suck. And Evan explained why: Implementing most of the base language on another Platform (C for MRI, Java for JRuby) turns out to be a leaky abstraction when you want to extend the language. Additionally, as pure and beautiful the Ruby language is in concept, as ugly is its implementation. On the one hand, what I like so much about Ruby is its conceptual purity, its very limited set of axioms, syntax and exceptions from its own rules, on the other hand, this purity is not present in the interpreter when high-level data structures (like arrays and hashes) are implemented in C for performance reasons. Smalltalk has always had a strong philosophy of implementing as much as possible in Smalltalk itself and only resorting to C for a minimal subset (<a href="http://www.cincomsmalltalk.com/userblogs/avi/blogView?showComments=true&amp;entry=3284695382">&#8220;Turtles all the way down&#8221;</a>).</p>

<p><a href="http://www.rubini.us/">Rubinius</a> aims to implement a Ruby interpreter on the design principles of smalltalk. I love the project and there seem to be only the most brilliant people working on it (Evan Phoenix, Eric Hodel, Ryan Davis and others, full time). As many others have said already, Rubinius is likely to become the main Ruby implementation if they manage to take off (and they will undoubtedly).</p>

<p>Yet, something was bugging me: If Ruby and Smalltalk are so similar, if Smalltalk has been around, specified and stable for 25 years in many different, <em>compatible</em> implementations, commercial <em>and</em> open source, why take the long route and bend Ruby to look like Smalltalk? Why not use Smalltalk directly? These questions became even more nagging after reading Randal Schwartz&#8217; (yeah, the guy who sold me on Git earlier) <a href="http://methodsandmessages.vox.com/library/post/transcript-show-hello-world-cr.html">Transcript show: &#8216;Hello, world!&#8217;, cr</a>
and <a href="http://www.akitaonrails.com/">Fabio Akita</a>s excellent Interview with Avi Bryant (<a href="http://www.akitaonrails.com/2007/12/15/chatting-with-avi-bryant-part-1">part 1</a>, <a href="http://www.akitaonrails.com/2007/12/22/chatting-with-avi-bryant-part-2">part 2</a>).
Listening to yet <em>another</em> chat with Avi (linked in the second part of Fabio&#8217;s interview) at <a href="http://twit.tv/floss21">Floss Weekly</a> (with Randal Schwartz again, highly recommended) before falling asleep I finally decided to check out <a href="http://www.squeak.org/">Squeak</a>, the (most popular?) opensource Smalltalk implementation. I was amazed at the simplicity of the installation: Download the VM, Download the Squeak image, load the image into the VM, done.</p>

<p>I have read about <a href="http://www.seaside.st/">Seaside</a>, Avi&#8217;s web development framework, before, mainly in reagard to it&#8217;s clever use of continuations, but some of the stuff he described at Floss sound almost too good to be true. Live debugging of your app <em>in the browser</em> ? With hot code swapping over the wire? And I thought Rails&#8217; rdebug integration was great.</p>

<p>Well, at 2am I was finally falling asleep but the stuff I&#8217;ve been discovering will probably keep me occupied for quite some time.
As I explore and discover more about the topics mentioned, I&#8217;ll report my findings here on my blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/one-of-those-nights/feed</wfw:commentRss>
		</item>
		<item>
		<title>Avi Bryant on Smalltalk</title>
		<link>http://jan.varwig.org/archiv/avi-bryant-on-smalltalk</link>
		<comments>http://jan.varwig.org/archiv/avi-bryant-on-smalltalk#comments</comments>
		<pubDate>Wed, 02 Jan 2008 21:16:39 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<category><![CDATA[avi bryant]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[smalltalk]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/avi-bryant-on-smalltalk</guid>
		<description><![CDATA[  What clicked about Smalltalk was a few things: one was simply the maturity, both of the community and of the technology. Smalltalk implementations have been refined over the last 25 years, and they’ve really benefited from it.
  
  One of the major benefits, in my opinion, is that Smalltalk VMs are [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>What clicked about Smalltalk was a few things: one was simply the maturity, both of the community and of the technology. Smalltalk implementations have been refined over the last 25 years, and they’ve really benefited from it.</p>
  
  <p>One of the major benefits, in my opinion, is that Smalltalk VMs are fast enough that it’s reasonable to implement all of the standard libraries – Array, Hash, Thread, and so on – in Smalltalk itself. So there’s no barrier where you switch from your Ruby code to the underlying C implementation; it’s “turtles all the way down”. This may not seem like a big deal but once you have it, it’s really hard to give it up.</p>
</blockquote>

<p>&#8230;</p>

<blockquote>
  <p>In Smalltalk, you don’t have to choose one file layout or order of methods and classes in your code; you’re constantly switching views on what’s basically a database of code.</p>
  
  <p>My friend Brian Marick hates this, because you lose any “narrative” that might have existed by putting the code in a certain order in the file, and it’s hard to get used to, but for me, it’s the ultimate power tool for hacking on a large code-base.</p>
</blockquote>

<p>&#8211; <a href="http://www.akitaonrails.com/2007/12/15/chatting-with-avi-bryant-part-1">http://www.akitaonrails.com/2007/12/15/chatting-with-avi-bryant-part-1</a><br />
&#8211; <a href="http://www.akitaonrails.com/2007/12/22/chatting-with-avi-bryant-part-2">http://www.akitaonrails.com/2007/12/22/chatting-with-avi-bryant-part-2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/avi-bryant-on-smalltalk/feed</wfw:commentRss>
		</item>
		<item>
		<title>Giles Bowkett: I&#8217;m Bad, I&#8217;m Nationwide: Job Security vs. Career Security</title>
		<link>http://jan.varwig.org/archiv/giles-bowkett-im-bad-im-nationwide-job-security-vs-career-security</link>
		<comments>http://jan.varwig.org/archiv/giles-bowkett-im-bad-im-nationwide-job-security-vs-career-security#comments</comments>
		<pubDate>Wed, 02 Jan 2008 19:51:18 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/giles-bowkett-im-bad-im-nationwide-job-security-vs-career-security</guid>
		<description><![CDATA[  Long story short, the key to being bad and nationwide is to do something useful. Create something new, that definitely came from you, that other people value. Rails, Adhearsion, or even just a blog. This simple step is much more important than most people realize. It has to trace back to you personally, [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>Long story short, the key to being bad and nationwide is to do something useful. Create something new, that definitely came from you, that other people value. Rails, Adhearsion, or even just a blog. This simple step is much more important than most people realize. It <em>has</em> to trace back to you <em>personally</em>, or it&#8217;s <em>useless</em> for your career. <strong>As programmers, we are in the position of working for people who do not have the ability to determine whether or not we are good at our jobs.</strong> <a href="http://www.paulgraham.com/gh.html"><em>Even other programmers sometimes have trouble figuring out who is or isn&#8217;t a good programmer.</em></a> For potential managers and/or potential clients, the hiring and firing processes are <strong>both</strong> essentially random, <em>unless</em> you have some obvious distinguishing feature. That makes marketing yourself <em>essential</em></p>
</blockquote>

<p>&#8211; <a href="http://gilesbowkett.blogspot.com/2007/10/im-bad-im-nationwide-job-security-vs.html">http://gilesbowkett.blogspot.com/2007/10/im-bad-im-nationwide-job-security-vs.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/giles-bowkett-im-bad-im-nationwide-job-security-vs-career-security/feed</wfw:commentRss>
		</item>
		<item>
		<title>(Not) Managing Software Developers</title>
		<link>http://jan.varwig.org/archiv/not-managing-software-developers</link>
		<comments>http://jan.varwig.org/archiv/not-managing-software-developers#comments</comments>
		<pubDate>Mon, 24 Dec 2007 17:55:09 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Tumblecontent]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/not-managing-software-developers</guid>
		<description><![CDATA[  Ironically, &#8220;I want to be a manager&#8221; is just about the worst sentiment a would-be manager could possibly express, because the statement has absolutely nothing to do with leadership. A leader doesn&#8217;t fixate on management, which is after all just a bureaucratic framework that attempts to simulate leadership through process and protocol.


http://steve-yegge.blogspot.com/2006/05/not-managing-software-developers.html

also

http://steve-yegge.blogspot.com/2006/03/moores-law-is-crap.html
]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>Ironically, &#8220;I want to be a manager&#8221; is just about the worst sentiment a would-be manager could possibly express, because the statement has absolutely nothing to do with leadership. A leader doesn&#8217;t fixate on management, which is after all just a bureaucratic framework that attempts to simulate leadership through process and protocol.</p>
</blockquote>

<p><a href="http://steve-yegge.blogspot.com/2006/05/not-managing-software-developers.html">http://steve-yegge.blogspot.com/2006/05/not-managing-software-developers.html</a></p>

<p>also</p>

<p><a href="http://steve-yegge.blogspot.com/2006/03/moores-law-is-crap.html">http://steve-yegge.blogspot.com/2006/03/moores-law-is-crap.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/not-managing-software-developers/feed</wfw:commentRss>
		</item>
		<item>
		<title>REST in Place</title>
		<link>http://jan.varwig.org/archiv/rest-in-place</link>
		<comments>http://jan.varwig.org/archiv/rest-in-place#comments</comments>
		<pubDate>Sun, 23 Dec 2007 13:57:01 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[on Rails]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[inplace editor]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[prototype]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rest]]></category>

		<category><![CDATA[ror]]></category>

		<category><![CDATA[rubyonrails]]></category>

		<category><![CDATA[web-2.0]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/rest-in-place</guid>
		<description><![CDATA[In Ajax vs. REST I wrote about my ideas for a RESTful inplace editor.

Well, after a day playing around with jQuery, I present REST in Place

(Please head to the project page for REST in Place for the full announcement and comments)
]]></description>
			<content:encoded><![CDATA[<p>In <a href="/archiv/ajax-vs-rest">Ajax vs. REST</a> I wrote about my ideas for a RESTful inplace editor.</p>

<p>Well, after a day playing around with jQuery, I present <a href="/projects/rest-in-place">REST in Place</a><span id="more-71"></span></p>

<p>(Please head to the <a href="/projects/rest-in-place">project page</a> for REST in Place for the full announcement and comments)</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/rest-in-place/feed</wfw:commentRss>
		</item>
		<item>
		<title>AJAX vs. REST</title>
		<link>http://jan.varwig.org/archiv/ajax-vs-rest</link>
		<comments>http://jan.varwig.org/archiv/ajax-vs-rest#comments</comments>
		<pubDate>Fri, 14 Dec 2007 23:30:09 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[on Rails]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[inplace editor]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://jan.varwig.org/archiv/ajax-vs-rest</guid>
		<description><![CDATA[A small shop I&#8217;ve been writing for for fathers pharmacy was a welcome playground for modeling my domain RESTful.
During my ventures, two big issues had me thinking quite hard for a while and there&#8217;s still no proper solution available. One of them was a DRY implementation of controllers for nested resources which I&#8217;ll describe later, [...]]]></description>
			<content:encoded><![CDATA[<p>A small shop I&#8217;ve been writing for for fathers pharmacy was a welcome playground for modeling my domain RESTful.
During my ventures, two big issues had me thinking quite hard for a while and there&#8217;s still no proper solution available. One of them was a DRY implementation of controllers for nested resources which I&#8217;ll describe later, the other one was the outdated <a href="http://svn.rubyonrails.org/rails/plugins/in_place_editing/">inplace editor plugin</a> in Rails.</p>

<p><span id="more-70"></span>
<h3>In-Place editing RESTful resources</h3></p>

<p>Writing applications in <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm">REST</a>-style encourages an even stricter separation of view and controller logic than the usual Rails&#8217; stack.
A key principle is that the client alone should provide the user means to manipulate and PUT/POST data to the server. This is easier said than done in current browsers and with the HTML format (which just wasn&#8217;t made for building GUIs, but that&#8217;s a topic for another post). AJAX is the closest we can come to this ideal, enabling a seamless transition from a plain view of a resource to a editable form without going through too much pain.</p>

<p>A widely used way to achieve these transitions are inplace editors, made popular by Flickr and supported through nice helper methods in rails. The probem now is that these helper methods were written around, or even before Rails 1.0 with not the slightest hint of REST in them. Planting <code>in_place_edit_for :object, :attribute</code> in your controller creates a <code>set_object_attribute</code>  action that finds an object by id, updates only <code>attribute</code> and renders <code>attribute</code>s new value as a plain, short string to the client. The client, in this case the XMLHttpRequest, takes that response and puts it in the appropriate place in the HTML document.</p>

<p>There are several problems with this approach:</p>

<ol>
<li>The generated actions are extremely simple and devoid of any form of sophisticated flow control (authorization, exception handling)</li>
<li>The generated actions perform a task that can be done in the good old <code>update</code> action and are thusly redundant.</li>
<li>Those new actions aren&#8217;t at all RESTful.</li>
<li>Ideally, no special server side code should be necessary.</li>
</ol>

<p>While problem 1 can be easily countered by implementing your own version of <code>in_place_edit_for</code>, the real point are the other issues. The <code>update</code> action already performs the task of updating one or more attributes and is equipped with whatever authorization checks are necessary (does object belong to the logged in user?). The <code>update</code> action corresponds to the REST-verb <code>POST</code> and doesn&#8217;t violate REST principles.</p>

<p>A solution that solves all these problems would have to look like this (client-side Javascript only):</p>

<ul>
<li>The inplace editor posts to the objects url (something like <code>/object/123</code>), passing the attribute to be updated as a HTTP parameter.</li>
<li>The server sends a response when the update is completed successfully or unsuccessfully.</li>
<li>In case of an unsuccessful update some form of status could be transferred in the response</li>
<li>In case of a successful update, the server doesn&#8217;t send the updated attributes value, instead the client should GET
the object requesting a <em>text/json</em> content-type, extract the desired attribute from the json and update the HTML with its value.</li>
</ul>

<p>I already tried building my own inplace editor Javascript helper but since much of the functionality of the rails inplace editor depends on the the editor defined in script.aculo.us I gave up. On the one hand the problem wasn&#8217;t so pressing that I could justify spending a weekend digging through the source, on the other hand I&#8217;d really like to see a good jQuery integration in rails and think maybe I could hit two birds with one stone if I try to go this direction one day.</p>
]]></content:encoded>
			<wfw:commentRss>http://jan.varwig.org/archiv/ajax-vs-rest/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
