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.


John Drummond said...

This is a very remarkable toolkit. I am looking forward to playing with it. I wonder, would it be faster for web apps that have a lot of numerical calculations? ( I am thinking about financial projections).

Adnan said...

is it available for Windows?

Anonymous said...

Can I use C (not C++) to programming with Wt?

xynopsis said...


You cannot currently use C to program Wt. It relies too much on object-oriented concepts that would take quite a lot of effort if re-implemented on C. Another reason is that its event-mechanism relies on the C++-specific feature called "templates." Writing a C wrapper, although possible, would not be trivial.

Anonymous said...

Do you plan to write GUI Builder with aumotatical code generation like Glade 2?
How many people develop Wt?

ULZ said...

Is this toolkit will supports on MAC OS X 10.4? I am developing the app in C++ which communicates with swf file embedded in web page. Till now I am able to communicate with flash & JavaScript but how can I get it communicate with C++ i.e. transfer data in vice versa fashion.
please guide me towards it.