Thursday, January 31, 2008

Old Code Part 2: XML / XSLT Before it was Cool

For this issue of Old Code I'll be going way back. Before .NET, before Visual Studio, before broadband. I wrote this app before many of you were even working. This was probably my favorite project of all time, still stands up to that today. Since this was so long ago I can give more details than in the last issue so here we go.

Background: The year was 2000 and companies small and large were realizing they had to get online. Some because they had a business need to do so, others because "everyone else was'. This was a case of an actual business need.

I worked for a smallish web design / development company called DigitalDay, they had just changed their name from Mozes Cleveland and Company. We had some good sized clients like Sherwin Williams and Ernest & Young but our biggest (duh) was GE. We did a lot of work for GE Plastics and their Silicones division, incredibly huge multi-national companies. Anyway, one day I had just returned from TechEd 2000 in Orlando and was pulled into a conference call with a branch of GE Silicones in Europe. It was actually a joint venture between GE and Bayer (yes, the aspirin people). They had a problem.

Problem: When these two separate companies were merging their ERP systems it was concluded that they systems were incompatible so they switched both companies to SAP R/3. The E-Commerce team had been given a nearly impossible deadline of getting a system online using the new SAP system within just a few months. They did accomplish this goal (don't worry, we'll get to my role soon) as this was right after SAP had released the MySAP module which contained its own proprietary web server and exposed SAP modules online. Done, first goal accomplished. But there were issues.

Issues: While they met the milestone, no one was satisfied with the results. The web application wasn't branded GE Bayer Silicones but instead was branded MySAP including colors, logos and everything. Also, this was long before most manufacturing companies in Europe had broadband Internet and for them this application was incredibly slow. Customers complained. Then came the call.

So on this call they got us into the application to take a look around and wanted our opinion on if we could do anything to speed it up. It didn't take long before I had identified that the biggest issue affecting speed was the .js files being downloaded. They totaled around 300k. Even today in the AJAX and JSON world 300k .js files are a little excessive but in 2000 that was out of control. So the call ended and I went back to work only to be asked minutes later if I had a passport. Two weeks later I'm on a plane to Amsterdam to spend 10 days looking at the issue in Bergen Op Zoom Holland.

Once there I dug into the MySAP solution to see what I could do to fix it. So after three trips to Holland totaling over three months I had built them a solution that I am still proud of today.

Solution: The big requirement was to display a screen to the user with information on 300+ purchase orders in the quickest time possible. I crafted a solution where the page would have an embedded XML Data Island (linking XML was less reliable in those days) and linked XSL file, CSS file and JS file. The XSL/CSS/JS combination gave the ability to create HTML on the fly for two different layouts and allow sorting and filtering as well. All in client side code.

MySAP had already constrained them to using IE only, so I also had them use 5.0 or higher which gave me access to browser XML support and also having to only code the JavaScript once. I worked with ABAP programmers from Deloitte to get the information to me that I needed. I then had to learn SAP's server side language BHTML, which was simplistic but different, to craft the XML to send with the page. Due to the size constraints I went against "proper" XML design and used single character element names and no whitespace at all as every byte meant a lot when it would be repeated hundreds of times ((once in opening tag + once in closing tag) * number of results). Oh yea, and I built this entire app in Notepad. Not kidding. No IDE, not even Notepad Plus.

Conclusion: While using XML with client code in a browser may be common-place today, it was totally new at the time. XSL Transforms done in the client browser still isn't common, I did it in 2000. Basically between three months in Europe, totally cool technology and one of the best project managers I've ever worked under, this was my favorite project ever.

Lessons Learned:

  • Two-Day shipping from Amazon to The Netherlands cost more than the book itself
  • Never spend an anniversary in Amsterdam unless you can do it every year (I did, I haven't, I hear about it frequently)
  • Never take wife to Europe unless you can move there (I did, I haven't, I hear about it frequently)

No comments: