Thursday, 19 August 2010

WCF and jQuery (Part 3 The Return)

So WCF is pretty incredible. It's not new by any means and there are plenty of cleverer people out there who use it every day and get results and that's cool. But if you've never used it before and you get something working like I have this week you can suddenly see all kinds of potential.

Firstly it's good for me that Microsoft enable this to happen pretty easily. I bought a Ruby on Rails book a couple of months ago and started going through the examples and was blown away by how you can get a simple RESTful application running in a few minutes. Well, now I can do that with the Microsoft platform too which means I can still code in VB.NET (great) and still use Visual Studio which I think is the best development environment on the market. Tried Aptana. Tried Eclipse. Tried Notepad. No competition.

Second it makes life easier for me as a developer because I can publish a service with access to all the data and let someone else decide how they want to consume the data. When writing SOAP web services you have to make a concious decision to return XML or an Object or a String or something else. If I wanted to return JSON I would have to get the data out of the database and transform it into JSON. It's not difficult but it takes time. With this WCF DataService the developer can say "I want to get the data in XML or JSON" just by flicking a switch in the code. I don't need to get involved (from what I read though JSON is what everyone wants and why not? Heck of a lot easier than parsing an XML document).

No more database objects to write and maintain. Before customers were saying "we want to see this subset data in this order", and then they would ask to see it in a different order and with something else appended. Again, not impossible but if you're working on a relatively small but important application a Business Objects license is out of the question because they're too expensive. So you have to do the reporting yourself. This RESTful stuff makes those leviathan reporting tools obsolete much like QlikView does (see my previous posts for some info on that amazing tool).

I guess that security is a concern, much more than it was before. If I stuck the service that I created in the demo onto the internet then anyone can come along and CREATE, UPDATE and DELETE records using request / response. So understanding security becomes important and I suppose a decision needs making about securing the web server (because I'm guessing you can restrict GET/POST/PUSH/DELETE there) or securing the DataService itself. Something to read up on.

My next goal is to get a meaningful Javascript app communicating with a service and doing some funky stuff, reading data into a grid, creating records, updating records, deleting records. The Javascript stuff is going to be much more difficult because I have never used it before but I do like a challenge.

No comments: