About This Session
The C++ static type system is beneficial in many ways; it can, however, also be a straitjacket. Is there a rationale for dynamic type layer on top of a statically typed language like C++? Given both historical (ANSI C union and void*, MS COM Variant, boost::[variant, any, lexical_cast]) and recent (boost::type_erasure, Facebook folly::dynamic) development trends, the answer is a resounding "yes".
This presentation is based on Poco::Dynamic::Var (aka Poco::DynamicAny) - a dynamic-typing set of C++ classes; furthermore, it will show the simplicity and practical advantages of mapping ad-hoc generated data sets of unknown type, size, and structure to C++ data structures.
Specifically, the presentation demonstrates how to:
(1) Execute a generic "SELECT * FROM Table";
(2) Dynamically map returned data (row/column count and types) to C++ data structures at runtime;
(3) Format the result as [XML, JSON, HTML, your-favorite-data-format-here];
(4) Stream the resulting formatted string to std::ostream compliant HTTP socket stream.
Surely, this must be very complicated to do in C++, right? Not at all - we'll demonstrate all of the above done with a single line of code and then peek under the hood to see where/how does the magic happen. Portable? Of course. Scalable? You bet - it's C++! The content of this presentation fits perfectly into modern AJAXian trends and we'll prove it with an ExtJS example; it prompts re-thinking of the rationale for (a) employing dynamic languages on the server side or (b) polluting HTML with server-side code.
Time: 3:30 PM Saturday Room: 4218
The Speaker(s)
unassigned , unassigned
unassigned