Kris Jusiak

Kris Jusiak

Quantlab Financial, LLC - Senior Software Engineer

Denver, Colorado, United States

Kris is a Senior Software Engineer passionate about programming and has worked in different industries over the years including telecommunications, games and most recently finance for Quantlab Financial, LLC. He has an interest in modern C++ development with a focus on performance and quality. He is an open source enthusiast with multiple open source libraries where he uses template meta-programming techniques to support the C++ rule - "Don't pay for what you don't use" whilst trying to be as declarative as possible with a help of domain-specific languages. Kris is also a keen advocate of extreme programming techniques, Test/Behavior Driven Development and truly believes that 'the only way to go fast is to go well!'.

Area of Expertise

  • Finance & Banking


  • C++
  • Design
  • metaprogramming
  • API Design
  • Testing
  • TDD & BDD
  • Extreme Programming

Rise of the State Machines

In this case study, we will conduct a battle against different ways of implementing state machines in modern C++, each of which has different trade-offs and characteristics. We will use a connection [1] example to measure and compare varied aspects of each solution such as compilation time, run-time performance, memory usage, executable size, and readability.

In the first round, the Naive solutions will fight against Standard Template Library (STL) solutions. The Naive will be represented by the if/else and switch/enum, both of which could be classed as the 'old school' way of implementing state machines with implicit states defined by booleans and/or enums. On the other side, we will have STL, featured by C++17 - std::variant [2] and the newest addition to C++20 - coroutines [3]. These two can be used to demonstrate a new way of implementing state machines by leveraging modern C++ language features.

The winner will go on to take on the Boost libraries represented by Boost.Statechart [4] and Boost.MetaStateMachine (MSM) [5]. Both libraries are compliant with Unified Modeling Language (UML) standard [6] and have many additional features such as logging and/or serialization. Whilst Statechart is more run-time, the MSM represents a fully compile-time approach with minimal run-time overhead.

While our winners are recovering, we will introduce the final contender - [Boost].StateMachineLanguage (SML) library [7] - a C++14 version of Boost.MSM of which I'm the author and claimes to have much faster compilation times then its precursor. We will follow by some 'godbolting' (comparing a generated assembly) [8] of different dispatching techniques (branch, switch, jump table, fold expressions [9]) available in the library to illustrate the main power of the SML - the ability to change the feature set and behavior at compile-time.

After that, we will return to the final round, where the winner will battle against [Boost].SML.

At the end of this epic battle, the audience will walk out with a clear understanding of possible state machine implementations, their trade-offs, and with guidelines of what solutions suit what problems.

Let's get ready to rumble at NDC London 2020!

[1]: http://boost-experimental.github.io/sml/embo-2018/images/connection.png
[2]: http://en.cppreference.com/w/cpp/utility/variant
[3]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4736.pdf
[4]: http://www.boost.org/doc/libs/release/doc/html/boost_statechart.html
[5]: http://www.boost.org/doc/libs/release/doc/html/boost_msm.html
[6]: https://www.omg.org/spec/UML/2.5.1/PDF
[7]: https://github.com/boost-experimental/sml(Boost.SML is not an official Boost library)
[8]: https://godbolt.org/g/HVavPU
[9]: http://en.cppreference.com/w/cpp/language/fold


Over the years the term - Dependency Injection (DI) - has become more and more mystical while in actual fact DI is as simple as ABC. For those of you who have ever used constructors, you have inadvertently been using DI!

In this practical session, we will follow success stories of applying different forms of DI in several projects and focus on the outcomes as well as the potential pros and cons of using it.

We will establish why in an environment with constantly changing requirements [1] DI may play a crucial role if it comes to writing a maintainable/testable code with limited boilerplate and why "The only way to go fast is to go well".

The key point will be about comparing different ways [2], approaches [3] and frameworks [4] of accomplishing DI in different languages, each of which has different trade-offs, characteristics and which suits different applications.

At the end of this session, the audience will walk away with a clear understanding of possible use cases for DI, its benefits, as well as guidelines on how to correctly apply it.

Get ready to "inject all the things" at NDC London 2020!

[1]: "Nothing is certain in Software Development except for bugs and constantly changing requirements!" - the Franklin rule
[2]: Templates, Concepts, Type-Erasure, Inheritance, Variant
[3]: Injection at run-time/compile-time/code generation
[4]: C++ - [Boost].DI - https://github.com/boost-experimental/di (not an official Boost library)
C# - AutoFac - https://autofac.org
Java - Dagger2 - https://github.com/google/dagger

Kris Jusiak

Quantlab Financial, LLC - Senior Software Engineer

Denver, Colorado, United States