Accidental Struggle by Example of Ringbuffers
summary
A ring buffer for an embedded logger is implemented, then repeatedly extended until feature creep breaks it: 16-bit indices and a simple overwrite-or-drop policy become templated element types, configurable capacity, container policy and iterator support, then push_back/front and peek semantics are bolted on. The redesign extracts a wrapping index as a non-type template (non-type template size), separates use cases into small view classes like consume view, and uses iterator + sentinel so each case is minimal, testable and composable.
AI-written summary · about
chapters (24)
- 0:00Introduction and speaker intro
- 1:56What is a ring buffer
- 3:21Ring buffer use cases
- 5:28First ring buffer implementation
- 7:11Handling full buffer scenarios
- 8:14Need for testing and interfaces
- 9:19Adding peek functionality
- 11:07Templatizing the ring buffer
- 12:32Customizing container type
- 13:36Adding iterator support
- 16:28Expanding to vector-like methods
- 17:13Further extensions and complexity
- 18:39The need for redesign
- 19:23Analyzing design problems
- 20:05What makes ring buffers special
- 22:55Proposing a new design
- 23:16Implementing the wrapping index
- 25:21Creating buffer indices class
- 26:49Designing the cyclic buffer
- 27:31Separating use cases
- 28:34Consume use case implementation
- 30:00Summary of new design
- 31:03Reviewing the redesign
- 31:45Closing remarks and contact
related talks
36mInterfaces Matter
55mBreaking Dependencies: Type Erasure - The Implementation Details
01h 31mWhen Abstractions Fix Too Much - Towards Flexible Library Design
01h 03m“Lessons Learned From An Embedded RTPS in Modern C++"
18mPersistent Iterators with Value Semantics
01h 28mModern C++ Design reloaded
57mAdventures in Serialization: A Flexible Approach for Embedded Systems in C++
01h 13mFrom Iterators to Ranges — the Upcoming Evolution of the Standard Library
