Properly create the XMLHttpRequest object

Posting this as a reminder for the future. IE 7 will support the native XMLHttpRequest object, but the older versions will continue to use the ActiveX object. Right now, when creating the XMLHttpRequest object, the norm is to attempt to instantiate the ActiveX object, if that does not work, then attempt to use the native implementation. I saw a better recommendation on Joe Walker’s blog.

This will attempt to create a native object first, which will work for IE7 and other browsers, and only attempt to create the ActiveX object as a last resort.


var xhr;
if (window.XMLHttpRequest) {
  xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
  xhr = new ActiveXObject("Msxml2.XMLHTTP");
}

Getting my head around frameworks

I received the Programming Ruby book yesterday and today I received an email from Dave Thomas that our Agile Web Development with Rails has been shipped so I should be getting that one next week sometime. Are we drinking the Rails kool-aid? I would say that we are not but I certainly think there is a place for it in the enterprise. Will it replace PHP, Perl, Java or X technology? I don’t think RoR will take over these technologies but some projects will be a perfect fit for this dynamic language.

Since I don’t want to just believe the hype around RoR, I would like to put a small application together and get a first hand look at the framework. However, RoR is not the only framework getting some attention these days. Model-Glue has been picking up fans as well among the ColdFusion community. There are some PHP frameworks that are also gaining some steam by riding the AJAX train and applying some lessons taken from the Rails camp. So, I would like to put a sample application and port it across these frameworks as a learning experience.

I would also like to become more familiar with these frameworks. I have found the organization they provide, a key factor in getting a stronger grip on the whole object oriented programing paradigm. However, the regular semester starts in less than a week so our experiment will take a short delay before we get into any development. This might be a good time to get some of the design decisions made and look a little more into Cake (a PHP framework) and get some reading done on the Ruby book.

NFJS DSSS Day Two and Three

Days two and three were just as great as far as the content of the presentations and the level of the speakers. I really the enjoy the contact that we have with developers such as Ben Galbraith, Dave Thomas, David Geary and Jason Hunter — just to name a few, since everyone here are amazing technical minds.

Saturday morning I caught "Unit Testing Java with Jython" by Stuart Halloway and "Killer Web UIs" by David Geary. The Jython presentation was interesting for two reasons: we are not doing as much unit testing as we should be doing and it is python. I know that we need to increase our testing habits but I am not sure that our team could handle python, despite the recommendations other developers made. Killer Web UIs was a great presentation on Tiles and Sitemesh. Instead of comparing the frameworks to each other, Geary took an example and demonstrated how to accomplish the objective with each one by itself and at last with both combined. It was a truly learning experience and I will take a closer look at tiles after watching his presentation.

The evening sessions included what I probably think was the most attended presentation of the weekend. Ben Galbraith took on ~100 developers and live-coded an AJAX application. There were a couple of little bugs but nothing that could not be solved by the entire group. I attended the presentation because I wanted to hear what he had to say about the technology. The implementation is the easy thing at this point in time, there are other issues that need to be investigated before we decide to deploy AJAX applications everywhere.

On Sunday I attended "Lightweight Development Strategies" by Bruce Tate, "Introduction to WS-2005" by Ted Neward , "Extreme Web Caching" by Jason Hunter and "Introduction to TestNG" by Andrew Glover. The first couple were mostly discussions about the current state of technology and sort of looking into the magic ball. Jason’s presentation on caching was fantastic. He explained some of the caching strategies shared by Yahoo’s Mike Radwin and I have to say that most of them were trivial, easy to deploy and so simple that you ask yourself how come you never thought of that yourself!

Jay Zimmerman announced that NFJS DSSS will back to Phoenix in July of 2006 and I plan to be there. During the conference I was able to have some conversations with Ted Neward, Jason Hunter and Andrew Glover. It was great to hear what they had to say on technology and non-technology topics, after all they are human!

NFJS DSSS Day One

Just got back from the NFJS Dessert Southwest Software Symposium or NFJS DSSS from now. I attended David Geary’s Introduction to JSF and two presentations by Dave Thomas on Ruby and Ruby on Rails. I had seen a presentation on JSF from a sales-engineer in the past so I had some curiosity about this framework. It is certainly something exciting but I certainly have to give it some more research time and attention.

Both presentations by Dave Thomas on Ruby were great, his style and personality help as well to get the point across. A little interesting note is the fact that not only is Dave presenting Ruby at a Java conference, but the fact that the room is full is even more impressive. Some people left before the RoR presentation but I am sure they walked away interested enough to give Ruby a look in the future. His RoR presentation ran out of time but he made his point and it was loud and clear: RoR will have a place in the IT shop in the not so distant future.

He asked to get together with him to look over his testing approach or any other questions we might have. I took him up on it and we are going to take a look at his approach to test-driven development on Rails. I might also ask him about his thoughts on how to best take an already developed application and migrate it to RoR. I would be really interested in his thoughts in doing so.

Overall it was a good first day, I wish I could’ve attended the intro to AOP with AspectJ presentations but hopefully I can pick up that material from the presentations. Tomorrow (7/30) morning I am planing on checking out the unit testing with Jython from Stuart Halloway and Killer Web UIs from David Geary. The afternoon is still up on the air for now. More updates tomorrow!

NFJS Desert Southwest Software Symposium

Tomorrow starts the Desert Southwest Software Symposium organized by the No Fluff Just Stuff folks. I attended last year’s conference and walked away with a few ideas to improve our development environment.

This year I will be catching a couple presentations on Ruby as well as some about test-driven development. Instead of focusing on our platform, I would like to address our actual development methodology. I will post more details about the presentations that I actually end up attending.