Monthly Archives: June 2006

A parallel of equality in 2 worlds (Ruby and Java)

Here is a short presentation of equality methods in Ruby and Java:

Ruby Java
Object#equal? ==
Object#eql? Object.equals
Object#== Object.equals
Object#=== N/A

So, in both Ruby and Java we have an instance reference equality or identity (Object#equal?, respectively the == operator).

Another similarity is for objects used as keys in maps (hashes). If you want to customize their behavior, in both Ruby and Java will have to override Object#eql? and Object#hash, respectively Object.equals() and Object.hashCode(). And that would be it with the similarities.

In Ruby world, Object#eql? and Object?== are named equivalence. I haven’t been able to find out the reasons for having both Object#eql? and Object?== and the only example I have found is the following:

2.eql? 2.0 => false
2 == 2.0 => true

Ruby has another equality method Object#=== and this one is used only in case statements.

Reference:

category: , , ,
Advertisements

5 Comments

Filed under Uncategorized

Code reviews and tools (plugins) that may help

After reading Cedric‘s post on Code reviews I remembered that I have used an Eclipse plugin that helped me doing code reviews: Jupiter (I have even submitted at that time some patches [blink/]). As far as I know the plugin is continuously improved so if you are in need for something like this go and get it a try.
Another nice Eclipse plugin that might help with code reviews is Mylar even if its intention is not exactly this one.

3 Comments

Filed under Uncategorized

Stripes?… sounds cool

Being in an investigate/document/read mood these last days, and trying to figure out a good answer to Tim’s question: What Web Application framework should you use? and Matt’s answer, I’ve given a short read to Stripes documentation.
And I must confess that at first glance I like it. It may sound weird comming from an WebWork/SAF developer, but hey, I am doing my best to be objective. I also have to confess that I haven’t got time to really play with it, and I just passed through the documentation, which by the way is well written and clean.
Talking about the rationale behind it (sounds like RoR success story [smile/]):

The main driver behind Stripes is that web application development in Java is just too much work! […] Others, like WebWork 2 and Spring-MVC are much better, but still require a lot of configuration, and seem to require you to learn a whole new language just to get started.

The framework looks like needing almost no configuration (Zero external configuration per page/action (ActionBeans are auto-discovered, and configured using annotations)), tries to eliminate the need to duplicate domain object over the web layer and makes heavy usage of Java5 annotations (f.e. even for URL binding: UrlBinding).

[…] But that doesn’t mean that it can’t run on a Java 1.4 JVM.

and you can read a 2 page HowTo for using Stripes with 1.4 JVMs. There are many other interesting, and I would say important aspects needed for building a normal web app, but I am not gonna describe it here (because I haven’t gained the knowledge to do it and I may present wrong ideas). Here it is a short list of things that I found interesting:

Quick updated: after reading the documentation on site, I have downloaded Stripes and hope to find the time to play with it a little.

6 Comments

Filed under Uncategorized

InstantRails using existing installations (tips and tricks)

I’ve been reading a lot about Ruby on Rails, because being a committer on one of the most important Java web frameworks (WebWork) made me curious about it. But this post is not another RoR vs Java web framework post. (by the way, WebWork has already some productivity improvements and more work is on the way on the SAF2 (Struts Action Framework) side)
Today, I’ve had finally time to install RoR on my laptop in an attempt to see it at work. I was looking for an installer that would make things very simple, and indeed the guys on Ruby community made it available in the form of InstantRails. A zip file, containing absolutely everything you need to start playing with RoR and immediately see your toys. Excellent decission!
However, I’ve been a little bit intrigued by the fact that the zip file already contains a Ruby distribution (1.8.4) and also MySQL, both of which I have already installed. So I have tried to make it use the existing parts I had instead of its own copies. As advertised, RoR is about convention over configuration, so I couldn’t figure out how to do this without some tricks [smile/].
The tricks are quite simple:

  • copy all RoR related gems to your default Ruby installation
  • copy all SCGI and Mongrel scripts to your default Ruby installation dir
  • delete the ruby directory in InstantRails installation and use the excellent tool junction to create a link from ruby to your Ruby installation dir
  • use mysqldump utility to dump the example dbs in InstantRails
  • create these DBs in your MySQL
  • delete the mysql directory in InstantRails installation and use again junction to create a link from mysql to your MySQL installation dir

After doing this you have an installation of InstantRails that uses your existing Ruby and respectively MySQL installation.
I am posting this because I couldn’t find any hints on achieving it on InstantRails mailing list archieves and I guess there may be other people trying to do it.

category: , , , ,

3 Comments

Filed under Uncategorized

Agile boss, Agile PM and Agile developer

The last days I have noticed some interesting discussions about agile techniques/strategies/etc. Being interested for a long time on this topic and anything related, and reading daily on InfoQ the agile posts, I thought I would like to touch another aspect of agility.
Most of the discussions around agility are centered on what and how the developers must/should do. But, in my experience I have found out that managers and bosses have the real problem moving to agility (and it looks like others are having the same opinion). The problem is that most of project managers and bosses will not embrace agility (even if there are recommendations for them too). I don’t know the reasons, but I can understand some of them.
So, let’s see some of them:

  • I don’t think it is really possible to go out and win a project without good schedules, timeplans, decissions and budgetting. Your participation in the auction will be simply denied without these.
  • I don’t think it is really possible to have your PM go into a financial meeting and say that there are some guestimates, but no real schedules
  • I haven’t met many managers that would spend time explaining their thoughts (as a form of requirements specification)
  • it’s hard to believe that all clients you will meet are agile, so that you use agile techniques while collaborating
  • many partner companies (the ones you do the project for) will not like to sit in the same room; they have already chosen to externalize the project because they don’t have resources and they consider they should to something else

In my humble opinion agility is not the silver bullet. I am not worried about some of its contradictions, because I know that methodoligies must be adapted and than applied, but sometimes I might get worried if or when finding out that agile never fails.

2 Comments

Filed under personalog