The Beauty of Static Types

submited by
Style Pass
2021-06-11 20:30:07

C is more than forty-five years old, and C++ in its current form has been around since 1985. Nevertheless, compiling old code with modern compilers can be quite a challenge. In this column, I’ll explore some of the reasons why it’s hard to get old code to run on modern systems, share my experiences porting a 10-year-old program to C++17, and end with some suggestions for people who want to keep the skills current.

I didn’t think that this was always the case. Compared with Objective-C and SmallTalk, I found C++ to be overly complex. I thought that the language valued runtime efficiency over programmer productivity. This made sense if you had a small programming team that was writing code to run on millions of systems across the country, I reasoned, but it didn’t reflect the cost/benefit calculus of most software developers.

Looking back, I see that I was mistaken. By rigorously enforcing types, C++ was actually forcing me to spend time on software design, and less time churning out lines of code. This is an efficient tradeoff, but it’s also a painful one. Like many programmers, at the time I found design to be considerably more difficult. That’s not surprising: I lacked both training and experience in software design. I was good at figuring out the interface for a few individual classes, but I had a hard time designing a consistent set of interfaces so that a large-scale application would function as a unified whole. 

Leave a Comment