When you are creating DLLs, using Android NDK/JNI, C++ on iOS or even GUI-based desktop apps, many samples, articles, tutorials and examples frequently mix platform specific code with core functionality. While this might serve to demonstrate specific API usage and techniques, it often leads to spaghetti code. The result is a refactoring and maintenance nightmare that is non-portable, un-testable with ample nooks and crannies for bugs to hide in.
In this talk I'll present a system architecture that I call The Salami Method. The Salami Method finely distinguishes between the different aspects and layers required for exposing platform-independent C++ on different “specific” platforms. At its extreme it strives to create a single, thin, transparent layer for each such aspect so that each layer is more easily built, tested, debugged, managed and maintained.
I will introduce the Salami Method and show a practical example of using it build a single C++ OpenCV app targeting both the desktop and the web with the same codebase (OpenCV is (The Open Source Computer Vision library found at opencv.org).