Paper: Global Variables Considered Harmful

4 May 2022 by Phillip Johnston Last updated 5 February 2024We try to avoid issuing rules and decrees when giving programming advice. There are tradeoffs to every decision, and sometimes the tradeoffs one needs to make completely invalidate general advice. Still, we cannot ignore the collective experience of our entire industry across many decades. What makes us any wiser than those who came before us? One hill that we will proudly stand and die on is global variables should be avoided unless absolutely necessary. And their use rarely is absolutely necessary. Instead, we often find that developers introduce global variables and global …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.