Section 4.7. How Open Source Fits into the Mix

4.7. How Open Source Fits into the Mix

As you look for an AJAX library, you will notice that many of the most mature options are open source libraries. In fact, most of the first libraries were open source, and an ecosystem has grown up around them; this has made it much harder for high-priced commercial libraries to gain a following because they have to offer more than their free open source counterparts to get people's attention. Open source AJAX has also been driven by its match with open source scripting languages. These languages include Python, Ruby, and PHP. These languages often pick up new technologies faster than vendor-driven languages, such as ASP.Net or Java, because there is more competition at the tool level. This has allowed for quick integration of AJAX, although the implementation isn't always mature.

4.7.1. Evaluating an Open Source Library

When picking an open source AJAX library, keep in mind three main items: license compatibility, feature set, and maturity/community size.

License compatibility is simply a matter of picking a license that meets your needs; if your software will be released as open source, then the licenses need to work together. The simplest solution in this case is to pick a library with the same license as your currently chosen code or one that is very liberal, such as Berkeley Software Distribution (BSD) or Massachusetts Institute of Technology (MIT) software licenses. If you're using the library for internal development, licensing isn't generally an issue because most licenses apply to distribution, and you're the only user. If you're selling the software, you'll need to be more careful because you'll need to pick a license that has redistribution rules you can deal with. Open source licensing can be complex, but not necessarily more so than managing licensing from commercial vendors.

As with any library, picking one with an appropriate feature set is of vital importance. You may be quick to pick one that offers the biggest checklist, but it's generally a good idea to look at a couple options and pick one that fits your coding style and that can be easily combined with other libraries. As with any development, there is always a tradeoff between large monolithic libraries and smaller components. In addition, be sure to pay attention to how well the library integrates into any Web-development framework you might be using; an AJAX library designed with your framework in mind can, in many cases, provide a simpler development experience than a more general library.

The last item to look at when picking an open source library is the maturity of the project and the size of the community around it. The community offers support, testing, and documentation. The larger the community, the easier time you'll have getting started with the project. A large community also reduces risk because there are more people to share development in case the project's original developers abandon it. Because the barrier to entry in starting a new project is low, you'll want to pick a project in which the developers have proven they know how to support their users over more than one release. Libraries associated with larger projects, such as the PHP PEAR project (HTML_AJAX), or a framework like Ruby on Rails (Prototype), are also good picks because they have a large infrastructure and knowledge base from past larger projects.

4.7.2. Open Source Libraries in Relation to Commercial Libraries

Open source is popular in the AJAX world because it offers low cost, ease of customization, and widespread support in every possible language. Mainstream mature projects offer a quick route to AJAX deployment and a large community that is a great source for support. Smaller, more experimental projects can also offer great value if they meet your unique needs, but you need to be careful because many small projects will never generate a large enough community to gain support beyond their original developers.

Commercial languages developers, such as Microsoft, have also started developing AJAX libraries. These libraries have many of the same distribution advantages as open source libraries because they are not tied to per-server licenses. However, they don't offer the same customization possibilities that an open source library does. They also lack the ease of developer interaction that most open source projects have. This lack of ease occurs because there are fewer lines of communication with the developers of the actual library. The biggest advantage that libraries from major vendors have is the resources behind them. This leads to widespread testing and thorough documentation, even in early releases.

How I Decide Which Open Source AJAX Library to Use

The company I work for, Uversa Inc., is based around General Public License (GPL) software, so when I pick any library, it first needs to be compatible with the GPL. Because the GPL is so widespread, many licenses are compatible with it. (See for more information.) However, because licensing is a hard rule, you should always start your search by limiting it to the ones that meet your needs. After getting my license guidelines, I look at major features that are required. In my case, this includes good compatibility with PHP, including the ability to map data types between PHP and JavaScript. I also want to be able to easily combine the library with other JavaScript libraries, so well-name-spaced functions and variables are a plus. Finally, I want a focused design, so I'm looking just for an AJAX library; I don't need a large JavaScript framework that takes weeks to learn. Multiple developers will be using it, so the less they have to learn, the better.

During most of 2005, these requirementsand a bit of searchingwould have left me with a small list of libraries from which to choose. I could investigate them and find one that fit the rest of my Web development framework without too much hassle. Today, though, these requirements leave me with a large list, so I need to enter some other items to narrow the list of items I'll investigate thoroughly. I can further limit my list by picking projects that are actively being developed, so I'll look in depth only at those with releases in the past few months and that seem to be developed by more than one person. You don't want to remove every single-developer project (after all, that's where many of the most innovative ideas come from); you just want to make sure that enough releases have been made that the library is not a one-time code drop of unfocused ideas. These criteria will help weed out the unsuitable projects and will keep me from wasting time on a project that will never gain the community needed to sustain it over the long run.

Once I have a short list of libraries, I'll do a quick review. Everyone has different goals, but I like libraries with at least basic documentation and an object-oriented (OO) design. (OO design is especially important to me on the PHP side because it will need to mesh with my existing code.) A good way to test any library is to do a basic install and to build a basic "hello world" application with it. If you can't easily complete a basic task, then the library probably isn't a good fit. AJAX isn't such a complicated technology that the basics can't be made easy while still making the difficult items possible.

Hopefully, after some basic use, one of the libraries will stand out from the pack and end my search. If a few libraries seem really good, I'll dig further into their documentation and user forums and make a final decision based on how easy learning all the details will be. If none of the libraries looks like it will work, then I'm left back at the starting gate. I can expand my search and look for less popular and hence harder-to-find libraries, or I can look into developing my own solution.

In my earlier searches, I had very few options when I was selecting a library; my first foray into AJAX was before the term had been defined. I picked the JPSpan library for its good PHP integration and object-oriented design. Although JPSpan was a decent solution, it didn't end up meeting all my needs. Over time, I decided to develop my own library, HTML_AJAX, for PHP's PEAR project. The reasons for building my own library relate more with wanting to help the PEAR community than in meeting my needs, but once you have your own library, it's an easy front-runner for future use.

As you make a decision on what library to use, you can apply much of this process. First, decide on your licensing needs; your needs can be as simple as a specific open source license or as complicated as a commercial solution. After that, look at your feature requirements, especially server-side language support, and build a list of possible solutions. If the list is large, looking only at more active projects is a great way to pare down the list. Then, take some time to investigate the libraries. I find it's always worth my time to actually write a small amount of test code. After that, it's just a matter of picking a library that seems like a good fit. Don't forget to take into account everything into which you'll be integrating this library; some solutions that might be easy in a standalone situation become a bear when integrated into your server-side Web development framework.

Understanding AJAX(c) Using JavaScript to Create Rich Internet Applications
Understanding AJAX: Using JavaScript to Create Rich Internet Applications
ISBN: 0132216353
EAN: 2147483647
Year: N/A
Pages: 154

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: