Thursday, March 27, 2008

Old Code Part 4: I thought it was a Joke

Question Mark image by jhhwild on flickr About three years ago some senior executives at our company were in town for a big planning meeting.  As frequently happens during these times the entire office went out that night to show the visitors a good time.  During that get-together, the director of our office came to me with a question: Is it possible to have our web based application open a desktop app on the server and have a user over the web control that application.  I basically and politically said no, with the standard disclaimer that with enough time and money anything is possible of course.  So I thought that was the end of it.

The next afternoon I'm sitting at my desk working and in walks the director who promptly asks how I'm doing on making the web app launch and use the other app.  I was kind of stunned as I thought the topic was done but I start researching at the point.  Pretty much everything I can find either says it can't be done or you are stupid to even try.  The best answer on Google Groups was to quit working at a place with such unrealistic expectations.

So I took my findings to my boss who says "Yea, that's what I'm hearing from other people too, but you still need to make this work."  And with that I went to work on a prototype.

Over the next week I learned about using p/invoke to launch a windows app.  It was a little odd, being a web developer but within a week I was able to launch the windows app and send keystrokes to it.  Having proven that at least that much was possible my boss then assigned a couple more developers to work on this.  Luckily one of these developers had a windows background and so he took care of the lower layer.  We then had the prototype actually scraping the windows app and passing the values up through a windows service, to the web app.  At that point the web app would convert the values into screen coordinates and control types, and populate then with values.  We even had the app sending each keystroke from the client browser to the web app via AJAX and whenever the windows app updated itself we would refresh the screen to update the visible controls.  It would also spawn multiple instances of the web app, one for each user.

We had accomplished what we had thought was not possible!

When we showed this to the director, he was glad that we got it to work but to me didn't seem as impressed as he should have been :).  He did go off and tell the Japanese sponsors of the project about it though and before we knew it we were on a 8:00PM WebEx with Japan showing off our prototype.  Before this call got started we were under the impression that it was going to be just a couple of the executives from the earlier meeting in Canton.  When it actually got started however, it sounded like an entire conference room full of people.  We ended up finding out that the development team in Japan that had written the windows app had been tasked with this same goal earlier and had tried and failed.  I would NOT have wanted to be in that room when the inferior American developers showed it working :).

In the end, the project that we had proven possible was moved offshore where it was morphed into something else entirely.  At least we knew we had done it, and now so do you :).

2 comments:

TheProkrammer said...

To paraphrase Dr. Malcolm:

Yeah, but your developers were so preoccupied with whether or not they could, they didn't stop to think if they should

John Stockton said...

Well that's not quite true. We developers often questionend if we should, management though wanted it regardless. So we did it. They do sign our paychecks after all.