The Programming Language Is Your Most Powerful Tool

Thursday, May 15th, 2008

Ola is so spot on with this one:

A New Hope: Polyglotism: “The one thing that I am totally sure if is that we need better tools. And the most important tool in my book is the language. It’s interesting, many Java programmers talk so much about tools, but they never seem to think about their language as a tool. For me, the language is what shapes my thinking, and thus it’s definitely much more important than which editor I’m using.”

I do not know how many discussions I have had with Java developers who questions Ruby et al. because there are no IDE’s with the same feature sets as those found in Java.

(Via Ola Bini on Java, Lisp, Ruby and AI)

Rails is moving from SVN to Git

Thursday, April 3rd, 2008

A year ago I was frustrated over Rails’ close ties to Subversion. But as Rails is moving from SVN to Git, the future is looking bright. The only bastion left I can think of is RubyForge.

Things I Have Actually Used

Monday, March 31st, 2008

Robby Russell is a constant source of information on Ruby and Rails, I have used his instruction on how to set up Rails and PostgreSQL on Mac a number of times. It is therefore fun to see that I have actually used 3 out of the 5 things he wants to know more about::

RSpec User Stories

We were very early adopters of this one, we started using it the same day it hit trunk in a useable form. Everyone should start using it today - I cannot speak highly enough of it. The only thing I miss is a Fit-style table approach to rules, but I have my own thoughts about that one.

Using Selenium with RSpec

We have used the now outdated spec/ui library at WeMind. Today we use RSpec Stories almost exclusively for acceptance testing. My position is to use Selenium only where you really need it, for example to test Javascript functionality.

JQuery

I have used it for the dynamic hiding of speaker info for Agila Sverige. Not at all enough to judge a library by, but it feels a lot sweeter than Prototype/RJS.

JSSpec (BDD for Javascript)

Yeah, I wanna know more about this as well.

Using the Google Charts API with Rails

Same here.

Other than that I would love to try out:

  • Seaside - I have dabbled with it but nothing worth mentioning.
  • CouchDB

The Lazyweb

Thursday, March 6th, 2008

Yesterday I twittered that I was trying to find a version of Ruby that both cc.rb and Rails likes. Last night, Wordpress plugin Twittertools posted yesterdays twitters to this blog. And this morning, I have an answer from Alexey Verkhovsky what the good versions are. Gotta love the lazyweb.

git Is Winning The DVCS Battle With git-svn

Saturday, February 9th, 2008

I’ve been using distributed version control for over a year now, and if it is up to me, I will never use a centralized VCS again.

When I evaluated the alternatives last year, I choose Mercurial as the DVCS we are using at WeMind. The reasons were:

  1. Usability - git was quite obscure back then
  2. Speed - bazaar and monotone was quite slow
  3. Large enough uptake - OpenSolaris and Mozilla started using Mercurial at the same time.
  4. Runs on all platforms, if we ever employed someone who wants to use Windows
  5. Built in Python which could be a good think if I ever wanted to extend it

A year later we are happy with Mercurial, but the landscape has changed. In particular I am seeing a huge growth of people using git, especially within the Ruby community. Which in itself is something I am happy about.

The biggest reason I see for git’s resurgence is git-svn. It allows people to start using git locally while still having Subversion as the backend, and when everyones ready the switch is easy.

There is a hgsvn in the Mercurial world, but it is read only, so you cannot push your changes back to Subversion. I strongly believe that the Mercurial community should focus on this if it wants to regain its momentum.

Git still has weak support for Windows, but that seems to be a non-issue in the Ruby world.

I am pretty agnostic about which DVCS will be the dominant one. The most important thing is that people are moving away from the centralized VCS’s.

For a great post on the subject, read what Dave Dribin has to say about it

Java vs the JVM

Friday, February 1st, 2008

Tim Bray on the JVM being the good part of Java:

“But the Java language just doesn’t seem like the interesting thing about Java, these days.”

I wish more Java programmers would agree to this. One of my observations at JFokus the other day was that a lot of people really like Java the language, and are going through hoops to implement their ideas in it.

Stephan Janssen has created a kick ass new version of parleys.com in Flex/Air, but he wants to redo it all in JavaFX script, just so that it is Java. Rickard Öbergs new framework for composite oriented programming could be useful, but in my opinion it introduces enough new concepts to qualify for a whole new language. Lipsticking on top of Java makes it feel verbose and clumsy. After a year of Ruby I have very little patience for Java interfaces.

(Via ongoing)

Groovy and Ruby

Thursday, January 17th, 2008

I cannot help myself from making a small comment on Rick Hightowers post on Groovy vs JRuby. In short he thinks Sun should support Groovy instead og JRuby, because the syntax is familiar to Java programmers.

To support his case he presents a chart showing language popularity according to job postings. And since Ruby is at the bottom and Java is on the top, Sun should support Groovy. Which by the way is not even on the chart.

One thing I did recognize was this:

Comment on Rick Hightowers Groovy post

Notice that between Java and Ruby/Python there is a wasteland of languages that you will not see running on the JVM in any near future. So if Sun wants to expand the developer base for the JVM (not Java the language), I believe they are making a very wise decision to support the largest languages available to them outside of Java.

Supporting Groovy would probably be popular among the already converted, but Sun has to appeal to new markets to expand the JVM usage. I believe that is what they are doing.

Agile Sweden 2008

Sunday, December 30th, 2007

After reading Aslaks post on his upcoming conferences it is obvious to me that Stockholm is sorely lacking in the conference space.

Aslak mentions RubyFools in Copenhagen and Oslo, and Smidig 2008 in Oslo. RubyFools seems to be great, and I know that Smidig was awesome in 2007.

The only conference I can think of in Stockholm is JFokus, which I hear is very good but Java only. Looking to the whole of Sweden we have Øredev which I always has found too unfocused, and Expo-C which I cannot tell if they exist anymore.

I guess I have no right complaining if I am not prepared to do anything about it. So, after Smidig 2007 in Oslo, we have had talks within the Agile Sweden network about running a similar conference in Stockholm this spring. And while this is no announcement by any means, I am putting pressure on myself to actually contribute to make it happen by speaking openly about it.

Look out for Agile Sweden 2008 this spring.

Tool Support Should Be Loosely Coupled

Monday, December 17th, 2007

I just read the following in a month old post on the RSpec list:

As someone who uses an IDE, I find dealing with multiple SCMs is a real
pain, and one of the cool things about Ruby has been that
(traditionally) nearly everything’s in Subversion

It might be that Rails will have hard time keeping up with new stuff, both technically and culturally, since it tied really close knots with everything that was cool 2005.

Choice Is Good

Thursday, December 13th, 2007

I was happy to note that Dion Almaer commented on my blog post on Merb. Dion is one of my favorite bloggers/podcasters and I value what he writes highly.

But I disagree with him on this one. The problem with using Java for web application development was never one of too much choice. In fact, it was because of that choice that Java became a player in the server side market at all. Sun alone never had the answer to what was needed for server side development, instead the open source world stepped in and made incremental corrections.

The same thing is happening to the Rails world. The core team cannot create a framework that is a one-size-fits-all. The initial Rails proposal is great for a large number of webapps, but it is other things around it like plugins and JRuby that is making Rails a viable choice for all.

My Java tools of choice was usually Tomcat/Jetty, FreeMarker, iBatis, WebWork tied together with Spring or PicoContainer. What I hated was having some frankensteinian-enterprise-architect-design-by-comittee-lets-not-be-different stack forced upon me with a fullblown J2EE server, EJB’s, Struts or the JSF monster, sprinkled with an Eclipse-only development environment. And I hope dearly that Rails development is not going the same way where people question you on your choice of tools and wonder why you are not using MySQL and TextMate like the rest.

There is one choice that I do not miss though - directory layout. I am truly happy every time I do not have to choose it.

Instead of not having to choose, the most important difference I’ve experienced is that Java as a language together with the Servlet/J2EE spec induces a lot of accidental complexity, which is almost non-existent in the Ruby/Rails world. It is that which enables the increased velocity many development teams experience when switching to Ruby.

Merb, Leaner And Meaner Than Rails

Saturday, December 8th, 2007

I have used Rails on a daily basis for almost a year now, and before that I was a night time hangaround. While I am definitely a happier programmer using Rails than anything built on Java, I still feel that it can get better.

First of all I want more things to be plugins. And really, they should not be plugins at all but gems instead.

Why plugins? We use RSpec instead of Test/Unit, HAML instead of erb and are seriously looking into JQuery instead of Prototype. And of course, we are using Mercurial instead of Subversion. All of this is of course possible to use in Rails, but a lot of things are sort of made for the default choice, such as generators generating tests, and plugins having the -x switch for Subversion. And I am pretty sure that this is the way DHH wants it.

So, when 2.0 is now released, I see that the Rails community as a whole does not see the same problems as I do. If they did, they would have done more like the stuff above, instead of sexy migrations and ActiveResource.

This is where Merb becomes really interesting. I have looked at it before not understanding its value, but now I see a framework that does everything I want Rails to do. Gems as plugins and very agnostic about templating languages, Javascript frameworks and even ORM frameworks - almost a heresy in Rails. I will definitely think about using it instead of Rails in the future.

Building Vim with Ruby on Leopard

Monday, November 12th, 2007

I have had problems compiling Vim on Leopard, and it turns out that the culprit is the built in Mac Ruby. No clue why, but when after port installing Ruby, Vim installs cleanly.

I guess I’ll have to go with MacPorts Ruby - having a working Vim beats DTrace, however cool it is.

Distributed Version Control

Wednesday, October 17th, 2007

I just read this article on distributed version control by Ben Collins-Sussman who is a lead developer behind Subversion. If I understand his arguments, he basically says that DVCS is better than centralized VCS, but you probably should not use one since 80% of all developers are too dumbfounded too understand VCS at all.

I am one of the pretentious, self-righteous and obnoxious fanboys of DVCS. And let me tell you this: the difference between using DVCS and Subversion is on par with the difference in programming in Ruby compared to Java. If you have made the switch you just do not want to go back.

And finally: We have taught our GUI-guy Martin to use Mercurial. He has limited experience of using VCS’s, but he grasps the difference between commit and push. My face is straight saying this.

Delphi and JBuilder as role models for Rails development?

Thursday, September 20th, 2007

Chatting over a beer with Ola Bini last year, we discussed the possibilities for JRuby. My dream was to run a Ruby IDE on top of JRuby to get a Smalltalk like environment, because Smalltalk is still the best programming environment I have ever used.

Now that 3rdRail, running on JRuby, is released, should I get my hopes up? Some people are actually very excited about it, but when Delphi and JBuilder are referred to as some sort of pinnacle of development it seriously makes me wonder.

RubyOSA

Wednesday, June 27th, 2007

This tutorial on RubyOSA is great. I have never got around to learn AppleScript, and now it seems like I never will.

Ruby DSL’s vs YAML vs XML

Monday, May 14th, 2007

I am using Ruby based DSL’s for a number of tasks in my current project. But one day it struck me - am I using the right tool for the job, could there be a better, more simple solution?

Some DSL’s I use are simply declarative and look something like this:

I find that quite readable, but it requires me to maintain code that handle the DSL. So I figured, what if I used YAML? It is simple, and using it would mean less code to maintain.

After doing some experimenting, this is what I came up with:

In my opinion, the YAML is not as readable as the Ruby DSL. I also find it more error prone as those dashes are sort of tricky.

XML?

With the correct schema, errors can be avoided, but it is just too much text in there, it gets heavy and verbose.

The verdict was to stay with the Ruby DSL’s - their readability and flexibility are well worth the effort of maintaining a separate parser - which is quite short really.

Rails, PostgreSQL and Time

Wednesday, May 9th, 2007

I just noticed that the mapping between PostgreSQL’s Time Without TimeZone column type maps to Rubys standard Time class. Which gives the following behavior in script/console:

 
   >> t = TimeEntry.find(1)
   >> t.time
   => Sat Jan 01 23:00:00 +0100 2000
   >> t.time = Time.now
   => Wed May 09 19:02:07 +0200 2007
   >> t.save
   => true
   >> t = TimeEntry.find(1)
   >> t.time
   => Sat Jan 01 19:02:07 +0100 2000
 

Am I very anal to find this … sloppy?

has_many :through and callbacks

Friday, April 27th, 2007

Reading this a little bit earlier would have saved me a lot of time. In short: callbacks such as :before_add does not work with has_many :through, and the documentation does not tell you that. To get callbacks, add them to the join model.

RSpec, Autotest and views

Tuesday, April 17th, 2007

The current incarnation of autotest seems to assume that you are using integrated views. If not, you can modify the rspec_rails_autotest.rb file to run the view specs as well:

 
  # when %r%^app/views/layouts/(.*)\.rhtml% then
  #   ["spec/views/layouts/#{$1}_spec.rb"]
  when %r%^app/views/(.*)\.rhtml$% then
    ["spec/views/#{$1}_view_spec.rb"]
 

Your view spec must be postfixed with “_view_spec.rb” for it to work

Update This works out of the box now.

Autotest 3.5.0 and Growl

Friday, April 13th, 2007

Autotest 3.5.0 is out, and the result given from Autotest is no longer a String, it’s an array of strings. So if you still want Growl to function properly just modify the .autotest slightly: