<?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>Andreas Happe &#187; ruby</title>
	<atom:link href="http://snikt.net/index.php/tag/ruby/feed" rel="self" type="application/rss+xml" />
	<link>http://snikt.net</link>
	<description>Vi veri ueniversum vivus vici</description>
	<lastBuildDate>Tue, 06 Jul 2010 21:54:07 +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>Provenance on Rails</title>
		<link>http://snikt.net/index.php/2010/04/29/provenance-on-rails-2</link>
		<comments>http://snikt.net/index.php/2010/04/29/provenance-on-rails-2#comments</comments>
		<pubDate>Thu, 29 Apr 2010 19:02:10 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Provenance]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[master thesis]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://snikt.net/?p=802</guid>
		<description><![CDATA[First of all, what is provenance? The common description is that provenance describes how an object came into its current state. Think of it as versioning on crack: in addition to performed changes it also detects how and by whom those changes were performed. ..but do I need it? Well that depends: do you have [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="font-weight: normal; font-size: 13px;">First of all, what is provenance? The common description is that <em>provenance describes how an object came into its current state</em>. Think of it as versioning on crack: in addition to performed changes it also detects how and by whom those changes were performed.</span></h1>
<h2>..but do I need it?</h2>
<p>Well that depends:</p>
<ul>
<li>do you have any objects in whose alteration history you&#8217;re interested in? Think about any financial or business object.</li>
<li>social network app? think automatic activity feeds..</li>
<li>do you have any analysis workflow that produces a single output from multiple input data points? Provenance can retroactively create the relationships between the input and output datums.</li>
<li>do you want to monitor a given object&#8217;s access patterns temporary? Think debugging.</li>
</ul>
<p>Actually, the longer you think the more use cases appear.</p>
<p>After the break I&#8217;ll talk about my master thesis (that dealt with provenance), the corresponding RoR prototype and future plans w.r.t. provenance within Ruby on Rails.</p>
<p><span id="more-802"></span></p>
<h2>Background Information</h2>
<p>I&#8217;ve spend some time with<a href="http://snikt.net/wp-content/provenance/master_thesis.pdf"> my master thesis</a> focusing on provenance. It&#8217;s academic so do not expect readability or real-world usability. For that there&#8217;s a <a href="http://www.snikt.net/wp-content/provenance/short_paper.pdf">short paper detailing the rails prototype</a>, an additional use case was detailed<a href="http://snikt.net/wp-content/provenance/genesis.pdf"> in another paper</a>. All source code can be found on <a href="http://github.com/andreashappe">github</a>, it might take some days to get the newest versions into the repositories.</p>
<p>My basic idea was that developers do not want to deal with the details of provenance gathering or storage. They should focus upon their domain application. I developed a system that allowed automatic provenance capturing (through a rails plugin), networked storage and dedicated network query facilities.</p>
<p>The prototype did work, unobtrusive provenance capturing is perfectly possible in Ruby on Rails.  Why do I believe that the master thesis prototype is not perfectly suited for real-world applications? Well,</p>
<ul>
<li>storage was done through a separated RDF graph engine, encapsulated within an <a>own RoR application</a>. This is well suited for large academic test applications but I believe that something using an embedded storage solution (thus easier to integrate within existing systems) might be better suited for Rails.</li>
<li>provenance queries had to be done through SPARQL or a special (easy) REST-based interface. An interface directly integrated within Ruby would be preferable.</li>
<li>It&#8217;s all still Rails 2.3 based. I&#8217;ve finished the prototype some time ago and did work the last months mostly on the documentation. So the prototype should be forward-ported to Rails 3.0.0beta3.</li>
</ul>
<h2>Towards a bright new future!</h2>
<p>So I have finally finished my master thesis and would need a embeddable provenance solution for one of my side-projects. I will base it upon the work done during my master thesis but it will differentiate in various points:</p>
<ul>
<li><em>use embedded storage</em>. Application developers should be able to install the plugin, call a rake task and enjoy the benefits of automatic provenance gathering. Does anyone know a good ruby only RDF/graph engine?</li>
<li>no more special query language.. users should not have to learn a new query language nor interfaces. Provenance should be be provided through virtual <em>ActionModel</em> methods and act as &#8216;normal&#8217; object methods.</li>
<li>update the plugin to work with Rails 3.0, investigate <em>Rack</em> and <em>ActionModel</em></li>
<li>keep the plugin as simple as possible.. so other people can play with it too.</li>
</ul>
<p>I&#8217;m not perfectly sure when my side-project will need need that functionality (or if it even gets towards that point), but if you&#8217;re interested in provenance on rails just <a href="http://github.com/andreashappe/provenance-on-rails-sensor">watch the repository</a> or, even better, branch it and get involved..</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2010/04/29/provenance-on-rails-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails vs. Java, part 1</title>
		<link>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1</link>
		<comments>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1#comments</comments>
		<pubDate>Sun, 17 Feb 2008 17:05:38 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1</guid>
		<description><![CDATA[One of the components of the system developed here at Blackwhale is an fairly advanced web mail/campaigning and analytics system. The first iteration of that component was fully implemented in Ruby on Rails. Writing the front end was fairly easy and fast, a perfect opportunity for Rails to display its strengths. On the back end [...]]]></description>
			<content:encoded><![CDATA[<p>One of the components of the system developed here at <a href="http://www.blackwhale.net">Blackwhale</a> is an fairly advanced web mail/campaigning and analytics system. The first iteration of that component was fully implemented in <a href="http://www.rubyonrails.org">Ruby on Rails</a>. Writing the front end was fairly easy and fast, a perfect opportunity for Rails to display its strengths. On the back end and communication part on the other hand I stumbled into various problems:</p>
<ul>
<li>Compared to PHP, Python or Java there are just too few communication libraries. And even the libraries that exist are lacking fundamental features and almost all of them come without useable documentation. That there is no encryption (SSL or TLS) support in the whole Ruby 1.8 mail libraries is an outright shame. The IMAP library is so clumsy that a web company sells their own (still not perfect library) through their online store and they seem to make a good buck with it.
<p>On the Java side is just a completly different picture: Lots of libraries, even documented ones are available. After having to touch the <a href="http://tmail.rubyforge.org/">TMail</a> (rail&#8217;s MIME mail handler library) API using javax.mail is a heavenly gift. And it seems that the TMail generated MIME messages were invalid in a couple of cases. Not the best feature of a support library. Also the chance of finding unsolved known bugs and errors seems to be lot smaller in Java.</li>
<li>This brings me to another point: I might change my opinion on Java&#8217;s constraints on its users. Java tries hard to prevent errors (i.e. the forced exception catching). I always thought that that took too many stylish possibilities away from the user, but by now I must confess that I think that this is exactly what I want from something that I&#8217;m using on the network side. I&#8217;m a lazy programmer, I want to be reminded and forced to write secure and stable code. This is the quite different to Ruby and Rails &#8216;make it easy for the programmer&#8217; attitude.</li>
<li>Background processing is hard. As Ruby on Rails is not multi-thread safe you can&#8217;t just spawn a thread if you need to perform some longer running task. Another disadvantage of using a single-process model is that the long running request will occupy one rails worker (i.e. rails cluster process) until it has finished &#8211; in our case that costs us around 60MB of memory per long running request, even if it is just waiting for some simple SMTP feedback. If you can find a situation where you can delay the execution of a network related task (and if you don&#8217;t you&#8217;re not thinking) for two seconds, 6 requests per seconds will DoS a standard rails cluster.
<p>The only solution that&#8217;s actually usable is <a href="http://backgroundrb.rubyforge.org/">BackgroundRb</a>. But projects that just change their background communication system just don&#8217;t sound to production-grade ready for me. Also the admin start/stop scripts for their background server didn&#8217;t work too well for me.</li>
<li>For a language that interferes it&#8217;s object&#8217;s attribute types directly from the database the ActiveRecord layer is weak. Don&#8217;t get me wrong, I understand that the Simplicity is needed to make it easily usable but I ran into various situations where I&#8217;d love to have a full blown ORM behind me. One feature that is needed quite often by our application is inheritance. ActiveRecord only offers single table inheritance, and even there you have to make sure that each row is valid (ActiveRecord should have all needed information to do that by itself BTW) or you will run into problems later on. One problem is, that it tries to abstract too much functionality away from the database while not provided as advanced interfaces by itself. Data integrity handling? Abstracted away by rails, so all databases can be used the same. The drawback is, that the data constraints and relations are fully handled by rails and not passed on to the database. Any process that might produce invalid data (e.g. a faulty rails component) might corrupt the data. Rails is able to handle that cases by itself (due to ducktyping and very few default checks), but access that data with any other framework and it blows up directly into your face.</li>
<li>Transaction handling. Just try it. Then cry. Also I&#8217;m not sure if Transaction handling is even done on database level or in Rails (as done with constraints). If the later is true, it&#8217;s acutally not worth anything as soon as more processes try to access the database.</li>
</ul>
<p>The library and documentation problems where the main reason for me to reimplement the mailing and campaigning backend in Java. The front end is still a Rails application &#8212; which is exactly what Rails is for. As I&#8217;m no friend of blown-up EJB based solutions I&#8217;ve choosen a simple Spring and JPA based solution for that problem.</p>
<p>I&#8217;m currently testing the last features and replacing the Ruby code part by part. As soon as I&#8217;ve done that another blog post will examine the two implementations, how much time was spent on coding them and how they perform when compared to each other.</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
