Feeds:
Posts
Comments

Archive for the ‘Microsoft’ Category

imageAt GoingNative in February, I emphasized the need for more modern and portable C++ libraries, including for things like RESTful web/cloud services, HTTP, JSON, and more. The goal is to find or develop modern C++ libraries that leverage C++11 features, and then submit the best for standardization.

Microsoft wants to do its part, and here’s a step in that direction.

Today I’m pleased to see Soma’s post about “C++, Cloud Services, and You” announcing the DevLabs release of Casablanca, a set of C++ libraries for Visual C++ users that start to bring the same modern conveniences already enjoyed by .NET and Node.js and Erlang users also to C++ developers on our local and cloud platforms, including modern C++ libraries for REST, HTTP, and JSON. From Soma’s announcement, adding my own emphasis and minor code edits:

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; })
        .wait();

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

    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. […] Taking C++ to the cloud with “Casablanca” is another exciting step in that journey.

Today’s Casablanca release is as a DevLabs project, to get usability feedback and to eventually support these features in the full Visual C++ product. If you’re interested in using C++ to consume and implement cloud services, and sharing what kind of support you want and whether you think Casablanca is on the right track, please let us know in the forums.

Looking beyond Visual C++, one piece of Casablanca is already being proposed for standardization, namely the “future.then” nonblocking continuations that are required to be able to write highly responsive composable libraries – you really want all async libraries to talk about their work using the same type, and std::future already gives half of what we need (blocking synchronization) and just needs the non-blocking part too. Also being proposed as an optional layer on top of “future.then” is an “await” style of language support to make the async operations as easy to express and use in C++ as in any of the best languages in the world.

Note that there are other C++ libraries too for several of these facilities. Repeating what I said at GoingNative, we (Microsoft) don’t care whose libraries get standardized – whether ones we contribute or someone else’s. We care most that there be standard C++ libraries for these modern uses, starting with the most basic “future.then” support, and to encourage all companies and groups who have libraries in these important spaces to contribute them and take the best and make them available to C++ developers on all platforms. This is a small step in that process.

Read Full Post »

In answering a reader question about Flash today, I linked to Adobe’s November press release and I commented:

Granted, Adobe says it’s abandoning Flash ‘only for new mobile device browsers while still supporting it for PC browsers.’ This is still a painful statement because [in part] … the distinction between mobile devices and PCs is quickly disappearing as of this year as PCs are becoming fully mobilized.

But what’s a “mobile device” vs. a “PC” as of 2012? Here’s a current data point, at least for me.

For almost two weeks now, my current primary machine has been a Slate 7 running Windows 8 Consumer Preview, and I’m extremely pleased with it. It’s a full Windows notebook (sans keyboard), and a full modern tablet. How do I slot it between “mobile device” and “PC,” exactly? Oh, and the desktop browser still supports Flash, but the tablet style browser doesn’t…

Since I’ve been using it (and am using it to write this post), let me write a mini-review.

I loved my iPad, and still do, and so I was surprised how quickly I came to love this snappy device even more. Here are a few thoughts, in rough order from least to most important:

  • It has a few nice touches that I miss on iOS, like task switching by simple swipe-from-left (much easier than double-clicking the home button and swiping, and my iPhone home button is started to get unreliable with all the double-clicking [ETA: and I never got used to four-finger swiping probably in part because it isn't useful on the iPhone]), having a second app open as a sidebar (which greatly relieves the aforementioned back-and-forth task-switching I find myself doing on iOS to refer to two apps), and some little things like including left- and right-cursor keys on the on-screen keyboard (compared to iOS’s touch-and-hold to position the cursor by finger using the magnification loupe). In general, the on-screen keyboard is not only unspeakably better than Win7’s attempt, but even slightly nicer than iPad’s as I find myself not having to switch keyboards as much to get at common punctuation symbols.
  • I was happily surprised to find that some of my key web-related apps like Live Writer came already installed.
  • The App Store, which isn’t even live yet, already had many of my major apps including Kindle, USA Today, and Cut the Rope. Most seem very reliable; a few marked “App Preview” are definitely beta quality at the moment though. The Kindle app is solid and has everything I expected, except for one complaint: It should really go to a two-column layout in landscape mode like it does on iPad, especially given the wider screen. Still, the non-“preview” apps do work, and the experience and content is surprisingly nice for a not-officially-open App Store.
  • Real pen+ink support. This is a Big Deal, as I said two years ago. Yes, I’ve tried several iPad pens and apps for sort-of-writing notes, and no, iOS has nothing comparable here; the best I can say for the very best of them is that they’re like using crayons. Be sure to try real “ink” before claiming otherwise – if you haven’t, you don’t know what you’re missing. iPad does have other good non-pen annotation apps, and I’ve enjoyed using iAnnotate PDF extensively to read and annotate almost half of Andrei’s D book. But for reading articles and papers I just really, really miss pen+ink.
  • All my software just works, from compilers and editors to desktop apps for full Office and other work.
  • Therefore, finally, I get my desktop environment and my modern tablet environment without carrying two devices. My entire environment, from apps to files, is always there without syncing between notebook and tablet devices, and I can finally eliminate a device. I expected I would do that this year, but I’m pleasantly surprised to be able to do it for real already this early in the year with a beta OS and beta app store.

I didn’t expect to switch over to it this quickly, but within a few days of getting it I just easily switched to reading my current book-in-progress on this device while traveling (thanks to the Kindle app), reading and pen-annotating a couple of research papers on lock-free coding techniques (it’s by far my favorite OneNote device ever thanks to having both great touch and great pen+ink and light weight so I can just write), and using it both as a notebook and as a tablet without having to switch devices (just docking when I’m at my desk and using the usual large monitors and my favorite keyboard+mouse, or holding it and using touch+pen only). It already feels like a dream and very familiar both ways. I’m pretty sure I’ll never go back to a traditional clamshell notebook, ever.

Interestingly, as a side benefit, even the desktop apps are often very, and more, usable when in pure tablet+touch mode than before despite the apparently-small targets. Those small targets do sometimes matter, and I occasionally reach for my pen when using those on my lap. But I’ve found in practice they often don’t matter at all when you swipe to scroll a large region – I was surprised to find myself happily using Outlook in touch-only mode. In particular, it’s my favorite OneNote device ever.

By the end of this week when I install a couple of more apps, including the rest of my test C++ compilers, it will have fully replaced my previous notebook and my previous tablet, with roughly equal price and power as the former alone (4GB RAM, 128GB SSD + Micro SD slot, Intel Core i5-2467M) and roughly equal weight and touch friendliness as the latter alone (1.98lb vs. 1.44lb). Dear Windows team, my back thanks you.

So, then, returning to the point – in our very near future, how much sense does it really make to distinguish between browsers for “mobile devices” and “PCs,” anyway? Convergence is already upon us and is only accelerating.

Read Full Post »

David Braun asked:

@Tom @Herb: What’s so wrong with flash that it should be boycotted? Have I been being abused by it in some way I’m not aware of? Also,does HTML5 have any bearing on the subject?

I’m not saying it should be boycotted, only that I avoid it. Here’s what I wrote two years ago: “Flash In the Pan”.  Besides security issues and crashing a lot, Flash is a headache for servicing and seems to be architecturally unsuited for lower-power environments.

Since then, two more major developments:

1. Even Adobe has given ground (if not given up).

Adobe subsequently abandoned Flash for mobile browsers and started shipping straight-to-HTML5 tools.

Granted, Adobe says it’s abandoning Flash ‘only for new mobile device browsers while still supporting it for PC browsers.’ This is still a painful statement because:

  • it’s obvious that ceding such high-profile and hard-fought ground sends a message about overall direction; and
  • the distinction between mobile devices and PCs is quickly disappearing as of this year as PCs are becoming fully mobilized (more on this in my next blog post).

2. We’re moving toward plugin-avoiding browsing.

Browsers are increasingly moving to reduce plugins, or eliminate them outright, for security/reliability/servicing reasons. Moving in that direction crease pressure or necessity to either:

I’m not saying Flash will die off immediately or necessarily even die off entirely at all; there’s a lot of inertia, it’s still useful in many kinds of devices, and it may well hang on for some time. But its architectural problems and current trajectory are fairly clear, and it’s been months since I’ve heard someone complain that certain people were just being unfair – Jobs’ technical points are on the right side of history.

Read Full Post »

A nice talk by Mads Torgersen just went live on Channel 9 about C#’s non-blocking Task<T>.ContinueWith() library feature and await language feature, which are a big hit in C# (and Visual Basic) for writing highly concurrent code that looks pretty much just like sequential code. Mads is one of the designers of await.

If you’re a C++ programmer, you may be interested in this because I’ve worked to have these very features be offered as proposals for ISO C++, just with a few naming tweaks like renaming Task<T>.ContinueWith() to std::future<T>::then(). They were initially presented at the recent Kona meeting in February, and we’ll dig deeper next month at the special ISO C++ study group meeting on concurrency and parallelism.

Here’s the talk link and abstract:

Language Support for Asynchronous Programming

Mads Torgersen

Asynchronous programming is what the doctor usually orders for unresponsive client apps and for services with thread-scaling issues. This usually means a bleak departure from the imperative programming constructs we know and love into a spaghetti hell of callbacks and signups. C# and VB are putting an end to that, reinstating all your tried-and-true control structures on top of a future-based model of asynchrony.

While we were chatting after the talk, I managed to gently twist Mads’ arm and he has graciously agreed to come to the May 7-9 ISO C++ parallelism study group special meeting to present this to the committee members in detail and answer questions about await’s design and C# users’ experience with it in production code, which will help the committee decide whether or not this is something they want to pursue for ISO C++.

I hope you enjoy the talk. While at Lang.NEXT, I also participated in a panel and gave a C++ talk but those sessions aren’t live yet; I’ll post links once they are.

Trivia: If you noticed the Romanian accent in the first question from the audience, it’s because it came from Andrei Alexandrescu, who was sitting beside Walter Bright, both of whom were two of the other speakers at the conference. It was fun to be in a room full of language designers and implementers sharing notes about each other’s languages and experience.

Read Full Post »

Earlier this month, I announced in my GoingNative talk C++11, VC++11 and Beyond that Visual C++ 11 Beta would be available in February.

Today’s the day: You can download Visual Studio 11 Beta here.

Interestingly, VC++11 is being distributed under a go-live license, which means that Microsoft supports using this compiler to write production code. That’s unusual for a first beta, and it means you can start using its features – notably parallelism and C++11 library and language conformance improvements like range-based for loops – in your production code right away.

We had already announced that VC++11 includes quite a bit of stuff, and here’s what’s new in the beta. Some highlights of the whole product:

  • Complete ISO C++11 standard library. As announced in September, we’ve added full support for essentially the entire C++11 standard library, which I think is a first for the industry to ship in-the-box with a C++ compiler product. We already shipped most of the C++11 stdlib in VC++ 2010, and now we’re including threads, mutexes, condition variables, atomics, futures, and async – and not just as checkmark features, but with async and futures built on top of our ConcRT runtime that also powers the Parallel Patterns Library. Oh, and we’re also shipping an implementation of the draft-standard header <filesystem> based on Boost.filesystem for portable access to directories and files. (The ISO C++ committee has just resumed work on filesystem for near-term standardization; more about this soon in my ISO C++ trip report, which I plan to post within a few days.)
  • Several more ISO C++11 language features. As mentioned in September, we’ve added support for C++11 stateless lambdas and scoped enumerations. On top of that, we were happy to announce this month that we’re also adding the range-based for loop, override, and final – all of which are available in today’s release, and supported for production code.
  • Parallelism galore. As we announced in June, it includes C++ AMP for parallel programming on CPUs and GPUs (with a view to more in the future, including cloud). This month we were also able to add that if the end user’s machine doesn’t have a compute-class GPU and is running Windows 8, we also provide an automatic fallback to multicore + vector SSE instructions, which for now is a fallback but we will continue to improve, so it’s already not just about GPUs. We’ve also expanded the Parallel Patterns Library (PPL) to support Standard C++11 concurrency features, provide more STL-style concurrent containers (e.g., concurrent_unordered_map), more parallel STL-style algorithms (e.g., parallel_sort), and a block-free continuation library for async operations (think “future.then()”, but for now we named it “task.then()” in case ISO C++ wants to surface something like this differently). Almost lost in all the news was another cool nugget: We’re also shipping an automatic vectorizing and parallelizing compiler that takes loops (with optional hints) and automatically generates both multi-core parallel and SSE-style vector code for you.
  • imageWindows 8 support, including Metro-style tablet apps on x86 and ARM. A major engineering change like Windows 8 comes along about once a decade, so with C++/CX and WRL we did a huge amount of work to ensure that VC++ gets great compiler and tool support for writing Windows 8 apps, while writing the minimum quantity of non-ISO standard code on the boundaries with the Windows environment (usually just ^ and ref new, similar to C++/CLI; the vast majority of your code should remain portable C++). And we wanted to make sure that VC++ is a first-class language that is visibly clean, safe, and fast – just as clean and safe in side-by-side code examples with Javascript and .NET CLR (e.g., you can write a XAML UI equally easily on top of any of these language projections), and with C++’s traditional power and performance (e.g., VC++ also supports creating tablet DirectX games and other graphics-intensive apps). Oh, and we brought up a whole new processor architecture: ARM.

As I also mentioned in this month’s talk, once VC++11 ships, we’re switching to a faster out-of-band release cadence so that we can deliver features more quickly than waiting for Visual Studio release schedules – especially to continue to roll out C++11 language features in batches, on a path to full conformance as soon as possible. The first thing you’ll see is a Community Tech Preview (CTP) that we intend to ship soon after VC++11 ships, which we expect to take the form of a new command-line compiler (initially not IDE integration and Intellisense) that you an drop into VC++11 to quickly start taking advantage of still more of the new C++11 language features, with a full out-of-band release to follow after that with still more.

If you haven’t already, please take this quick C++11 feature survey where you can vote on what C++11 features are most urgent for you in VC++. We’re going to implement all C++11 features, but we have to do them in some order – we’re users too and talk to customers regularly, so we think we know what’s most urgent, but we want to sanity-check that with you and make sure we’re doing them in the right order to deliver the most benefit to the most people as soon as possible.

Enjoy!

Read Full Post »

//build/

My two talks from last week’s //build/ conference are online.

My personal favorite is Writing Modern C++ Code: How C++ Has Evolved Over the Years. The thesis is simple: Modern ISO Standard C++ code is clean, safe, and fast. C++ has got a bad rap over the years, partly earned, but that’s history. This talk is a “welcome to modern C++” for programmers who may never have seen C++ before, or are familiar only with older and more difficult C++.

If you’re already a modern C++ developer you may be thinking, “but I do most of those things already, why is there a whole talk on this at a Microsoft conference?” Because as interest and use of Standard C++ is heating up again, it’s important to ensure that people have a good experience as they return to C++, or turn to it for the first time. Thus we sometimes have called this the “happy path” talk — designed to show the simple happy path through modern C++ that avoids needless pitfalls.

My other talk was Using the Windows Runtime From C++. This is Windows 8-specific and talks about the “foreign object model” language extensions used by Visual C++ 11 to talk to the new native ABI-safe WinRT types. These extensions should be used sparingly, only on the thin module boundaries around otherwise nice and portable Standard C++ code, and it was necessary to add them only because Standard C++ types aren’t ABI-safe and accessible safely from other languages. (If ISO C++ were to get a module system at some point that includes being able to talk about ABI-safe types on module boundaries, that would be happiness indeed!) There is also a template library called Windows Runtime C++ Template Library (WRL) that is another way to access basically the same functionality using template syntax; pick whichever you like best.

Thanks to all who attended!

Read Full Post »

//build/ search

Check out Ars’ choice of search term about 2/3 of the way down the page.

Hi-res here.

Read Full Post »

Why C++

Channel 9 has just posted a recording of my intro talk at C++ and Beyond 2011 last month in Banff. Here’s the link: C++ and Beyond 2011: Why C++.

It’s a keynote-y talk, not a technical talk, but we felt it was important to address an important trend involving the language. The goal is to share a perspective and rationale for why of late there’s such a resurgence of interest in C++ — both across the industry, and within Microsoft.

Whether or not you agree with the perspective and rationale, I hope you enjoy it!

Read Full Post »

I’m happy to report there’s a new show on Channel 9 that focuses on native code development in C++. It’s called “Going Native”… iTunes podcast here, Twitter @C9GoingNative.

From the description:

C9::GoingNative is a show dedicated to native development with an emphasis on C++ and C++ developers. Each episode will have a segment including an interview with a native dev in his/her native habitat (office) where we’ll talk about what they do and how they use native code and associated toolchains, as well as get their insights and wisdom—geek out. There will be a small news component or segment, but the show will primarily focus on technical tips and conversations with active C/C++ coders, demonstrations of new core language features, libraries, compilers, toolchains, etc.

We will bring in guests from around the industry for conversations, tutorials, and demos. As we
progress, we will also have segments on other native languages (C, D, Go, etc…). It’s all native all the time.

You, our viewers, fly first class. We’ll deliver what you want to see. That’s how it works.

Go native!

Read Full Post »

In my keynote on Wednesday, I highlighted just the top two important features in the C++ AMP programming model. That afternoon, my coding colleague and demo demigod Daniel Moth gave a 45-minute session covering the entire C++ AMP programming model that walked through all the features with more examples. Daniel’s talk is now also online at Channel 9. I hope you enjoy it.

Note: The PDF slides link is small but important — the screen isn’t easy to see in the video itself.

Read Full Post »

« Newer Posts - Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 1,411 other followers