Sunday, October 11, 2009

The REST Debate

I guess a lot has been said about REST and RESTFull web services. Lately however some people have started thinking that it is a magic bullet, rather strange arguments are given that we don't need to know about the methods we call, well that's not true !!!!

Let's analyse web services and the CRUD (Create, Read, Update and Delete) operations both RESTfull and good old SOAP variant (to think of it REST is older)

When we use REST the entity is restricted to only four operation CRUD and calling these methods on the entity is standardised based upon GET, PUT,DELETE... and other Web verbs. In rest we define the Nouns with a fixed set of Verbs.

On the other hand SOAP gives us ability to define the Verb and the Noun.

Even if you use REST you still need to define your Noun's and it is same as defining your entity structures or object model everything else will fall into place.

REST will not make anything simple, it's just a different way of looking at things and can really benefit us as long as we use it judicially...

Saturday, October 10, 2009

A Criticism of Ajax

Now please don't get me wrong I am all for Ajax if the requirements need it. However lately some things have made me wonder when to use Ajax and when not to....

Some times things just annoy me the way semi technical people come up with design decisions.
Some time back I had been working a very capable requirements analysis and he promised Ajax on pritty much every page the client had. I was a part of these discussions and I had a word with him offline why have Ajax for a bunch of simple forms in which a user will enter Fret data.

You may be surprised or shocked, his answer was in 2008 you can't build 1998 style web site. Come on dude thats no answer. Ajax costs more in development, testing and implementation. Getting it working across browsers is fun in itself and your clients don't want it.

Using Ajax for the cool factor is just not right. I have come up with some guidelines around when to choose ajax and when not to.

When not to choose Ajax
1. Because it sounds cool.
2. Because every one else does it.
3. Because you want to avoid the page refresh.

When to choose Ajax
1. When some of your controls get loaded based on user choices in other controls and the data is just huge to be cached on client side, for example on choice of a country you display cities and on choice of cities you display zip (pin) code
2. When you know you can write good java scripts (and java scripts are different from the DOM of the browser)
3. When the cost of getting all the data on start of the page is higher.


Please note Ajax degrades server performance

I am glad I have said that, guys we should remember technology is present to solve business problems not for the cool or sales factor. Clients value honesty.