Declarative web services (2)

Posted by Patrice Neff Mon, 26 May 2008

On Friday I posted an idea about declarative web services which had been growing for a while.

As luck would have it today we had a hack day at, so I got to spend a workday on that idea. I got positive feedback from my co-workers, so I have now published the skeleton on github. The project is called “servicegen” for now – no nice name has come up yet. ;-)

See the README on github for information about the ideas.

Declarative web services

Posted by Patrice Neff Fri, 23 May 2008

I’ve been developing a lot of web services lately. I usually do this with Okapi and

Somehow the tasks for creating a web service are always more or less the same.

  • Specify URL schema
  • Validate input parameters
  • Request data: either from a database or from at least one other web service
  • Identify output format using URL or HTTP headers
  • Output data in the correct format

And I think that even doesn’t do a good enough job of making this easy and really fast.

I’m starting to think that a DSL might be the correct way to that. The only project I know which partially does that is ActiveWebService from the Ruby on Rails project.

I just hacked together two very simple prototypes of how such service specification could look. I’m interested in two things:

  • Does something like that exist already?
  • Is it a stupid idea?

See my two examples derived from real services I developed inside

  • Meteo – providing weather forecast data which is written regularly into a database (by a process not defined here).
  • Wintersport – a service providing information about skiing locations based on data from MySwitzerland

Cultural differences: Python vs. Java

Posted by Patrice Neff Tue, 06 Nov 2007

I’m pretty programming language agnostic and fluent in a handful of different languages. That means I use the language that gets the job done. But I tend to lean towards dynamic programming languages specifically PHP, Python and Ruby.

Last week I had to solve a non-trivial problem for my background: clustering of content. I had to write a program which takes a bunch of search results and clusters them together by content. So similar results would go into the same group.

I started with Carrot2 – a Java framework for exactly that purpose. The only available documentation is the API reference and some examples. The API documentation contains 796 classes. That’s no typo, count them if you must. I spent literally two working days trying to get it running. I got it running somehow but got stuck when I had to customize text distance function.

That’s when I started to search for other packages. I found python-cluster. It exposes two classes (for the two different clustering algorithms) with a constructor and one method each. All I have to pass it is the list of results and a distance function.

I was up and running literally in less than an hour. Most of that I spent on a reasonable distance algorithm.

Not passing any judgment here. Both frameworks have their strengths. But I found it a very good example of the different philosophies in the two camps.

Text input with Dasher

Posted by Patrice Neff Fri, 01 Jun 2007

I recently stumbled over Dasher. It’s a text input method which can work without any keyboard. It can be controlled with mouse, touch pad or even an eye tracker.

It would be very interesting to try out the same approach for source code. Basically you could use source code – e.g. your current project – as the learning source. And then by having a more efficient input method than the current demo it might actually be an efficient way to re-use code.