WPushButton *button = new WPushButton("Click me"); button->clicked.connect(SLOT(button, WPushButton::disable));
Wt and JWt 3
Finally, we bit the bullet and released Wt and JWt 3.
We wanted to have the JWt Reference Documentation clean and clutter-free before having the first solid release of the Java version of our web library.
We moved to a new major version number mainly because we needed to break the API for signals and slots. Some ideas for performance improvements required such a fundamental API change. We took the opportunity to also break the API in some other places, such as for a reworked WResource API.
But other than huge performance improvements and code clean-ups, also many other improvements happened over the last 9 months, and even more exciting features are sitting in unstable branches.
Biggest changes in Wt 3
Let’s step back and review the biggest changes since we started evelopment of the Wt 3 branch (starting at Wt 2.99.0):
Signals are now accessed through an accessor method, rather than being exposed with a public member.
Previously, you would write:
Since 2.99.0, this should be:
WPushButton *button = new WPushButton("Click me"); button->clicked().connect(SLOT(button, WPushButton::disable));
The benefit is that signal objects are created only on-demand. Because most signals are not used, this resulted in both runtime and memory improvements.
Rather than using an untyped int for passing a set of enum flags, which is used throughout the API, we are now using a WFlags<E> class (in C++) and an EnumSet<E> (in Java). This allows type-safe combination of different enums, improving compile-time checks. WFlags should not have any runtime overhead. This probably does not require changes to your existing code, though.
The WResource API (C++/Java) has been redesigned and greatly simplified. The new API is simpler (requires only one virtual method to be implemented) and more powerful, providing support for continuations to serve large resources without blocking a thread or requiring large memory usage (currently in C++ only, as this is only supported in the next version of the Java Servlet API).
Resources now have better thread-safety in C++: they are now by default reentrant (requests for a single resource may be handled concurrently) and they are protected from concurrently being destroyed by the main event loop.
In addition, the mechanism for indicating that a resource has been changed and thus needs to be updated in its views, has been improved and sanitized.
The WTreeView (C++/Java) MVC view class has been updated to use a WAbstractItemDelegate (C++/Java) to perform the actual rendering of cells. This allows the view to be customized for specialized rendering of table cells.
In the future, we will extend the default view delegate, WItemDelegate (C++/Java) to support inline editing, but, you can already implement your custom inline editing delegate.
We added a WTestEnvironment (C++/Java), which allows you to write integration and unit tests that involve Wt widgets and objects.
Wt has has always supported both AJAX clients and plain HTML clients. To differentiate between the two, a small bootstrap page was used that sensed for AJAX availability, and which loaded the first page contents either using JavaScript, or by redirecting to a new page.
Some discussions on the mailing list indicated that this could be done better, suggesting a hybrid bootstrap model: the first page could contain already the entire page as plain HTML, and in the back-ground AJAX presence could be detected to upgrade this to a full AJAX interface. This would have several benefits, including a faster initial response (one round trip instead of two) and better support for JavaScript libraries that need to load in the initial request, such as Google Ads.
We finally got around implementing this. When enabled, first a plain HTML session is assumed, and widgets may later be asked to upgrade themselves to their AJAX version (C++/Java). This is the principle of progressive enhancement, right there, entirely automatically embedded in your application !
Future ?
What to expect in the near future? In order to stabilize and polish Wt and JWt 3, we have confined a lot of new developments in private branches. Several of them are looking promising, and will hopefully find their way to Wt 3 in the near future:
We are finalizing an Object-Relational-Mapping (ORM) layer, which might be useful in many web applications. This blog is actually our pilot project to find out how usable the current implementation is (and, it seems, no web framework is considered complete without a blog as example). We can already tell you that it does not use code generation, XML or ugly macro hacks, but instead you can declare the mapping entirely in plain compact C++. More on it later!
Many users have complained that the default look of Wt’s widgets is boring, and we must confess, we have always given priority to functionality rather than looks. We intend to change this with the advent of theme support. All CSS that is currently provided within the inline stylesheet by each widget class, will be pushed out to external style sheets, and a small API has been added to select a particular theme.
It finally occurred to us that many things could be simplified if we admitted to support for XHTML templates. Unlike traditional frameworks, Wt templates will be used to describe the XHTML for a single widget. Within each template, widgets may be instantiated, and strings resolved. This simplifies those situations where you would like to express the layout using XHTML/CSS, rather than using a nested hierarchy of WContainerWidgets.
This blog implementation uses this templating system to display posts, comments, and the authoring dashboard.
would it possible for you to provide a compiled package for windows/mac installation. So that beginners can start trying out Wt using say Visual C++ without having to get all the Wt dependencies from different places and compile?
PostgreSQL..
MySQL..
SQLite..
ODBC..
I was recently pointed out that soci was going to be adopted into boost (is that sure now?). When soci makes it in boost, it would perhaps be worthwile to switch to soci for backend support.
That being said, the whole SQLite backend implementation is 264 lines, so it isn't such a head-ache to support other libraries (Postgres and MySQL or obvious candidates, ODBC is more of an archaism these days or not ?).
This is the most mature API out there for C++ and works on every major Database out there.
All versions of Oracle (natively via OCI), DB2 (natively via DB2 CLI), SQLServer (natively via SNAC), Informix (natively via CLI), TimesTen, ODBC 3.0 and ODBC 2.5 compliant databases via MS ODBC dirvers or unixODBC for Unix being Sybase, MySQL, PostgreSQL, EnterpriseDB, SQLite, MS ACCESS, Firebird
WELL WORTH LOOKING INTO RATHER THEN REINVENTING YET ANOTHER WHEEL :)
I just had a look at soci ! Very nice API as well I must admit. No where near as mature as OTL just yet.
However, handling sqlite through ODBC is a bit of a pity: sqlite is the most easy database to interact with (and I like it therefore very much for this reason alone), while I have never succeeded in getting ODBC to work. Since I wanted to get going quickly (to validate all of the great ideas in Wt::Dbo), I went with the quickest solution.
I am surely prepared to revisit this, but probably would prefer to move to soci if they are getting successfully absorbed by boost. I am unsure why I prefer soci, but depending a 35000 lines header file somehow doesn't feel right, and boost adoption gives me a false sense of confidence that it must be any good (given that there are quite a few boost libraries that are actually really bad). I any case, we will first focus on making Wt::Dbo add alot of value on top of these low-level SQL backend libraries, before reconsidering the backend problem.
http://pocoproject.org/blog/?p=24
pocoproject.org/wiki/index.php/DataUserManual
http://pocoproject.org/docs/Poco.Data.html
It's much alike SOCI as it borrowed SOCI concept. It has released under Boost License and also has commercial support. It's API is very mature.
Did this now, except for the hiding of the link since it crosses my widget boundary (to show it again when a comment was posted).
Am I the only one that wants to edit multiple replies simultaneously? :-)
Future also looks very promising!