Productivity Elsewhere

Enthusiasm is overrated. Developers who get religious with their programming language is something I can’t understand... Religion, you know, blinds people...

 

Take for example the following quote:
For testing a restful service API I was looking for a lean library, which would allow me to test CRUD operations of rest services with as little code as possible.


My search led me to
Dispatch, which is a highly compact Scala DSL wrapper around Apache’s reliable HttpClient. This DSL, however, is not very well documented and rather hard to decipher due to it’s heavy usage of symbolic method names but nevertheless highly appealing when understood.” [more here]

 

To make a long story short - after spending time on deciphering the API the author went on spending some more on studying how to include it in his project and, yet, some more on wrapping it with his own code.

 

Why would anyone go through this torture for testing a RESTful API? I’ll leave it to you to dig up on the guy and discover the answer (hint - it relates to the first two lines of this entry).

 

I don’t know how long it took him to accomplish the task but I’m pretty much sure it was longer than 5 minutes, which means at least five times longer than it took me to do the same with Node.js (one minute [for the mathematically challenged]):

 

 

  • Open a browser [2 sec.]
  • Google node.js rest client [0.2 sec.]
  • Click on the first result link and get to “restler” github page [2.8 sec. (rounding up)]
  • Open terminal [1 sec]
  • $ npm install restler (installs restler locally) [2 sec.]
  • $ mate test.js (launch textmate) [1 sec]
  • Save the following code in test.js:
var sys = require('util'),
    	      rest = require('restler');
rest.get('http://www.tikalk.com').on('complete', function(data) {
  	  sys.puts(data);
});

[2 sec]

 

  • $ node test (until complete) [2 sec]
  • Wait 47 seconds...

 

Viola! One minute.

 

...Productivity is, sometimes, elsewhere...

 

Comments

Nice & true.

 

BTW, I usually use graphical REST clients for this purpose, usually as browser extensions (e.g., this one).

 

 

 

I'm not defending Dispatch here, it's pretty convoluted in my mind (even nathan says so: http://code.technically.us/post/13548980134/the-gist-of-it)

 

But you're comparing a blog post that tries to explain to a one liner.

 

The corresponding one liner from the article is (I think, not an expert on dispatch):

query("http://www.tikalk.com") { println }

 

Which is short and to the point.

 

I don't think it'll take me 1 minute to figure out how to work with 'util' or 'restler' (learning their API) or install node or maybe learn Javascript.
 

It all depends on context. For you, knowing node.js, it was easy to use a node.js library. For that person, working in Scala, it was using a Scala library.

1. Node.js was an example. With Ruby you get the same results...

2. I only compared the research part of the process (from ready requirements until solution realization).

 

Why am I familiar with Node.js? 

Why can I provide a similar example using Ruby?

 

I think you missed my point...