<?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>Joe's Amazing Technicolor Weblog &#187; Code</title>
	<atom:link href="http://slagwerks.com/blog/index.php/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://slagwerks.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 23 Jul 2010 22:31:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ruby &amp; NoSQL @ Vermonster</title>
		<link>http://slagwerks.com/blog/index.php/2010/04/02/ruby-nosql-vermonster/</link>
		<comments>http://slagwerks.com/blog/index.php/2010/04/02/ruby-nosql-vermonster/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 14:20:08 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Boston]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://slagwerks.com/blog/?p=356</guid>
		<description><![CDATA[Update: Vermonster has a nice recount, chock full of code &#38;&#160;explanations. A fine time was had the other night in the offices of Boston&#8217;s Vermonster, when a few Vermonsters generously helped some folks from Boston.rb get up to speed on the use of some NoSQL projects from&#160;Ruby. Up until now, I&#8217;ve been a little leery of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: Vermonster has a <a href="http://vermonster.com/2010/03/31/nosql-workshop-featuring-riak-and-couchdb/">nice recount</a>, chock full of code <span class="amp">&amp;</span>&nbsp;explanations.</p>
<p>A fine time was had the other night in the offices of Boston&#8217;s <a href="http://vermonster.com/">Vermonster</a>, when a few Vermonsters generously helped some folks from <a href="http://bostonrb.org/">Boston.rb</a> get up to speed on the use of some NoSQL projects from&nbsp;Ruby.</p>
<p>Up until now, I&#8217;ve been a little leery of NoSQL. Probably due to painful past experience with <a href="http://en.wikipedia.org/wiki/ZODB"><span class="caps">ZODB</span></a> failing to keep up with moderate loads, and reading too many Philip Greenspun essays at an impressionable age. Happily, it appears that the projects collected under the NoSQL banner can actually walk and chew gum at the same time, without rendering your data unreasonably&nbsp;inconsistent.</p>
<p>The whole question of the Consistency of one&#8217;s data is addressed by the <a href="http://www.julianbrowne.com/article/viewer/brewers-cap-theorem"><span class="caps">CAP</span></a> theory, which I understand to roughly&nbsp;say</p>
<blockquote><p>Consistency, Availability, Partitionability: pick (at most) two, particularly under certain challenging conditions such as running Google or&nbsp;Amazon.</p></blockquote>
<p>Even if you aren&#8217;t running something quite that big, there seem to be some situations where you&#8217;d want to think about this stuff&thinsp;&#8212;&thinsp;for example, running an app on Google&#8217;s App Engine (right? Haven&#8217;t yet myself.) Plus, all the cool kids are into&nbsp;it.</p>
<p>We worked with the locally-written <a href="http://riak.basho.com/">Riak</a> (looks like it&#8217;s the topic of the April Boston.rb meeting!) and with CouchDB. Both are ridiculously easy to get running locally, have Ruby client libraries, and are powered mainly by Erlang, with javascript Map/Reduce. For the latter, we used the couch_potato library, which seems to do a nice job of writing your javascript for you in the most common&nbsp;cases.</p>
<p>We wrapped the evening up with a coding challenge. My brain was fried <span class="amp">&amp;</span> I gave up 2/3rds of the way through, but still had a blast <span class="amp">&amp;</span> learned plenty. As a side benefit, beyond the exposure to the NoSQL, my state-of-the-art-circa-2008 Ruby habits got challenged by working with RSpec, 1.9.1, and <span class="caps">RVM</span>, all of which will should prove handy for future&nbsp;things.</p>
<p>Big ups to Vermonster for hosting, feeding, and educating us. They are good guys, skilled teachers, and have excellent taste in&nbsp;beverages.</p>
]]></content:encoded>
			<wfw:commentRss>http://slagwerks.com/blog/index.php/2010/04/02/ruby-nosql-vermonster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>puttering around with Symfony</title>
		<link>http://slagwerks.com/blog/index.php/2008/01/23/puttering-around-with-symfony/</link>
		<comments>http://slagwerks.com/blog/index.php/2008/01/23/puttering-around-with-symfony/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 01:25:04 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://slagwerks.com/blog/index.php/2008/01/23/puttering-around-with-symfony/</guid>
		<description><![CDATA[On advice from Nate, I&#8217;m taking Symfony for a spin (using the stable version 1, not the under-development 1.1), reimplementing the aforementioned contact management application. Here&#8217;s what I&#8217;m&#160;noticing: Somewhat like Rails, there&#8217;s DB-independent schema definition! Big win here. Among other things, this lets you develop in SQLite and deploy in MySQL, which is a nice [...]]]></description>
			<content:encoded><![CDATA[<p>On <a href="http://slagwerks.com/blog/index.php/2007/12/14/first-thoughts-on-cakephp-from-a-rails-perspective/#comment-4035">advice from Nate</a>, I&#8217;m taking <a href="http://www.symfony-project.org/">Symfony</a> for a spin (using the stable version 1, not the under-development 1.1), reimplementing the aforementioned contact management application. Here&#8217;s what I&#8217;m&nbsp;noticing:</p>
<ul>
<li>Somewhat like Rails, there&#8217;s <span class="caps">DB</span>-independent schema definition! Big win here. Among other things, this lets you develop in SQLite and deploy in MySQL, which is a nice pattern. Rails&#8217; awesome migrations aren&#8217;t here, so it&#8217;s not as useful and flexible a system, but it&#8217;s better than nothing for getting up <span class="amp">&amp;</span>&nbsp;running.</li>
<li>One big difference from Rails that&#8217;s clear right away: rather than building code dynamically based on the <span class="caps">DB</span> schema, thousands of lines of getters / setters / etc. are generated by the symfony command line tool. Makes sense for <span class="caps">PHP</span>, but it&#8217;s a clunkier development&nbsp;experience.</li>
<li>There&#8217;s <a href="http://www.symfony-project.org/book/1_0/15-Unit-and-Functional-Testing">testing</a> built in! It&#8217;s a bit of a <span class="caps">PITA</span> to do things like create a test database, and all the pieces for testing your models aren&#8217;t there right away, but still better than CakePHP. The aforementioned missing piece is available as <a href="http://trac.symfony-project.com/wiki/sfModelTestPlugin">a plugin</a>. There doesn&#8217;t seem to be a straightforward way to get the <code>propel-insert-sql</code> task to run on alternate environments, so one must create the db on their own. I&#8217;m using SQLite, which is great, but my local environment somehow ended up with PHP having SQLite 2.8 while my command line is version 3 (macports at fault? what a step backwards from Ubuntu&#8230;). One <code>port install sqlite2</code> later, and you can do <code>sqlite data/test.db &lt;&nbsp;data/sql/lib.model.schema.sql</code></li>
<li>No console, which makes the tests even more essential, so it does seem to be worth the pain of getting them&nbsp;working.</li>
</ul>
<p>Side note&thinsp;&#8212;&thinsp;already, on the basis of the previous post, I&#8217;m seeing a surprising amount of traffic from searches on CakePHP, Symfony, and <span class="caps">REST</span>. Clearly I&#8217;m not the only one looking for this kind of&nbsp;thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://slagwerks.com/blog/index.php/2008/01/23/puttering-around-with-symfony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First thoughts on CakePHP from a Rails perspective</title>
		<link>http://slagwerks.com/blog/index.php/2007/12/14/first-thoughts-on-cakephp-from-a-rails-perspective/</link>
		<comments>http://slagwerks.com/blog/index.php/2007/12/14/first-thoughts-on-cakephp-from-a-rails-perspective/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 22:31:03 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://slagwerks.com/blog/index.php/2007/12/14/first-thoughts-on-cakephp-from-a-rails-perspective/</guid>
		<description><![CDATA[I have a new project coming up that seems like a great fit for Ruby on Rails, particularly the RESTful interfaces that have gone in over the last year. However, the typical questions about using Rails apply here: I&#8217;m not sure how well the project&#8217;s hosting environment will support Rails, and collaborators aren&#8217;t as familiar [...]]]></description>
			<content:encoded><![CDATA[<p>I have a new project coming up that seems like a great fit for Ruby on Rails, particularly the <a href="http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it">RESTful interfaces</a> that have gone in over the last year. However, the typical questions about using Rails apply here: I&#8217;m not sure how well the project&#8217;s hosting environment will support Rails, and collaborators aren&#8217;t as familiar with it. Thus,  it seemed like it might be worth another look at options on the <span class="caps">PHP</span> side of things. I keep hearing that <a href="cakephp.org/">CakePHP</a> is Rails-inspired and has many of the same advantages, so today I&#8217;ve taken the stable version (1.1.8.5850) for a spin, letting <a href="http://manual.cakephp.org/appendix/blog_tutorial">the Cake manual&#8217;s blog tutorial</a> get me started. Here&#8217;s what I&#8217;ve noticed about CakePHP development as practiced in the tutorial&thinsp;&#8212;&thinsp;maybe there&#8217;s better ways to do things <span class="amp">&amp;</span> the tutorial just isn&#8217;t mentioning&nbsp;them?</p>
<ul>
<li>No <a href="http://api.rubyonrails.org/classes/ActiveRecord/Migration.html">migrations</a>; you have to generate the <span class="caps">DDL</span> on your own, both initially and for any subsequent modifications. Also, no model or controller generators. It&#8217;s definitely nicer to just do  <code>script/generate scaffold post title:string body:text; rake db:migrate</code>  and be off to the races&thinsp;&#8212;&thinsp;from Rails 1.2 on, those races include the whole REST business. To be fair, there is a one off reference to &#8216;bake&#8217; scripts in the CakePHP manual, but no pointers on what those are, or where they live, and the website isn&#8217;t much&nbsp;clearer.</li>
<li>No <span class="caps">TDD</span>. Woah. That&#8217;s, like, half the advantage of Rails&thinsp;&#8212;&thinsp;automated testing is right there in your face, and is firmly entrenched in the&nbsp;community.</li>
<li><span class="caps">PHP</span> code is not quite as elegant as Ruby. For example, generating a link to delete a post looks like this: <code>$html-&gt;link('Delete', "/posts/delete/{$post['Post'][id']}", null, 'Are you sure?' )</code>. Can you spot the syntax error? Probably you can, but it took me a good few minutes. The Rails equivalent would be<br />
<code>link_to "Delete", { :action =&gt; "delete", :id =&gt; @post.id }, :confirm =&gt; "Are you sure?", :method =&gt;&nbsp;:delete</code></li>
<li>A lack of the experiences baked into Rails. For example, after the Google Web Accelerator fiasco, it became common practice to make all links to destructive actions happen via <span class="caps">POST</span>, which can be done via <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M000900">link_to</a>&#8217;s :method parameter. Compare to the <span class="caps">GET</span>-powered delete link above, straight from the Cake&nbsp;tutorial.</li>
<li>I miss my <a href="http://www.vim.org/scripts/script.php?script_id=1567">vim <span class="amp">&amp;</span> rails integration</a>, which makes creating and navigating the various files a breeze. (Glad I went to the trouble of making that a link, as it got me re-reading the plugin&#8217;s about page, and I saw the parts about partial extraction and migration inversion, neither of which I&#8217;d noticed&nbsp;before)</li>
</ul>
<p>On the upside, using CakePHP sure beats writing a <span class="caps">CRUD</span>-heavy <span class="caps">PHP</span> application from scratch. One of my current projects, a completely custom contact management application, would be in much better shape if it were using CakePHP instead of the project-specific <span class="caps">ORM</span> I cobbled together&thinsp;&#8212;&thinsp;I&#8217;m going to have to give conversion of that project to CakePHP some serious&nbsp;thought.</p>
<p>But is CakePHP a <a href="http://en.wikipedia.org/wiki/Domain-specific_programming_language"><span class="caps">DSL</span></a> for the web in the sense that Rails is? Not&nbsp;yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://slagwerks.com/blog/index.php/2007/12/14/first-thoughts-on-cakephp-from-a-rails-perspective/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
