GoingNative 8: Introducing Casablanca - A Modern C++ API for Connected Computing

Play GoingNative 8: Introducing Casablanca - A Modern C++ API for Connected Computing
Sign in to queue


Welcome to the 9th installment of GoingNative. Charles flies solo this time around as Diego is on a well-deserved break from work.

At GoingNative 2012, Herb Sutter addressed the need for more general purpose standard C++ libraries - high level libraries - for use in modern computing. So, things like HTTP, REST, JSON are important today (and working with these technologies is not as easy as it should be in C++), not to mention simplifying asynchronous programming for C++ developers. We live an asynchronous world and C++ libraries need to evolve to compensate for this fact (and catch up to .NET and Java in this regard both on the client and on the server...).  What's the story for C++ in the cloud?

A very small group of C++ developers inside Microsoft have started an incubation project to make native libraries that afford both developer productivity and performance and power - and for C++ developers. We love this! This is the Casablanca API and it takes full advantage of C++11.

This episode is dedicated to the Casablanca "dev lab" project with the hope that all of you will download and experiment with the API, vet it, push it, break it, provide feedback to speed up its maturation (it is alpha quality, of course (it's an incubation and this is the first release), so there will be a few bugs, but it's stable enough to be useful right now). Go get it!

What does Casablanca provide, exactly?

With Casablanca, you get support for doing things like developing REST services for Azure, or accessing them from clients via an HTTP library, sending JSON data, accessing Azure blob and queue storage, and using TCP for flexible networking needs, all in a library that takes advantage of modern C++.

Casablanca also gives you a convenient model for composing asynchronous operations. C++ 11 offers a whole new set of capabilities that can make dealing with asynchronous operations easy, and Casablanca takes advantage of that throughout.

Another aspect of Casablanca is its implementation of the actor programming model, which has proven itself useful in building reliable and scalable systems. (not familiar with the Actor Model, well, learn from the inventor of it here).

Table of Contents

[00:00] GoingNative(); //Charles flies solo for this episode (Diego is on vacation). Quick chat about what's coming (new STL series (the person, not the library)), introduction to Casablanca, a modern C++ API (incubation) for asynchronous client/server computing (so, modern C++ for the cloud and the client)
[01:49] Charles has a conversation with Casablanca engineering team members Niklas Gustafsson and Steve Gates.

[44:20] ~GoingNative(); //Charles talks about Casablanca - please download the libraries and experiment, provide feedback, help vet this new (experimental) API.



Download this episode

The Discussion

  • User profile image

    NICE ! The April GoingNative in the last minute.

  • User profile image

    Steve Gates was way too bland, go deep or go home Tongue Out

  • User profile image

    This is amazing, I have been toying around with a pet project that interacts with several REST/JSON  based API's and seriously feeling the lack of a good library for this type of work in native c++. This is the type of effort that I've been looking forward to and I can't wait to start playing with it.

    @Charles Good job on the solo mission man, this was a great ep!

  • User profile image

    STL will be back! Im sooooo happy. :)
    Now will watch the rest of the show...

  • User profile image

    This is great!

    Samples are very elegant. This brings C++ to a whole new level.

    Charles, on a similar (C++) note, always wanted to ask here, do you know Jeff Alger and where is he now? He is the author of favorite book of my "teenagehood" - "C++ for Real Programmers". He used to work on MS at that time.

    Thank you!

  • User profile image

    @Zura: Hi Zura,

    I have no idea where Jeff Alger is these days.

    In terms of samples and Casablanca SDK, I couldn't agree more. It's great to see a modern C++ API that doesn't involve too much ceremony to do to relatively simple things. This approach is clean and user-friendly. Bravo, Casablanca team! Way to go modern. Smiley


  • User profile image

    @NoSenseEtAl: Indeed. We're very excited to get STL back into our studio! Smiley


  • User profile image

    What platforms does this API support?

    Just Windows? Sad

    C++ needs cross-platform libs.

  • User profile image
    Niklas Gustafsson

    We discuss this in the DevLabs forum on Casablanca. The short answer is as an incubation project, it's Windows-only, but it's not our intent to keep it that way.



  • User profile image

    Super excited to see some ideas from Axum coming back to life. That was a sick project.

  • User profile image

    This is a really nice library, something that I would love to see in the standard. The client code I wrote was really simple and clean. You really start to see the goodness of C++11 when you use a library like this.

    One comment - is there a reason why the field/key operators in the json::value class only return by reference and not by const reference as well?

    Something like this:

    void kung_foo(json::value const& jobject)
        int id = static_cast<int>(jobject["id"].as_double());

    won't compile.

  • User profile image

    @Int64: Sounds like it's modeled similarly to std::map, where operator[] inserts an element if one is not there, and so cannot be const.  Does it have an at() function?  Or a find() function? I can't check it myself at this time.

    And speaking of that @Devs, is there any way for us to view the code online or off without having to run a setup program that only works on Windows?  Or at least a way to see the full interface even if we can't see the implementation?

  • User profile image

    I really appreciate the efforts with new libraries for C++. This is a huge step forward.
    I wish that Microsoft will consider moving the development to windows phone platform as well.

  • User profile image

    @benjaminLindley: Ah, that makes sense. Looking at the interface, it appears the solution is to return a const ref to the underlying field map and/or element vector and use their find/at functions:

    auto& fields = jobject.fields();
    auto iter = fields.find("id");
    if (iter != fields.end())
        id = static_cast<int>(iter->second.as_double());

    The field map is implemented as stdext::hash_map - wonder why no std::unordered_map?

  • User profile image
    Niklas Gustafsson

    benjaminLindley is absolutely right -- it's so we can use the operator on either side of an assignment operator. And yes, it is modeled after existing STL collections. No at() or find() yet -- I will add that to the list of things to augment with.

  • User profile image

    Wishlist: SOAP and HTTPS

  • User profile image

    @Petke: Thanks for the feedback. The team is aware of the need for HTTPS, for sure.

Add Your 2 Cents