Ian Dees, New Relic
It’s amazing what a type system can do at compile time. This paper offers a peek at the C++ type system and standard libraries, which can make certain types of bugs difficult or even impossible to express in code. By brewing more robust code interfaces, engineers can save their QA teams from chasing down rare crashes, and let them focus instead on usability and performance.
Writing good software is difficult; doubly so in an unsafe language like C++. A simple off-by-one indexing error can cause code execution vulnerabilities. A couple of lines of cut-and-paste code can lead to memory leaks that slowly rob users of good performance.
Whenever an error strikes, one’s reaction should be, “How can we make it harder for this bug to happen again?” Typical solutions involve more tests, or code review. These are both good things. But what if engineers could make errors disappear from a code base forever—that is, prevent them at compile time? With its support for generic and functional programming, C++ is finally becoming an interesting enough programming language to explore this style of bug prevention.
Programmers may be familiar with using smart pointers to reduce memory leaks, or with using constructs like boost::optional to prevent data corruption. This paper will take these familiar ideas to the next logical step, using a technique called denotational design.
With denotational design, as espoused by Conal Elliott, a developer can first sketch a design in a type-safe language like Idris—even mathematically proving parts of a design correct—before translating to C++. One can dramatically change a C++ API by looking at it through the lens of denotational design.
Target Audience: Intermediate
2015 Technical Paper, Ian Dees, Paper, Slides, Notes, Video.