Saturday, May 22, 2010

Versioning in RESTful Web services

Two kinds of versioning: Data versioning vs schema(language) versioning
Langage versioning should be forward-compatible - not require existing clients to change their implementation. See Tag recommendations
Options from Stu Charlton
- version in content
- versions in URI
- versions in MIME-type http header

Tuesday, December 8, 2009

HATEOAS (Hypermedia as the Engine of Application State)

HATEOAS requires that each server response must contain not only the requested data — but also control information (in the forms of specially tagged URLs) describing the next set of permitted interactions with the server .....
Craig McClanahan's post on advantages of using HATEOAS - reduced client' coding errors, avoid invalid state transitions, fine grained evolution of the api's.
Jim Webber's

Thursday, November 26, 2009

SSH X11 Forwarding

SSH X11 fowarding allows X11 connection to be tunneled from the remote system (client) to the local system (display server). Here is how to set it up to work on a Mac OS.
Open a X11 terminal
Start an ssh session: ssh -X -l username server-ip
xclock &
It should display on your Mac screen.

Friday, October 9, 2009

Maven

There is a lot of discussion on the net about issues with using Maven for builds. Fairly old post by Howard Lewis (Tapestry creator).
Read this Infoq Maven debate Another post worth reading is Don Brown's

The key problems with Maven seem to be:
  1. Poor documentation leading to a somewhat steep learning curve
  2. Inconsistent builds due to fact that repository metadata is not properly maintained and newer broken versions of plugins can be released. Maintaining transitive dependencies is a hard problem! This issue can be addressed by using very specific versions of plugins in the Maven pom.xml and by caching dependencies in a local metadata repo and configuring your Maven build to look there first before going to general repos like Maven or ibiblio.
  3. Verbosity of the pom.xml- this is primarily due to XML language choice itself. One way to address this is to use inheritance and put most of common stuff in a parent pom so that a project's pom is limited primarily to dependencies.
  4. Dealing with large multi-module projects - even Ant builds I suspect will have a problem here.

Thursday, September 10, 2009

Sharding

The best discussions I have come across is here (http://www.startuplessonslearned.com/2009/01/sharding-for-startups.html) and
here
http://blog.maxindelicato.com/2008/12/scalability-strategies-primer-database-sharding.html

Wednesday, September 2, 2009

MVC in the browser

Web applications should be architected with a RESTful API on the server side (using frameworks like Jersey or Restlet talking with a Javascript client UI. Libraries like JQuery and associated plugins make it easy to build sophisticated UIs and allow you to implement MVC concepts in Javascript. I see this approach becoming more common over the "traditional" web application, where the MVC framework is server-side and generated HTML UI (with javascript mixed in) is rendered in a browser client.
Pros of writing web apps this way:
1. RESTful service api is accessible to multiple clients - not just the browser, any desktop client (e.g. Java Swing app) or even external third-party consumers.
2. The size of "data" exchanged between client/server is less - compare to entire HTML page generated by traditional web app which is sent over the wire from server to client.
3. There is a clean separation between the client UI and the server which makes testing the UI in Javascript that much easier (you can stub out the RESTful services).

Monday, August 17, 2009

Using JQuery's dataFilter option to plugin parser for json

In a JQuery ajax call, when the data type is set to "json", JQuery uses the "eval" function to convert the response from the server into a valid Json object. There are some security concerns with using eval. As mentioned in the post, the alternative to using eval is to use a json parser. The downside is that javascript parsers are not going to be as performant as using eval. An easy way to plugin your parser is to use the dataFilter option in JQuery ajax call. For example:

$.ajax({
type: method,
url: url,
data: data,
dataFilter: function(data) { <<<<<<<<
return jsonParse(data);
},
timeout: 20000,
cache: false,
success: success,
error: error
});
Notice the dataType parameter is omitted since we handle the parsing ourself.