<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17174222</id><updated>2011-04-21T11:08:14.708-07:00</updated><title type='text'>Mi oPinions</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17174222.post-116677437241867977</id><published>2006-12-21T23:20:00.000-08:00</published><updated>2006-12-22T00:11:19.503-08:00</updated><title type='text'>Mixin interfaces for Java?</title><content type='html'>Inspired by last &lt;a href="http://www.javapolis.com/"&gt;Javapolis&lt;/a&gt; conference, and many ideas about new Java 7 language features floating around (like eg. &lt;a href="http://www.bejug.org/confluenceBeJUG/display/PARLEYS/Closures+for+Java"&gt;closures&lt;/a&gt;) I returned back to my dream about &lt;a href="http://www.rubygarden.org/faq/entry/show/75?controller_prefix=faq%2F"&gt;mixins&lt;/a&gt; in Java.&lt;br /&gt;&lt;br /&gt;In fact, when I think about &lt;a href="http://www.ruby-lang.org/en/"&gt;Ruby&lt;/a&gt;, there are two main things I like there. These are closures and mixins. If both were added to &lt;a href="https://jdk7.dev.java.net/"&gt;Java 7&lt;/a&gt;, I would be more than pleased.&lt;br /&gt;&lt;br /&gt;My idea for mixins would be pretty simple. No new syntax at all. Just use existing language feature - interfaces - and make them a little bit richer. The example mixin could look the following:&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;&lt;br /&gt;public interface Nameable {&lt;br /&gt;  private String name;&lt;br /&gt;  public String getName() {&lt;br /&gt;    return name;&lt;br /&gt;  }&lt;br /&gt;  public void String setName(String name) {&lt;br /&gt;    this.name = name;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;You see? Nothing weird at the first look.&lt;br /&gt;To use it, one would need to do the following:&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;&lt;br /&gt;public class Person implements Nameable {&lt;br /&gt;  public Person(String name) {&lt;br /&gt;    setName(name);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Again, nothing weird. All easy and nice. Of course, not for the &lt;span style="font-weight: bold;"&gt;javac&lt;/span&gt; compliler team, as they would need to do some hard work to implement it.&lt;br /&gt;&lt;br /&gt;The basic idea for implementation would be the following - use a combination of an interface and anonymous inner class + delegation. So, in practice, the code generated by &lt;span style="font-weight: bold;"&gt;javac&lt;/span&gt; under the hood could be similar to this:&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;&lt;br /&gt;public interface Nameable {&lt;br /&gt;  public void getName();&lt;br /&gt;  public String setName();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Person implements Nameable {&lt;br /&gt;  // anonymous inner class part of a dirty trick&lt;br /&gt;  private Nameable __dirtyTrick = new Nameable() {&lt;br /&gt;    private String name;&lt;br /&gt;    public String getName() {&lt;br /&gt;      return name;&lt;br /&gt;    }&lt;br /&gt;    public void String setName(String name) {&lt;br /&gt;      this.name = name;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  // delegation part of a dirty trick&lt;br /&gt;  public String getName() {&lt;br /&gt;    return __dirtyTrick.getName();&lt;br /&gt;  }&lt;br /&gt;  public void String setName(String name) {&lt;br /&gt;    __dirtyTrick.setName(name);&lt;br /&gt;  }&lt;br /&gt;  // normal code&lt;br /&gt;  public Person(String name) {&lt;br /&gt;    setName(name);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The hard part left to analyze is to figure out how to resolve "multiple inheritance"-like conflicts, communication of a mixin with a native class and all edge cases and consequences of this. But on the first sight, the idea seems to be workable to me.&lt;br /&gt;&lt;br /&gt;Of course, these mixins are not dynamic as in Ruby - so you cannot inject or remove them from a class in runtime. But this would conflict a lot with static type checking, so we need to remember in what environment we are. For me, this is not a big problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116677437241867977?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116677437241867977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116677437241867977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116677437241867977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116677437241867977'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/12/mixin-interfaces-for-java.html' title='Mixin interfaces for Java?'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116351659789630590</id><published>2006-11-14T06:51:00.000-08:00</published><updated>2006-11-14T07:06:34.950-08:00</updated><title type='text'>Ruby and samurai swords are for samurais</title><content type='html'>&lt;a href="http://www.robsanheim.com/2006/11/14/whats-wrong-with-this-method_missing/"&gt;This little post&lt;/a&gt; is a nice proof to my private hypothesis:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    Ruby and other samurai tools are best for samurais only.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;font&gt;Let's see what has happened there. Someone has created a 6-line method. Then, as you can see from comments, this method contained 3 severe errors and none of them get detected by the compiler. ;)&lt;br /&gt;&lt;br /&gt;It can happen for any language. But I particularly like the beginning of the post:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote style="font-style: italic;"&gt;A coworker who shall remain nameless had this method missing implementation in a module that got mixed into the app helper. &lt;span style="font-weight: bold;"&gt;This tricked me up for longer then it should&lt;/span&gt;, mostly because I hadn't synced up in awhile and so assumed the problem was in changes I made.&lt;/blockquote&gt;&lt;/span&gt;Nice thing about that story is that they have had enough tests in a test suite to detect that early. So possibly they are samurais. ;)&lt;br /&gt;&lt;br /&gt;But to sum up - I believe that Ruby could be very nice tool for projects with up to 3-5 highly skilled people. If you start to do Ruby projects withbig team of average juniors - beware.&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116351659789630590?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116351659789630590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116351659789630590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116351659789630590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116351659789630590'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/11/ruby-and-samurai-swords-are-for.html' title='Ruby and samurai swords are for samurais'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116116990109557666</id><published>2006-10-18T03:58:00.000-07:00</published><updated>2006-10-18T04:11:41.110-07:00</updated><title type='text'>More about Java and webcontinuations - Jetty style</title><content type='html'>There have been some &lt;a href="http://blog.ianbicking.org/constraints-and-continuations.html"&gt;discussion&lt;/a&gt; some time ago about &lt;a href="http://www.seaside.st/"&gt;continuation model for the web&lt;/a&gt;, &lt;a href="http://blogs.sun.com/gbracha/entry/will_continuations_continue"&gt;Java continuations&lt;/a&gt; etc. Some were against, some defended continuations, but on the other hand &lt;a href="http://smallthought.com/avi/?p=14"&gt;contrasted it with AJAX&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Actually, it seems that &lt;a href="http://jetty.mortbay.org/"&gt;Jetty&lt;/a&gt; guys found another interesting use of continuations in the Java world. It's main usage is to &lt;a href="http://docs.codehaus.org/display/JETTY/Continuations"&gt;decrease resource usage&lt;/a&gt; when &lt;a href="http://blogs.webtide.com/gregw/2005/09/16/1126896840000.html"&gt;handling AJAX requests&lt;/a&gt;, but can be also used for &lt;a href="http://blogs.webtide.com/gregw/2006/10/18/1161127500000.html"&gt;increasing quality of service for the servlet container&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I still did not analyze thing in the details, but it looks interesting. For sure, these are not true continuations as Java does not have them... But it seems to be surprisingly useful example, and also one showing that AJAX and continuations could somehow become friends. Some even believe that &lt;a href="http://www.lshift.net/blog/2005/07/20/restful-ajax-continuations"&gt;REST should joing the gang&lt;/a&gt;...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116116990109557666?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116116990109557666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116116990109557666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116116990109557666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116116990109557666'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/more-about-java-and-webcontinuations.html' title='More about Java and webcontinuations - Jetty style'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116115438765249653</id><published>2006-10-17T23:42:00.000-07:00</published><updated>2006-10-17T23:53:07.666-07:00</updated><title type='text'>What I dislike about Ruby... (part I finished)</title><content type='html'>Mmmmkay. For you, impatient - &lt;a href="http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-part-i_17.html"&gt;mystery&lt;/a&gt; resolved.&lt;br /&gt;&lt;br /&gt;The line #12 has been an offending one:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;self.children.inject do |sum, child|&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In fact it should look the following:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;self.children.inject(0) do |sum, child|&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Do you see the difference? Again, as in &lt;a href="http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-part-i.html"&gt;the very first example&lt;/a&gt; a problem with this little frisky '0'.&lt;br /&gt;&lt;br /&gt;Could you easily deduce that from the following error message:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;c:/ruby/lib/ruby/1.8/pathname.rb:189:&lt;br /&gt;in `dup': can't dup Fixnum (TypeError)&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Here's the point. If you are new to Ruby, you just don't know what's happening.&lt;br /&gt;&lt;br /&gt;To summarize. I am not saying I do not like Ruby as a language. I like it quite a lot, it is nice and brings many good ideas, as &lt;a href="http://www.rubycentral.com/book/tut_modules.html"&gt;mixins&lt;/a&gt; for example. But let us all face the fact that each technology has its bright face and a Mr. Hyde one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116115438765249653?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116115438765249653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116115438765249653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116115438765249653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116115438765249653'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-_116115438765249653.html' title='What I dislike about Ruby... (part I finished)'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116110144303154004</id><published>2006-10-17T08:56:00.000-07:00</published><updated>2006-10-17T09:10:43.360-07:00</updated><title type='text'>What I dislike about Ruby... (part I continued)</title><content type='html'>In a &lt;a href="http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-part-i.html"&gt;previous post&lt;/a&gt; I complained a little bit about Ruby stack traces not being too readable for a mere Java mortals like myself. I got some criticism for my artificial example not being Ruby-ish enough.&lt;br /&gt;&lt;br /&gt;Point taken. I am only a mere Java mortal, and not a Ruby superhero. That's exactly why I do expect Ruby stack traces to be a little more readable in the first place. ;)&lt;br /&gt;&lt;br /&gt;But after saying "mea culpa", I tried to run one of the "100% Rubyish" examples got in the comments to the last post:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;require 'pathname'&lt;br /&gt;&lt;br /&gt;class Pathname&lt;br /&gt;  def size_without_images&lt;br /&gt;    return 0 unless self.exist?&lt;br /&gt;    if self.file?&lt;br /&gt;      pictExts = %w[ .gif .png .jpg .jpeg .bmp ]&lt;br /&gt;      myExt = File.extname(self.to_s).downcase&lt;br /&gt;      return 0 if pictExts.include? myExt&lt;br /&gt;      File.size self&lt;br /&gt;    else&lt;br /&gt;      self.children.inject do |sum, child|&lt;br /&gt;        sum + child.size_without_images&lt;br /&gt;      end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;synergy = Pathname.new("c:\\tmp\\synergy")&lt;br /&gt;puts "Size: #{synergy.size_without_images}"&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The result was the following:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;c:/ruby/lib/ruby/1.8/pathname.rb:189:&lt;br /&gt;in `dup': can't dup Fixnum (TypeError)&lt;br /&gt; from c:/ruby/lib/ruby/1.8/pathname.rb:189:in `initialize'&lt;br /&gt; from c:/ruby/lib/ruby/1.8/pathname.rb:434:in `new'&lt;br /&gt; from c:/ruby/lib/ruby/1.8/pathname.rb:434:in `+'&lt;br /&gt; from test.rb:13:in `size_without_images'&lt;br /&gt; from test.rb:12:in `inject'&lt;br /&gt; from test.rb:12:in `each'&lt;br /&gt; from test.rb:12:in `inject'&lt;br /&gt; from test.rb:12:in `size_without_images'&lt;br /&gt; from test.rb:13:in `size_without_images'&lt;br /&gt; from test.rb:12:in `inject'&lt;br /&gt; from test.rb:12:in `each'&lt;br /&gt; from test.rb:12:in `inject'&lt;br /&gt; from test.rb:12:in `size_without_images'&lt;br /&gt; from test.rb:20&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Eeee... Well. I think I was not that far from truth saying that readability of Ruby stack traces could be improved... ;)&lt;br /&gt;&lt;br /&gt;If you are a mere Java mortal like me, ask your boss a bonus when you immediately understand why this exception happened in this context. ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116110144303154004?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116110144303154004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116110144303154004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116110144303154004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116110144303154004'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-part-i_17.html' title='What I dislike about Ruby... (part I continued)'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116076081031005809</id><published>2006-10-13T10:06:00.000-07:00</published><updated>2006-10-13T10:33:30.366-07:00</updated><title type='text'>Smalltalk doesn't suck ... ;)</title><content type='html'>This &lt;a href="http://jimbojw.blogspot.com/2006/10/clearing-air-languages-that-suck_12.html"&gt;little post&lt;/a&gt; made  me laugh. Especially this sentence:&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote style="font-style: italic;"&gt;The results seem to confirm conventional wisdom: Perl sucks the most, Ruby sucks least and all other languages fall somewhere in between.&lt;/blockquote&gt;So, I tried to type that:&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;blockquote&gt;Smalltalk sucks&lt;/blockquote&gt;&lt;/span&gt;200 results. Definitive proof that Smalltalk is THE language. ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116076081031005809?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116076081031005809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116076081031005809' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116076081031005809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116076081031005809'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/smalltalk-doesnt-suck.html' title='Smalltalk doesn&apos;t suck ... ;)'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116067524865834843</id><published>2006-10-12T10:41:00.000-07:00</published><updated>2006-10-12T10:47:28.676-07:00</updated><title type='text'>4th wedding anniversary</title><content type='html'>Happened a week ago, celebrated recently. In a &lt;a href="http://www.mielzynski.pl/"&gt;nice place&lt;/a&gt;, with good food and this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3689/1649/1600/siropacenti.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/3689/1649/320/siropacenti.jpg" alt="" border="0" /&gt;&lt;/a&gt;I just love great wine.&lt;br /&gt;&lt;br /&gt;And I love my wife even much more. ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116067524865834843?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116067524865834843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116067524865834843' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116067524865834843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116067524865834843'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/4th-wedding-anniversary.html' title='4th wedding anniversary'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116067235394684045</id><published>2006-10-12T09:34:00.000-07:00</published><updated>2006-10-12T10:27:52.000-07:00</updated><title type='text'>What I dislike about Ruby... (part I)</title><content type='html'>I will share with you my little frustration. I started to learn &lt;a href="http://www.ruby-lang.org"&gt;Ruby&lt;/a&gt; when all this &lt;a href="http://www.rubyonrails.org/"&gt;Rails&lt;/a&gt; hype was just starting, Rails was in some prerelease version and &lt;a href="http://www.loudthinking.com/about.html"&gt;DHH&lt;/a&gt; spent most of his time attacking anything related to &lt;a href="http://java.sun.com/"&gt;Java&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I read the cult &lt;a href="http://www.rubycentral.com/book/"&gt;pickaxe book&lt;/a&gt; and got very attracted to the language. I did not like Rails too much at the time, mostly because of the hype. C'mon, comparing a 4kloc framework having less then a dozen of features with the entire platform is a kind of... childish. So this artificial hype distracted me from my way to Rails, although I played with it and of course it has its &lt;a href="http://media.rubyonrails.org/video/rails_take2_with_sound.mov"&gt;niceties&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So again, reading pickaxe I felt - yeah, after killing Smalltalk - this is THE language.&lt;br /&gt;&lt;br /&gt;And then... I tried.&lt;br /&gt;&lt;br /&gt;Well, what to say... It's nice... But not too friendly. Example?&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;require 'pathname'&lt;br /&gt;&lt;br /&gt;O = "0"&lt;br /&gt;class Pathname&lt;br /&gt;    def sizeNoImages()&lt;br /&gt;        if not self.exist? then&lt;br /&gt;            return 0&lt;br /&gt;        elsif self.file? then&lt;br /&gt;            case self.to_s&lt;br /&gt;                when /.gif$/ then return 0&lt;br /&gt;                when /.GIF$/ then return 0&lt;br /&gt;                when /.png$/ then return 0&lt;br /&gt;                when /.PNG$/ then return 0&lt;br /&gt;                when /.jpg$/ then return O&lt;br /&gt;                when /.JPG$/ then return 0&lt;br /&gt;                when /.jpeg$/ then return 0&lt;br /&gt;                when /.bmp$/ then return 0&lt;br /&gt;                when /.BMP$/ then return 0&lt;br /&gt;                else return File.size(self)&lt;br /&gt;            end&lt;br /&gt;        else&lt;br /&gt;            size = 0&lt;br /&gt;            self.children.each do |child| &lt;br /&gt;                size = size + child.sizeNoImages()&lt;br /&gt;            end&lt;br /&gt;            return size&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;synergy = Pathname.new("c:\\tmp\\synergy")&lt;br /&gt;puts "Size: " + synergy.sizeNoImages().to_s&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Do you see the problem? No? So let's try to run it:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;test.rb:24:in `+': &lt;br /&gt;String can't be coerced into Fixnum (TypeError)&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:24:in `each'&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:24:in `each'&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:24:in `each'&lt;br /&gt;    from test.rb:24:in `sizeNoImages'&lt;br /&gt;    from test.rb:32&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Do you see the problem now? It is in the line 14:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;                when /.jpg$/ then return O&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;There is a letter O instead of our ol' arabic 0.&lt;br /&gt;&lt;br /&gt;I know this particular problem is artificial. But it exemplifies one thing faced pretty often on my Ruby adventures. The error messages you get are somehow similar to Java stack traces, but they are in fact much less precise. I do not even say that with Java analogous code would not compile due to strong type checking. More important point is that even if it compiles, error reports are much closer to the actual buggy place than in Ruby.&lt;br /&gt;&lt;br /&gt;Well... of course assuming that you're not working with dumb asses who &lt;a href="http://weblogs.java.net/blog/crazybob/archive/2004/02/exception_handl.html"&gt;quietly swallow&lt;/a&gt; exceptions... But that's another story.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116067235394684045?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116067235394684045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116067235394684045' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116067235394684045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116067235394684045'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/what-i-dislike-about-ruby-part-i.html' title='What I dislike about Ruby... (part I)'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-116058897497853535</id><published>2006-10-11T10:36:00.000-07:00</published><updated>2006-10-12T10:19:52.230-07:00</updated><title type='text'>Java and webcontinuations...</title><content type='html'>For many months now, I have been attracted by the buzz around so called "webcontinuations". However, my daily work with &lt;a href="http://www.atg.com"&gt;archaic technologies&lt;/a&gt; that do not integrate too well with all &lt;a href="http://www.springframework.org"&gt;new&lt;/a&gt; &lt;a href="http://www.hibernate.org"&gt;fancy&lt;/a&gt; &lt;a href="http://www.rubyonrails.org"&gt;toys&lt;/a&gt; did not bring too many opportunities to take a look on the buzzy topic&lt;br /&gt;&lt;br /&gt;And then I took the challenge. One of advantages of my corporate employer is that  there is some space left for personal and team development. This space is shaped in so called "team seminars". The goal is to present some shiny new technology each week to avoid being killed by &lt;a href="http://www.itil.co.uk/"&gt;boredom&lt;/a&gt; and &lt;a href="http://www.atg.com"&gt;frustration&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So my challenge was to present the mysterious "webcontinuations" concept to honourable audience consisting of &lt;a href="http://members.elysium.pl/brush/blog/"&gt;my&lt;/a&gt; &lt;a href="http://szafranek.net/blog"&gt;colleagues&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I learned two things.&lt;br /&gt;&lt;br /&gt;First, I reminded myself how fun Smalltalk is. It was my first love in the world of programming languages, and it will always be. First kisses with blocks... Hot breath of &lt;span style="font-weight: bold;"&gt;become:&lt;/span&gt; on my neck...&lt;br /&gt;As with &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;many&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;things&lt;/a&gt;, Smalltalk was the first to &lt;a href="http://www.seaside.st/"&gt;leverage power of continuations for the web&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I won't write here neither what the continuation is nor how elegantlySeaside programming model have been designed. &lt;a href="http://en.wikipedia.org/wiki/Continuations"&gt;Check&lt;/a&gt; &lt;a href="http://www.seaside.st/Documentation/CallandAnswer/"&gt;it&lt;/a&gt; &lt;a href="http://www.seaside.st/Documentation/MaintainingState/"&gt;out&lt;/a&gt; &lt;a href="http://www.seaside.st/Documentation/DebuggingSeasideApplications/"&gt;by&lt;/a&gt; yourself.&lt;br /&gt;&lt;br /&gt;What I will write about is an attempt to provide this programming model to the Java world. The &lt;a href="http://rifers.org/blogs/gbevin"&gt;man&lt;/a&gt; with a &lt;a href="http://www.rifers.org/"&gt;RIFE&lt;/a&gt; has dared to do so...&lt;br /&gt;&lt;br /&gt;And indeed, the &lt;span style="font-weight: bold;"&gt;call/answer&lt;/span&gt; model has been implemented as in Seaside, plus additional &lt;span style="font-weight: bold;"&gt;pause()&lt;/span&gt; method which exists transparently in Seaside's send-response-handle-request loop. Please take a look at the example from &lt;a href="http://rifers.org/wiki/display/RIFE/Web+continuations"&gt;RIFE site&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;public void processElement() {&lt;br /&gt;  int total = 0;&lt;br /&gt;  while (total %lt; 50) {&lt;br /&gt;    print(getHtmlTemplate("form"));&lt;br /&gt;    pause();&lt;br /&gt;    total += getParameterInt("answer", 0);&lt;br /&gt;  }&lt;br /&gt;  print("got a total of "+total);&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;For you, who are to lazy to click and read the links of this blog - this piece of code will print a form, then pass response to user and wait for request from her browser. After that &lt;span style="font-weight: bold;"&gt;pause()&lt;/span&gt;, the code will wake up as it would never sleep and smoothlessly continue, as there were no HTTP communication in the middle at all.&lt;br /&gt;&lt;br /&gt;I knew, as every child on that planet, that Java does not support continuations. So how that was done?&lt;br /&gt;&lt;br /&gt;The answer was disappointing.&lt;br /&gt;&lt;br /&gt;The class with this magic needs to be &lt;a href="http://www.cs.nuim.ie/%7Ejonathan/BytecodeInstrumentation.html"&gt;instrumented&lt;/a&gt; first, using custom classloader and &lt;a href="http://cglib.sourceforge.net/"&gt;esoteric tools&lt;/a&gt;. This is somehow invasive process, and don't look at the RIFE  classloader code if you want to remain sane. In input/output terms, it works more or less the following.&lt;br /&gt;&lt;br /&gt;Innocent input:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;public void processElement() throws EngineException {&lt;br /&gt;  String s = "test";&lt;br /&gt;  pause();&lt;br /&gt;  System.out.println(s);&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Life-threatening output:&lt;br /&gt;&lt;br /&gt;&lt;div class="custom-code"&gt;&lt;pre&gt;public void processElement() throws EngineException {&lt;br /&gt;  ContinuationContext continuationcontext = &lt;br /&gt;    ContinuationContext.createOrResetContext();&lt;br /&gt;  String s;&lt;br /&gt;  switch (continuationcontext.getLabel()) {&lt;br /&gt;    default:&lt;br /&gt;      String s1 = "test";&lt;br /&gt;      continuationcontext.getLocalVars()&lt;br /&gt;          .storeReference(1, s1);&lt;br /&gt;      TestClass _tmp = this;&lt;br /&gt;      continuationcontext.setLabel(0);&lt;br /&gt;      throw new PauseException(continuationcontext);&lt;br /&gt;    case 0:&lt;br /&gt;      s = (String)continuationcontext&lt;br /&gt;          .getLocalVars().getReference(1);&lt;br /&gt;    break;&lt;br /&gt;  }&lt;br /&gt;  System.out.println(s);&lt;br /&gt;  continuationcontext.remove();&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I do not know how do you feel now, but I was kind of... disappointed. Marines-heavy machinery plus dodgy exceptions instead of &lt;a href="http://en.wikipedia.org/wiki/Continuations"&gt;elegant language construct&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I still keep my respect for the heroes who made it actually work... But on the other hand, for me it is an obvious proof that Java in all its nicety is missing a point in some areas. And it will &lt;a href="http://blogs.sun.com/gbracha/entry/will_continuations_continue"&gt;never be fixed&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I really like Java, I do. I understand the reasoning on why not to add continuations to the language. But sometimes I just cannot help myself and not regret the fact that my dreamworld is different than the real one...&lt;br /&gt;&lt;br /&gt;Java and webcontinuations then? ... No, thanks, not for me.&lt;br /&gt;&lt;br /&gt;Let's check &lt;a href="http://blogs.sun.com/gbracha/entry/achieving_closure"&gt;something else&lt;/a&gt;. And let me enjoy the fact that my first love has been appreciated by &lt;a href="http://blogs.sun.com/gbracha/entry/strongtalk_vm"&gt;people that count&lt;/a&gt;. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-116058897497853535?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/116058897497853535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=116058897497853535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116058897497853535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/116058897497853535'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/10/java-and-webcontinuations.html' title='Java and webcontinuations...'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-115511535544219173</id><published>2006-08-09T02:20:00.000-07:00</published><updated>2006-08-09T02:22:35.453-07:00</updated><title type='text'>All my girls</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3689/1649/1600/100_1250.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-115511535544219173?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/115511535544219173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=115511535544219173' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/115511535544219173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/115511535544219173'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2006/08/all-my-girls.html' title='All my girls'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17174222.post-112781468686904805</id><published>2005-09-27T02:30:00.000-07:00</published><updated>2005-09-27T02:51:26.876-07:00</updated><title type='text'>Ruby on Rails. Not a Framework. A Container.</title><content type='html'>I am one of these average Java developers that get impressed by all the RoR hype. Just reading other's blogs and passionate polemicas is not enough to get your own view, so I gave it a try.&lt;br /&gt;&lt;br /&gt;So it's true. It's true that the tool allows you to create a webapp very quickly.&lt;br /&gt;&lt;br /&gt;But after trying it out, I am less impressed than I was before, affected by all the hype.&lt;br /&gt;&lt;br /&gt;The biggest disappointment for me is that RoR is not a framework. It is a webapp container.&lt;br /&gt;When you create your great app, let's say Model layer, it has to live inside RoR. The my_model.rb file has to reside in a specific dir. The class inside is tied to ActiveRecord via inheritance. The file itself does not even 'compile' in Ruby (yes, I know it is an interpreted language...), because it misses needed 'require' statements. It is hard to reuse this Model layer or any other component in other webapp in a different way than copy-paste. It can be done, but needs being careful and disciplined. But I know that it usually is just an invitation to 'let's build something quickly and we'll clean up afterwards' hell...&lt;br /&gt;&lt;br /&gt;Agreed. The startup is superfast. You see the changes once they're done. But you have to trade-off a lot of flexibility to get that. RoR container is much more restrictive than the J2EE ones, so bashed by so many people. All RoR advantages in fact are its quick startup + Ruby inside...&lt;br /&gt;&lt;br /&gt;And speaking for Ruby. I like the language quite a lot. My first love in field of programming languages has been Smalltalk, and it always occupies a prominent place in my heart. Ruby has quite a lot from Smalltalk elegance.&lt;br /&gt;&lt;br /&gt;But let's face it - Ruby is far from being mature. It's pretty slow. It's controlled by one person. Some built-in APIs are horrible (why File and Dir does not have common ancestor for example?), and there is a lot of inconsequence (although it is much better now that it was a few years ago, so things are improving).&lt;br /&gt;&lt;br /&gt;One thing that could highlight my point is Ruby installation. When you install it, everything just works. You type 'ruby', you have it. You type 'gems' - voila. But try to install different Ruby version in different dir. Or try to have 2 different components relying on 2 different versions of the same gem. Now life is starting to get really hard...&lt;br /&gt;&lt;br /&gt;So, the end of the story is as usual - don't believe hype. Although both tools are good and perfectly applicable in some types of development, they're not silver bullet. Good ol' Java still has some its advantages, and I think I am so productive in it that RoR is not giving me that much benefit...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17174222-112781468686904805?l=mip-pl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mip-pl.blogspot.com/feeds/112781468686904805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17174222&amp;postID=112781468686904805' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/112781468686904805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17174222/posts/default/112781468686904805'/><link rel='alternate' type='text/html' href='http://mip-pl.blogspot.com/2005/09/ruby-on-rails-not-framework-container.html' title='Ruby on Rails.&lt;br&gt; Not a Framework. A Container.'/><author><name>Michal Plechawski</name><uri>http://www.blogger.com/profile/04751233170832028987</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/3689/1649/400/100_1250.jpg'/></author><thr:total>3</thr:total></entry></feed>
