Programming: May 2008 Archives

OK, let’s get our feet wet with some real XSLT. This entry may seem beyond rudimentary to some, but it’s good to start with the simple XSL elements before we tackle the larger issues, i.e. <xsl:apply-templates />. We’ll hit that one in a couple of entries, but for now here are the XSL elements we’ll be looking at:

  • XSLT doctype and <xsl:stylesheet />
  • <xsl:template />
  • <xsl:value-of /> and <xsl:copy-of />

It’s been two years since our office began our long, strange trip down content management highway. There have been many twists and turns along this road but quite possibly the biggest speed bump we’ve come across has been the application of a new coding language: XSLT. The idea of learning an entirely new language was daunting to be sure, and I’d heard from many seasoned programmers that mastering XSLT was not easy.

Update to Javascript Frameworks

| | Comments (0) | TrackBacks (0)

It seems that the Ext team has updated it’s licensing terms to a more restrictive license. Paul Duncan has an excellent review of what changed and what it means to developers who are considering using it.

What this means for us on campus is that if you are going to use the Ext framework, be sure that you read the license fully before you begin your project, and make sure that your project wont conflict with Ext’s new licensing.

If you remember back to my New Technologies on the Horizon post, I talked about how I thought mash-ups, or simply combing disparate sources of information to create a richer experience, is going to be very important in the coming years. I came across an article today about a new project coming out of the Yahoo! labs that is a very good example of how this new method will change the current landscape.

SearchMonkey

SearchMonkey, through the use of php snippets, can take an ordinary search result like this

sm1.png

and turn it into something like this

sm2.png

Imagine being able to have the main missouri.edu search feature able to display not only the results of your search but also other relevant information, like a picture, contact information, etc. right inside the search results listing, thereby greatly enhancing the end users’ experiece!

Opera releases Dragonfly

| | Comments (0) | TrackBacks (0)

opera.jpg Opera recently announced the release of their Dragonfly Web Developer application, that will be built directly into the Opera Browser.

From their website

Opera Dragonfly is Opera’s all-new set of developer tools, designed to give developers a lightweight-but-powerful application that provides effective mechanisms for web standards debugging and problem solving without slowing down the browser, and fits in nicely with the development workflow.

To evaluate it, you will need to download the 9.5 beta 2 version of the Opera browser. Once installed, launch the browser and go to Tools/Advanced/Developer Tools.

It appears that with Dragonfly, Opera is taking aim at Firebug. Although similar, Dragonfly is not yet as robust as Firebug, though it is easy to see that it has potential. This is a very early release, so it will be interesting to see what features Opera decides to add to this tool.

Of course, as a developer, ANY tool that helps us do our job in a faster, more efficient manner is appreciated.

Javascript Frameworks, part 2

| | Comments (0) | TrackBacks (0)

In my previous post, I explained what a Javascript Framework is and the criteria by which I used to determine which one I chose. In this post, I’ll talk about which framework I ended up going with, and how it did, and some cases, didnt, meet that criteria.

Before I begin, I need to point out one downside to using a framework that I didn’t mention previously. That is, the code you write for one framework, will most likely NOT work for a different framework. In other words, if/when you decide to switch frameworks, you’re going to end up having to either rewrite your code, or continue supporting the “old” framework even though you might not be using it anymore.

I played with Ext, prototype (mostly because of scriptaculous), dojo, and motools, and ended up choosing mootools. The one that I didn’t try out that I am still planning on evaluating is jQuery.

So why mootools?

1. Does it add code bloat to the user’s download?

One of the great thing about Mootools is you can customize the framework to only include the components that you need. This allows you to customize the mootools javascript file to be as small as possible. Even with every possible component added, the framework (compressed using the YUI compressor) is only 64KB in size. That isn’t to say that other frameworks are larger. For example, jQuery is only 29KB (compressed).

2. Will it work with all browsers?

MooTools is compatible and fully tested with Safari, Internet Explorer 6 and 7, Firefox (and its mozilla friends), Opera and Camino.

3. Does it have solid documentation?

This was one of the deciding factors for me. Mootools has excellent documentation. While it is not 100% complete (for example, there seems to be no documentation on the bind() function), the documentation is easy to navigate, at a glance you know what the function expects (arguments), what it should return and contains a sample of the function in use. In my opinion, it has the best documentation of any of the javascript frameworks (though Dojo comes in at a close second). In addition, Mootools has an incredibly thorough tutorial.

4. Does it support code reuse (is it extensible)?

Not only does it support code reuse, it is a primary focus of the Mootools framework. The whole framework is class-based and modular (which is why you dont need to download every available component). It has been designed to assist Javascript developers to more easily build reusable code. Because of this, there is a multitude of plugins/extensions available for Mootools.

5. Is it unobtrusive and will it support graceful degradation?

This was also one of the deciding factors for me. Mootools contains a custom event called domready that executes a function when the dom tree is loaded, without waiting for images. What does this mean to you as a developer? When combined with the various selector methods, It means that you can keep ALL of your javascript in the head (or in a separate javascript file) and not have to litter the html with javascript snippets, or worry about “element does not exist” error messages (because you tried to access the element before it loaded). It also means that you (or your web designers) can more easily design the page such that, if the user doesnt have javascript available, they wont see any difference.

For example, on the RJI site where we first used the MU Story Gallery rotator, the page is designed statically to display one story, headline, and teaser text. If you do not have javascript, or have it disabled, this is exactly what you will get. But if you have javascript enabled, on domready, the script will take over this section and create the rotating story gallery.

6. Does it have an active community?

In a word, yes. Announcements are regularly made regarding updates to the framework (v1.2 is close to being released) and answers to my questions in the forums are usually answered within the same day.

7. Does it play nice with others?

Yes, and no. Mootools (and Prototype ) both make heavy use of altering the prototype of native objects (String, Array, Function). Contrast this with JQuery and Dojo which are highly name spaced. What does this mean? This means that JQuery and Dojo will (usually) place nice in situations where you either don’t control the other javascript present on a page, or where you want/need to use more than one framework or javascript collection. Mootools, because of the way it alters the native objects, when used with other javascript libraries, can sometimes cause conflicts. So if you use another framework or library that alters the native Array object to include an .each() function, you’re going to have problems. Of course, this is no different than having a library that has a function named foobar() and then try to use another library on the same page that also has a function named foobar().

As I mentioned earlier, Mootools may or may not be the right framework for you. In fact, I plan on giving jQuery a try in a future project just to see if I might like it more. I strongly encourage you to download two or three different frameworks, and try them out. See which one “fits” you best. But no matter which one you end up going with, you will be AMAZED at how much more efficient your JavaScript development will be.