You use these classes every day in your Qt work: From QString, QByteArray, QVariant over QSize, QPoint, QRect and their -F variants, to the collection classes such as QVector, QStringList and QHash, and finally drawing classes such as QColor, QPen, QBrush, QPolygon and QPainterPath. And that's just scratching the surface of QtCore and QtGui.
Unlike polymorphic classes, which are designed for inheritance and gently guide your subclass design by the knobs they expose (protected and virtual members, say), value classes have to be designed from scratch each time one is needed.
At the same time, value classes tend to affect the performance of your programs in more profound ways than polymorphic classes ever could. Who hasn't started out passing QStrings around by value instead of reference-to-const, and then wondered why QAtomicInt functions top the list of call counts, or even time spent in performance profile data?
Likewise, failure to introduce a value class over a tuple of values (say, two ints instead of a Point class) makes for hard-to use (for humans) and hard-to-optimize (for compilers) APIs.
In this presentation, we'll take a deep dive into value class design, in particular, but not exclusively, from a performance point of view. You will learn how your compiler sees your code and how you can level the playing field again. But we'll also cover API design and binary compatibility issues.
We'll start by classifying the different approaches used to write value classes and then present specific guidelines for each of these. You will learn how to make your value classes compact and fast, easy to use, and extensible.
The presentation targets an audience with intermediate to expert Qt knowledge. Some familiarity with features new in C++11/14 is highly beneficial, too. In particular, we will not explain the Qt classes that we use, and will only very briefly describe new C++11/14 feature we may be using in the code.
Beginners are welcome, too, but may want to read up on the above-mentioned topics to get the maximum out of this presentation.
Marc Mutz is a Senior Software Engineer, Trainer, and Consultant with KDAB – The Qt Experts. Starting out around the turn of the century as a KMail/Kontact Core Developer, he has since wandered down the software stack to become a major contributor to the Qt Project, and maintainer of its QtWidgets module.
Having taught more than 25 multi-day Qt trainings to companies such as Schlumberger, EADS and Siemens, he was also among the first batch of Qt developers certified by Nokia’s now-defunct Qt certification programme in 2009.
Marc is recently enjoying his new role as parent and—increasingly less so—as a house builder.
Marc Mutz, KDAB
Qt application development and device creation
Wednesday, October 7, 2015 -
From 14:30 to 15:00