October 2010

C&B ended last night, and Herb, Andrei, and I have already started thinking about how we’ll tinker with the content and format for the December “Encore” presentation.  As is typically the case for version 1.1 releases, we’ll file down a few rough edges we found in version 1.0, but being developers at heart, we’re also thinking of sneaking in a couple of new (albeit minor) features.  We’ll post details when they’re available.

In the meantime, here are a few of my personal highlights from C&B:

  • Herb demonstrating that C++0x lambdas can be used in a lot more ways than I’d considered.  I’ve spent a fair amount of time working with lambdas (one of my favorite new features in C++0x), so I’d  already considered quite a few.
  • Andrei’s remarking that of the 6 hours 15 minutes it took him to process 6 million HTML files for one of his Facebook projects, 6 hours were spent doing nothing but opening and closing the files.  He still managed to reduce his total processing time to 1 hour and 14 minutes.
  • Attendee questions that led me to find out that (1) you can initialize a std::string with false (!) and (2) doing so calls the constructor taking a pointer (!!); (draft) C++0x allows calls to move constructors to be elided under the same conditions as copy constructor calls; and CPU caches sometimes operate on virtual addresses and sometimes on real addresses, typically depending on the speed of the cache.
  • The realization, once again, that no matter how varied the backgrounds and professional responsibilities of C++ developers, two things you can rely on are (1) they care about performance and (2) they can’t get enough of it.
  • Falling asleep to the sound of a crackling fire is just as pleasant now as it was when I went camping as a kid, except that doing so while sleeping in a bed is a lot more comfortable. (All rooms at the Salish Lodge have wood-burning fireplaces.)
  • Contrary to our intuition, C&B attendees didn’t tend to come from places geographically close to the location of the event (Snoqualmie, Washington).  In fact, we had more people from other continents than from the state of Washington!  Here’s a map showing where attendees came from.  The sizes of the circles correspond to the number of attendees from that location:

Next week, all attendees of C&B will get a link to an updated version of the PDF course materials, and, because we expect to find a few more things we can improve during our December presentation, we’ll also send October participants a link to the final C++ & Beyond 2010 presentation materials after the December event is over.   This way, not only do December participants benefit from the improvements we made based on our October experience, October attendees will have access to the things we revise based on what happens in December.

We’ve set up the registration page for the December “Encore” presentation to show the number of remaining slots, so you can see how quickly you need to sign up if you’d like to attend.  Currently there are 25 open slots (there were 26 when I started this blog post), but, based on the evaluations and other feedback we got from this week’s attendees, we suspect that many of this week’s participants will return to their workplaces and encourage their colleagues to sign up.  If that happens, tickets could start disappearing at a good clip.


In the month since we announced the December 13-16 “encore” presentation of C&B, we’ve sold more than half the available 60 slots.  At this rate, there’s a good chance we’ll sell out before the end of the early-bird registration period on November 14.  If you’ve been waiting to hear from people attending next week’s C&B “premiere” to see if the event is worth it, I suggest you not mull things over too long if you hear good things.

Andrei, Herb, and I will be doing our best next week to make sure that all the feedback you receive is positive, and assuming we succeed, we look forward to seeing you in December.


PS - Here are links to the C&B web site and registration pages.


Personal note: No, I didn’t gain that much weight. I mean, you tell me. This is about large-scale Web companies, which, from the perspective of mainstream computing, abide to styles and approaches to system design and implementation that seem foreign. Today’s off-beat approach is quickly becoming tomorrow’s common knowledge, and this talk sets a foot in that direction.


Working with very large data sets, only a few years ago the monopoly of a few companies (such as Google, Walmart, Yahoo, or Morgan Stanley), is becoming increasingly commonplace. Dealing with massive quantities of data on parallel computational networks shifts usual design tradeoffs substantially: operations that are traditionally considered cheap become prohibitive, and algorithms that seem ungainly become life savers. This talk shares from Andrei’s experience on working on large data sets with his doctoral work and one year of doing Natural Language Processing research for Faceboook.


In concurrency, it’s often better to ask for forgiveness than for permission. Lock-based approaches pessimistically assume contention and ask for permission first, which often slows everybody down. A new breed of optimistic concurrency control relies on doing work on the side and carefully merging changes into shared structures assuming it succeeds most of the time. The result? Faster, more scalable concurrent code.

As always, that’s not the full story - solutions that are better through and through are a rare commodity in our métier. With new benefits also come new risks. Also, the programming model is oddly different, as are the challenges. There are no more critical sections, deadlocks, or livelocks, but now that everything is free-flowing it’s more difficult to keep threads from hanging on old data.

This talk is a thorough introduction to lock-free concurrency using the compare-and-swap (CAS) primitive. We’ll design together an efficient lock-free stack, and we’ll sketch more intricate container implementations.

Elements of Design

As I continued working on my brand-new Elements of Design talk this month, it became clear that there was a lot to say about it… too much for it to fit into a single 90-minute talk slot. For one thing, the talk now mentions nearly 100(!) illustrative design examples, many of them in detail. To do the material justice, I’ve had to extend it to be a two-part half-day talk, which now takes up the entire morning of Day 3 on the C++ and Beyond program.

Now that my lambdas and design talks ended up taking all the speaking time available for me, I’ve deferred the other new talk I was going to write (Exceptional C++0x/GotW0x) and plan to do it at a future event. Fortunately, I’ve still reached my goal of creating “100% brand new material for my 270 min of talks” at C&B, and I’m very happy to be presenting entirely new, never-before-seen-in-public talks. (As I mentioned on the lambdas talk announcement, I did give a private preview of a subset of the lambdas talk in conjunction with the ISO C++ meeting this August in Switzerland; other than that, no one has seen any of this stuff.)

I’m really looking forward to delivering this material on sound design elements, design principles, and the design process itself. Design is something I’ve become quite passionate about in recent years, in part because it requires specific skills and taste, but most off all because it’s so important for every programmer — whether building a new library or extending one, building a new class or maintaining one, and that covers pretty much all of us.

It’s a big job to prepare a new talk, and so it’s been a real joy to see this material that I really care about come together and click so well. I’m jazzed about it and think it will do justice to this important topic… and I hope, perhaps, even itself be an example of beautiful design.

Personal note: This is a labor of love. While working on the D programming language I’ve been mulling on a new abstraction for iteration and algorithms, and after many false starts I was ready to admit I was unable to define a significantly improved design. But I was desperate to fix some of STL’s shortcomings, and often desperation causes inspiration; I finally stumbled upon an abstraction that was stupidly simple, dead obvious, and yet surprisingly powerful. A few months and a superset of STL later, ranges were ready for prime time. Compatible containers were soon to follow.


It is fair to say that containers and iterators have been with us ever since the early days of high-level languages. Fortran was all about arrays, and Lisp used lists simultaneously as containers and their iterators. Object oriented languages brought elaborate container hierarchies and nomenclatures on the table, and just as the GoF was about to make iterators famous, the STL added one more twist to the plot: iterators are not just for iteration - they are a veritable liaison between containers and algorithms.

But that’s so 1994. Has the matter been settled for good? A closer look reveals many holes in the dam. Tries cannot be expressed in the STL. Heaps are not really containers - iterating a heap is destructive. Bloom filters - highly useful structures for searching - defy any classification. And STL iterators have their issues, too. No operation on an STL iterator can be made reasonably safe. Composition is tenuous - you need to pass two iterators, not one, to get anything done. Pointer syntax and approximate pointer semantics have been a mixed blessing.

This talk casts a fresh look at containers and iterators. It draws from extensive experience with designing the standard library for the D programming language. D features a simple yet comprehensive approach to containers, and also ranges - an obvious-in-hindsight, how-in-the-world-has-nobody-thought-of-that-before approach to iteration and algorithms. As usual, the deity - be it divine or fallen - is in the details, which the talk has a fair amount of. Get ready to iterate through it.

Two of the scheduled panels are “Ask Us Anything!” sessions where the three of us will take your questions on (almost) any topic and do our best to give you an informative, useful, thoughtful answer. Or multiple overlapping answers, with fisticuffs, which can be even more fun, not to mention even more informative because that nearly always means shedding light on the question from several different directions to highlight alternatives and tradeoffs and grok the central underlying issues more deeply — which might not even have been directly mentioned in the original question.

Registered attendees will be receiving information in email on how to submit questions in advance. We’ll give those priority at the event since those will be from people actually in the room.

But whether or not you’re not attending, feel free to post a comment here containing a (preferably brief) question that you wonder about related to C++, C++0x, Boost, D, or Bjarne’s favorite beer. If the question is interesting, in addition to considering it at the event, it may spur one of us to answer it briefly here in the comments… or to write an article about it, which happened in the past.

Next Page »