Saturday, May 20, 2006

Wt AJAX C++ Toolkit

The Web Toolkit a.k.a. Wt (pronounced "witty") allows C++ programs to achieve write-once run-anywhere status through the functionality introduced by highly interactive AJAX web apps. Although, web applications has traditionally been the domain of interpreted and semi-interpreted languages, C++ access to this field is very limited. I state here the reasons why C++ still matters as a web application programming language.

Critics of native code point out that C/C++ programs allow programmers to shoot themselves on the foot. Although, this is still true today, the methodology that permits such actions is old-school C/C++ programming. Modern C++ design methods such as the ones offered by libraries like STL, Boost, and Qt, already address critical faults such as strings and pointer-memory management while at the same time retaining the performance aspects of running native code. For example, Wt in closely following Qt's object-tree model, allows objects to be allocated from the heap without the programmer worrying about deleting it later.

In addition, the availability of thousands of high-performance native libraries means that Wt is able to leverage those existing libraries directly without resorting to wrappers or RPC code. Though quite far-fetched at this point, it is quite possible to use Wt in writing a simulation program with a networked front-end GUI utilizing the best cross-platform solution: the plain web browser.

Lastly, I would like to point out my latest experience in working with a Java5-based web toolkit. Java is an excellent platform offering garbage collection and automatic memory management. But I was still plagued by memory leaks, crashing my whole web-app after four days of running straight. Someone pointed out that this was caused by registering a static class to an event listener or something like that. I did not find any on my code though. The leaks could be caused by a design error on my part. But my point is that if I were to spend my precious hours hunting for leaks in a tracing tool, I might as well do that in C++ (minus the verboseness and the performance snags)! So much for the vaunted claim about Java programmers never having to worry about memory management again.

You can now read more about, sample, and download Wt.