Skip to Main Content
Deciding whether to write portable code or not should be the outcome of a cost-benefit analysis. The key reason to favor portable code is that it opens up the selection of resources available to our project. Diverse technology choices free us from vendor lock-in, allowing us to select the best technology in each area based on quality and price, and minimize technology risks. However, portable code can degrade functionality, expressiveness, and efficiency. A middle course involves drawing boundaries around the non-portable code to isolate it from the rest of the application. Another approach is to admit defeat and write code that gives the best native experience. In the long term, separately maintained code bases can be less complex than a unified one. The Web extra at http://youtu.be/Lgqu_9Kc2Sc is an audio podcast of author Diomidis Spinellis reading his Tools of the Trade column, in which he discusses how whether to write portable code or not should be the outcome of a cost-benefit analysis.