Unrelated Random Photo Just Because

Unrelated Random Photo Just Because

I Don't get the hatred around global variable in programming world. There are tons of articles in the net explaining why programmer must stay away from it. Well I've been programming for about ten years, yet I found global variable is really a gift.

Most of the reasoning behind the hatred is code maintainability. That is kind of ridiculous, a well written code will be easy to maintain, and badly written one will be hard to maintain regardless of global variable usage.

Global variables if used correctly will make code easy to read. Also it helps programmer to code faster.

For example: you want to have a function to change background color of all forms in your program, using global variable will be a lot quicker and easier than, say, passing parameter method.

So global variable is not evil.