Never Trust the Software Guys: Most Programmers are Bad Programmers

Originally published at: Never Trust the Software Guys: Most Programmers are Bad Programmers - Patterns in the Machine

At least that is what I am left thinking after reading article after article about how Rust is going to save the world from C/C++ programmers. If you buy into all of the press around Rust it seems all of errors in today’s C/C++ code bases are the result of the using outdated and unsafe programing languages. C is 50, and C++ is 39 years old. Both languages excel at letting programmers do really dumb things. Rust on the other hand is a mere 12 years old and prevents all sorts of coding sins at compile time. Following this logic – all along bad programmers (and the software they wrote) are a direct result of the programming language they used. Now that we have Rust we can replace all of that horrible C/C++ code and all those bad programmers will be metamorphed into perfect coders and usher in a golden age of bug free software.

Okay, I’ll stop with the sarcasm. I have been writing C/C++ code professionally for over 30 years and the more errors that the compiler can detect at compile time is a good thing. The fact that Rust can guarantee memory and concurrency safety at compile time is awesome. So, am I a closet Rust fan? Not really. If Rust it is the right language for a given project, then let’s use Rust. However, what is right is very project/team specific. For example, a bare metal (i.e. no OS and no threads) project that does not use dynamic memory allocation may not be an ideal candidate for using Rust instead of C or C++. Did I mention that I am an embedded developer? And yes, Rust pitches itself as a programming language alternative for embedded devices.

Back to my complaint about how Rust is being propagandized. If programmers only used the right programming language, then every programmer would be a good programmer. I claim – in all seriousness – that bad programmers are bad programmers no matter what programming language they use.

If you hire a carpenter to build custom cabinets for your kitchen and when the job is done, the doors on several of the cabinets do not close. Who’s to blame? The carpenter you hired or that fact that he didn’t use the latest power tools from Home Depot.

To me, Rust is attempting to treat a symptom of poor programming, not addressing the underlying disease which is that bad programmers do not have proper skill sets for the task at hand. What skills sets am I talking about?  Formal mathematics and applied logic.  Ouch! Haven’t we been here before and hasn’t the industry decided that academia does not solve real world software problems?  

I am not arguing that we need formal mathematical proofs of the correctness of our programs. However, I am arguing that an understanding and certain level of proficiency of formal logic methods is a critical skill that a good programmer needs. Here is my reasoning. Well not really mine, it is paraphrased from a lecture “On the cruelty of really teaching computing science” given by Edsger W. Dijkstra:

  1. What is a computer? The only thing computers can do for us is to manipulate symbols and produce results of such manipulations.
  2. Before a computer is ready to perform a class of meaningful manipulations, we must write a program.
  3. A program is an abstract symbol manipulator, which can be turned into a concrete one by supplying a computer to it.
  4. The programmer’s job is to derive that program by means of symbol manipulation.
  5. This symbol manipulation – in the context of intellectual disciplines and sciences – fits into formal mathematics and applied logic.
  6. If programming is a part-of or a branch of mathematics and applied logic – doesn’t it make sense to have a solid grounding in formal methods?
  7. What could go wrong if we build a house without a solid foundation?

BTW, my college computer science courses did not provide a foundation for analytic or abstract thinking. I got that foundation from the math courses I took. It is not just the software industry, but academia as well that is on the hook for devaluing a background in formal methods and logic. I strongly recommend that you read Dijkstra’s lecture mentioned above.

TL;DR

In more practical terms, the best programmers I have encountered are those who are good abstract thinkers.