And Now for Something Completely Different

Different – as in random and extremely technical statistics about Nouncer.

After a year of development, of which the last 2 were full time, Nouncer has 74,182 lines of source code of which 74% are actual code (of which 4% also have comments with code), 5% are comments (only), and 21% are blank lines (I like to give my code space). Nouncer is written in C++ using a few open source libraries such as Poco and Boost (which are excluded from the line count). If you work in C++ and didn’t hear about Poco, you are missing out on one of the most outstanding and important C++ libraries in years.

Nouncer types (currently 81) are mostly code generated from XML files and a 3,000 lines XSLT script. The code generation covers network, database, presentation, and memory management support. If you are a C++ geek like me, you’ll think it’s pretty cool. Example for types are message, user, channel, subscription, service, system configuration, etc. Some types match directly into database tables (32 tables using MySQL), while others are used internally, or part of the API XML schema. The presentation support is my favorite. It allows converting any object to XML, JSON, XHTML, RSS, ATOM, and even PNG (a nice picture with text in it). The PNG support is mostly used for incorporating Captcha into API calls that require human interaction.

The Nouncer API is served via an HTTP/S server and a Jabber/XMPP server, both written from scratch. In the back they use an elastic object cache based on real-time usage pattern (similar concept to memcached). One day (hopefully soon) I’ll find time to write more about the architecture for both the API-facing and internal delivery sub-systems. But for now I want to share with you C++ geeks (everyone else stopped reading by now) what the API definition interface looks like. This is actual code taken from the latest version used to define an OpenID session initiation request. It defines the REST API path, the parameters, their format, and the function to handle requests.

path("/session/openid/initiate", Enum::HttpRequestMethod_GET)
    .handler(_sessionApi, &Session::onOpenIdInitiateGet)
    .formats(Enum::PresentationFormat_xml |
                  Enum::PresentationFormat_json |
                  Enum::PresentationFormat_html |
        .type(Enum::ParameterType_string | Enum::ParameterType_required)
        .type(Enum::ParameterType_string | Enum::ParameterType_required)

BTW, if you understood all of this, found it interesting, love the idea of micro-blogging, and might be looking for a job, drop me a line. We might be hiring soon!

3 thoughts on “And Now for Something Completely Different

  1. POCO makes C++ a real alternative to the current web development platforms. Building Nouncer requires a very fast and flexible environment and POCO makes C++ possible for small startups to use without having to hire an army of C++ developers just to catchup with the facilities in place in other platforms.

  2. hey poco sounds interesting and i really like the fact that you decided to write your application in c++ considering all the hype you hear about java and ruby these days..
    great article it provoked me to think about c++…

Comments are closed.