Friday, 29 November 2024

Meeting C++ 2024

I went to Berlin again to speak at Meeting C++. The conference has been going for a while now, and has been in Berlin for 10 years. 

I first went in "before times", in 2019, because Jens invited me to keynote. I went back last year, partly for the talks but also because the conference has a friendly vibe and there is a great mix of beginners to experts, so everyone can learn something.

Titus Winters gave the opening keynote, "Fear in tech". He said he wanted us to normalise talking about feelings, and reminded us a good person is better than a good programmer. He talked about recognising and managing fear, as well as using tools to reduce fear. Tools can provide a "formal source of truth", cutting through the "It works on my machine" thing. Little things like clear instructions on how to build code and run tests make a big difference.   

He talked about "bogus productivity" and hype plus FOMO. He told us to cut through the buzzwords. Learning and understanding can be a cure for the hype cycles. Listen to his talk when it's online, it covers so much and suggests ways to do better.  


Titus' talk possibly started a background theme of "Imposter syndrome". This was mentioned by so many speakers! 

After the opening keynote, sessions ran on four tracks. One in the main room, two in smaller rooms and one online. The conference is hybrid, allowing people who can't afford the cost or time of travel to Berlin to join in. The staff, or Jens, read out any online questions at the end of the sessions, so everyone could be involved properly. 

I went to Design Patterns - The Most Common Misconceptions (2 of N) by Klaus Iglberger first. He talked about virtual functions and pros and cons of

  • The curiously recurring template pattern (CRTP)
  • std::variant
He reminded us about duck typing in C++ and concepts as alternative approaches. His impression of Darth Vader going "quack" was magnificent. You had to be there.


I went to Portable floating-point calculations by Guy Davidson next. Adding up is surprisingly interesting! Fused multiply add (FMA) got a mention on more than one occasion. My final note says "Basically, speed or precision". (With an implicit "not both.")

Next I went to Classes C++23 style by Sebastian Theophil. The main thing he reminded me was about ref qualifiers. If you had forgotten about them too, Andreas Fertig's blog explains. He gives an example returning data items. Note the & and && after the functions:

class Keeper {

  std::vector<int> data{2, 3, 4};

public:
  ~Keeper() { std::cout << "dtor\n"; }

  A For lvalues
  auto& items() & { return data; }

  B For rvalues, by value
  auto items() && { return data; }
};

This isn't a C++23 feature, but talking about classes meant a good talk with several bonus details. It is amazing how much can come from one simple title.

That evening there was a C++ quiz.  You had to be there. Code with emojis. Some memcpy and other horror. But much laughter too.

The next day started with a center keynote by Hana Dusíková called "My favorite data structures". She started simple, then said "Most of the C++ library should be const evaluable." She asked us which C++ containers are constexpr. (Clue: very few.) 


Hannah did tell us her favourite data structure in the end: a "hash array mapped trie" (HAMT). I know all the words, but putting them together gives something new, to me at least. 

I went to my husband, Steve Love's talk Testable By Design next. He started by saying he actually is an imposter! He used to do a lot of C++, but has settled on C# for a day job recently. He blogs here. His talk was about writing code for a thermostat. Another simple place to start that provided lots to talk about. He mentioned using my Learn C++ by Example book to get back up to speed with C++. I had a few copies with me, and Ivan Cukic bought one.


After lunch I went to C++ Concepts: What you should know and how to use them right by Nicolai Josuttis. He said "New feature, new bugs" near the start. He is very good at pulling out some weird behaviour, and always says "Good!" afterwards. His main example was trying to write an add function which would apply to a set or a vector. There were lots of useful points in his talk, including a reminder to use static_assert to test your concept does what you need. 

Next I went to Stories from a parallel universe by Jana Machutová. She talked about the standard library parallel algorithms. She started simple, using std::execution::par_unseq in a for_each loop. So, something like

std::for_each(std::execution::par_unseq, 
    std::begin(v), std::end(v), [](){ do(); }

for some container v and some function do. No explicit threads because clever thread management is already there for you. She then got more complicated, pointing out new algorithms, including reduce instead of accumulate, transform_reduce instead of inner_product, and partial_sum becoming either inclusive_scan or exclusive_scan. The main differences are obvious if you have a non-associative binary operator. I need to play with a few examples. She then gave a few examples for when to use  the different execution policies like par_unseq, or par. 

Herb Sutter gave a talk that evening, called "Peering forward - C++'s next decade". He covered loads, but it was late and I didn't take any notes. He did talk about C++26's erroneous behaviour though. 



We stayed up far too late after that, discussing interfaces in C++ versus C#. I was talking the next day, so maybe this wasn't the best choice! I gave An introduction to swarm intelligence algos, and had some demos embedded in PowerPoint, but they wouldn't play. I managed a few live demos at the end instead. Note to self: stop using PowerPoint. Swarm algorithms are part of machine learning. Each item in a swarm explores and tries to exploit better solutions. The whole swarm communicates and you get some kind of emergent intelligence or a solution to a problem. They aren't that hard to code and make for good practice. My first book, Genetic Algorithms and Machine Learning for Programmers, has a chapter devoted to them. 
 
I missed the very beginning of Contracts for C++ by Timur Doumler, because I wanted to drop my laptop in my room and just breathe for a moment after my talk. Timur pointed out the first contracts proposal was 20 years old. In my head, contracts has turned into a big tangle, however Timur made it seem less gnarly. If we do end up with something like a better assert, that will be great. 

There were "secret" lightning talks next. They don't show on the program, but people who had been before probably expected them. 

The closing keynote was Peter Sommerlad on "Collective Amnesia?" He talked about the things we have forgotten and some reasons why. He started with five main points. 

  1. Well known knowledge is not applied
  2. Proven practices are not well known
  3. Scientific evidence is ignored
  4. Timeless principles are forgotten
  5. Complicated stuff is favoured over simplicity
Peter said one of the reasons for forgetting is powerful men trying to make money, and he clarified he did mean men. He got a bit more general than just computing at that point :-). We also often fall for hype/new shiny. But other things have an effect too - like trying to keep university teaching materials up to date. Listen to his talk when it's online. 



We stayed in Berlin on the Sunday to explore. We went for a long walk, starting at the Tier Garden, in the West. A nice big space for a walk.


 

We started walking East back towards the hotel. We found the Computer game museum and played a variant of Pong. Yes, that's for up to 5 players. So, the computer controlled three bats. Yes, that's four controls each: left, right, clockwise rotate and anti-clockwise. Oh my!


We then stopped at the Rockcafe HALFORD back near the hotel. Someone mentioned it to us over lunch at the conference. Thank you, whoever you were.