I have been writing a program for the last few days which does some complex data mining using Google as a web service. I have been writing it in asp2.0 using VS 2005 Whidby Beta 1. Whilst I have the basics working I have come to realise that the complexity and data storage requirements of this application would be better suited to a smart client approach. In fact after discussions with our resident smart client guru Alistair Dick I think that many applications which use the “power” services on the web (ebay, goggle etc) are better served with a smart client approach but that is another topic.

 

What I wanted to blog about however was my experiences with writing this application. It is a long time since I have written any code; in fact it was asp first came out and I wrote a number of small asp applications. I didn’t have too much trouble with these, I wrote every thing in the page, the scripts got executed and everything worked. I was always a little bit careful about the order of execution but in general it wasn’t too much of a problem, especially as I normally had a clear differentiation between the default page and the results page. So I started to write this program in the same style with the web service accessed as a script on the client. Incidentally the Google Web Services SDK and the article on using it by the 4guysfromrolla are excellent, thanks Mike Pelton for the pointer! It should be noted however that the adding a web service reference mechanism has changed in Whidbey, this took a little sussing out (OK so I am slow!).

 

So the program was all written and should have worked perfectly but didn’t, no errors but the web service did not appear to be called. Half a day of poking around and scratching my head later and I still had no idea what the problem was. When I don’t know how to fix something I give up and go and ask someone smarter and luckily a real developer was in the office. He had a quick look at the code and said that the web service code should be in code behind and proceeded to put it there with the appropriate event invocations. Hey presto the code fired up and worked!

 

So my question to him was why didn’t this work on the client? The main advantages of code behind seemed to me to be scalability and cleanliness of the code rather than the fact that some things won’t work on the client. He too thought web service should work from the client and didn’t see why the code wouldn’t work as was.

 

Anyway I now have a working application but have been left with an uneasy feeling I am missing something. In particular I realise that I don’t really understand how VS stitches the code and execution order together. In my developer days (such as they were) ordering and eventing was controlled by the makefiles and I well remember writing huge and complex makefile scripts. Nowadays most of that is taken over by VS and I just don’t understand how it does it and how I can control it. We are doing a lot with build tools (MS Build) in Whidbey and I understand this as it looks a lot like the make of old but it leaves me even more puzzled about how it integrates with the “pseudo make” in VS. I have had a quick look for information on how VS does ordering but haven’t found anything.

 

Well I will finish off the application as is but have to go away at some time and understand this execution ordering issue in more detail. Does anyone know of any good articles / descriptions on this?