Don’t Rethrow, Please

Dear fellow Ruby developers, please kick the habit of catching  and rethrowing exceptions, thus ridding your users of the expeptions’ stack traces. Recently I had to patch the source code of an ActiveRecord adapter as well as the underlying DBI implementation in order to find out where one particular exception was originating from. This makes debugging code really a hassle. I haven’t had this kind of problem in Java since nested exceptions.

The Ultimate Code Browser

I want a Firefox Plugin that recognizes that the page I’m looking at contains Java, does syntax highlighting and, most of all, inserts links to the classes and methods referenced in the code. The plugin (or a server it can ask) should know where the source code of a class like org.springframework.beans.factory.BeanFactory can be found.

First I thought that such a plugin would need (or could at least profit from) sem***ic web technologies (no dirty words on this blog, please), but it probably wouldn’t. All we need is a global registry that maps package names to the URLs of the web interfaces of the respective source repositories. (Maybe Google Code Search could be such a repository, but its results are often pretty bad.) The plugin would also have to include a reasonably good Java parser, and maybe a heuristic to distinguish betweeen Java and non-Java text.

Why would I want such a thing? Well, I often have to dig through the code of some open source library in order to understand a bug, or just to figure out what I can do with it, and how, because the documentation is incomplete or wrong. Usually I create an Eclipse project and import the code from the source repository, but that’s quite a lot of overhead if I just need to browse the code for ten minutes or so. On the other hand, digging through source code on web pages, without the help of links between the pages, is just a nuisance.

And wouldn’t it just be so cool to have one of the most important features of an IDE as a browser plugin, enhanced by the power of the world wide web?

P.S.: Or maybe I don’t want a browser plugin - maybe I just want Google to put some more effort into Code Search? Come on, guys, you’ve got all it takes - the global repository, the parsers, the heuristics…

Pandora’s Box

Even a simple HTML parser library today comes with hundreds of dependent archives, adding up to a nice 4 MB download. Which should be no problem, but at home I am blessed with an ISDN connection. Is there anything as a library package management system like in Python, Perl or Ruby for Java? If anyone has seen this, let me know. If there is none, this would be the time to stand up and implement!

Quite Groovy

In the recent weeks, both of my co-bloggers told me independently of each other about Groovy, the new hipster language which brings the scripting goodness of dynamic languages like Ruby and Smalltalk to the JVM Sweet JVM, so I finally couldn’t resist but take a look at it. To be honest, I didn’t like its Java-like syntax from the beginning, with all the parentheses, lowerCamelCaseIdentifiers and such, but that was just because I prefer Ruby’s very lean syntax. Its concepts are very close to Ruby (modification of objects and classes at runtime, blocks/closures, etc.) and of course it integrates well with the Java platform and its rich libraries, since this is the purpose for which it was created, to add a scripting facility to the Java platform. Groovy scripts are compiled into bytecode before execution and thus run on a normal JVM.

A crucial part for dynamic languages today (at least in my eyes) is the creation of domain-specific language, which Groovy also supports. Gant, for example, is a Groovy DSL for Ant scripts. Another example (take from the Tutorial Domain-Specific Languages in Groovy, PDF) I find very practical is a DSL for creating query criteria for Hibernate in the Grails framework (formerly known as Groovy on Rails, so its purpose should be clear):

def c = Account.createCriteria()
def results = c {
  like("holderFirstName", "Fred%")
  and {
    between("balance", 500, 1000)
    eq("branch", "London")
  }
  maxResults(10)
  order("holderLastName", "desc")
}

A good thing, but looks too java-y for my taste, I miss the feeling I get when using a Ruby DSL, such as SQL-DSL, for example:

statement = Select[:column1, 'book', 10].from[:table1, :table2].where do
  equal :column1, 99
  not_equal :column1, 100
  less_than :column2, 'foo'
  less_than_or_equal :column3, :column4
  greater_than :column1, 0
  greater_than_or_equal :column2, 'bar'
  like :column1, 'any'
  is_not_null :column1
  is_in :column1, [1,2]
  is_not_in :column2, [3, 4]
  exists 0
  not_exists 0
end

But maybe that’s just personal preference.

From a few first glance I get the impression, that Groovy is quite successful as a scripting sidekick to Java and I’m curious to learn more about it.

Survey on Web Development Platforms

The software engineering folks at our institute, who hosted the Plat_Forms contest, are conducting a survey on platforms for web development. So if you are familiar with developing web applications in at least two programming languages and would like to contribute to research in this area please take the survey, it will take about 10-15 minutes.

Comparing Web Development Platforms

I would like to point you to a study a professor of my university (i.e. my workplace) did with his team. One goal, nine teams, thirty hours, three platforms - J2EE, Perl and PHP. Why they did not evaluate Ruby or Python is far out of my knowledge (and why anyone would do actually web devopment in Perl), but the setting is interesting enough. A rather lengthy report can be found here.

Update: I did not read the document thoroughly enough. The answers to my questions:

“We had some contact with potential teams from the Python arena, but there were not sufficiently many who were qualified enough. In the end, only one formal request for participation was submitted, so we did not admit Python into the contest.”
“It was impossible to find Ruby-on-Rails teams (“we are too busyâ€?). “

Between Heaven and Earth

Today I stumbled upon another source of developer wisdom, Des Traynor’s Programming Theorems. One of the theorems rings especially true for me after the recent insights into developing a Sudoku solver the TDD way:

For every Architecture Astronaut out there, there is at least one coder who thinks that being “Agile” is a perfect substitute for foresight.

If you wonder what Architecture Astronauts are, its a term coined by Joel Spolsky with regard to people climbing up the abstraction ladder a little too far:

When you go too far up, abstraction-wise, you run out of oxygen. Sometimes smart thinkers just don’t know when to stop, and they create these absurd, all-encompassing, high-level pictures of the universe that are all good and fine, but don’t actually mean anything at all. These are the people I call Architecture Astronauts.

I know that I tend to be an Architecture Astronaut sometimes, probably it’s because thinking meta keeps me from the exhausting work of bothering with all the real-world problems. I wouldn’t be surprised if this was the main reason for developers to become Architecture Astronauts at all.

But Architectural Outer Space isn’t a place where I stay very long usually, because its my experience that the lack of oxygen disrupts any attempts of getting actually something done. And that’s where agility fits in: If I get the whole idea of agility right, it’s all about getting things done (unless you use it as an excuse to shutdown your brain).

Green and Calm

There are few things in this world more soothing than the green bar of a project-embracing JUnit test suite after moving to a new platform.

I Am Just A Poor Lonesome Developer

… and a long, long way from home. Currently, I am looking forward to doing software projects as a solo developer for the next time. The XP way seems very promising to me but it has a strong focus on teams - pair programming, stand-up meetings and the like. Fortunately, the XP people are also aware of the “solo developer” problem and there are some interesting suggestions for using the XP benefits for your lonely-cowboy-project.

Sneaky Snippets (2): A Spec’s Half-Life Period?

From a specification template of a company I worked for some years ago:

Purpose for states: Draft, Adopted, Deprecated

It kinda speaks for itself.

Next Page »