I’m excited today to announce a new DevLabs project: Microsoft Codename “Casablanca”.  You can learn more about the project and download the bits from the DevLabs site.

I’ve previously discussed some of the major trends that have influenced the direction we’ve taken for developer tools, with a key example being applications that connect devices to continuous services running in the cloud.  In order to develop such applications efficiently, developers need productive, high-level programming models and APIs for connecting to and interacting with services.  Similarly, in order to build those services in a scalable manner, developers need productive models that compose well and that are fundamentally asynchronous.

Take .NET as an example.  C#, Visual Basic, and F# developers all have a robust and scalable networking stack, which has been made all the more productive with .NET 4.5 advances such as HttpClient, language support for asynchrony, and an ASP.NET Web API framework for easily building HTTP services.  Or take Node.js, which, with the Windows Azure SDK, enables you to easily build fast and scalable network applications for the cloud using JavaScript.

Historically, we’ve lacked such simple tools for developers using C++.  While there are multiple relevant native networking APIs (e.g. WinINet, WinHTTP, IXMLHttpRequest2, HTTP Server API), these are not optimized from a productivity perspective for consuming and implementing RESTful cloud services using modern C++.  They don’t compose particularly well with code based on the standard C++ libraries, and they don’t take advantage of modern C++ language features and practices in their programming models.

This is where “Casablanca” comes in.  “Casablanca” is a set of libraries for C++ developers, taking advantage of some recent standard language features already available through Visual Studio.

“Casablanca” aims to make it significantly easier for C++ coders to consume and implement RESTful services.  It builds on lessons from .NET, from Node.js, from Erlang, and from other influencers to create a modern model that is meant to be easy to program while still being scalable, composable, and flexible.

As an example, here’s a snippet that uses the client HTTP library to search Bing for my name and output the results to the console:

http_client bing(L"http://www.bing.com/search");
bing.request(methods::GET, L"?q=S.Somasegar").then([](http_response response) {
    cout << "HTML SOURCE:" << endl << response.to_string() << endl;

and here’s a simple web listener hosted in a console application:

using namespace http;

int __cdecl wmain(int argc, wchar_t * argv[]) {
    listener::create(argv[1], [](http_request req) {
        req.reply(status_codes::OK, "Namaste!");
    }).listen([](){ fgetc(stdin); }).wait();

For those of you looking to build Azure services in C++, “Casablanca” comes with a Visual Studio wizard to set up everything up correctly.  You can target both Web and Worker roles, and you can access Azure storage using the built-in C++ library bindings.

Last week, I blogged about some of our efforts to “meet developers where they are.”  Our work around C++ has long been a significant component of that, with so much software in the world developed in the language and with its heavy cross-platform adoption.  Taking C++ to the cloud with “Casablanca” is another exciting step in that journey.

As with other DevLabs releases, this release of “Casablanca” is meant for you to experiment with and to provide feedback on.  We would love to know whether you’re interested in using C++ to consume and implement cloud services, and if so, what kind of support you want in order to do so, whether “Casablanca” is on the right track, and how you’d like to see it evolve.  We look forward to hearing from you in the forums.