"I think everything has its own pros and cons. And global variables' pros and cons depends on how it is being used."
Beautifully put: It's my point exactly. No, global variables aren't bad, booleans aren't a code smell and too many blank lines in the source code aren't a code smell either (saw the last two ones on articles around the web).
A case I cite often are infinite loops. They aren't bad, they are required to, let's say, build an interactive shell application, for an example.
Problem is people are becoming more and more marketers and less programmers, so everyone is in love with bold, catchy and polemic titles nowadays.
Need to use global variables? Go ahead, do it. End of story,
What I've meant with my comment is that global variables exist for a reason. One shouldn't be afraid to use them, when necessary.
It's dangerous to make such affirmations such as "thing X is bad for you" when it comes to programming, since this can even hinder the development process.
Let's try again: "When possible you shouldn't use global variables". That, for me, is a much more sensible way to put it instead of all the FUD we see going around in this industry.
And yes, there are a few source codes where I do use global variables.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"I think everything has its own pros and cons. And global variables' pros and cons depends on how it is being used."
Beautifully put: It's my point exactly. No, global variables aren't bad, booleans aren't a code smell and too many blank lines in the source code aren't a code smell either (saw the last two ones on articles around the web).
A case I cite often are infinite loops. They aren't bad, they are required to, let's say, build an interactive shell application, for an example.
Problem is people are becoming more and more marketers and less programmers, so everyone is in love with bold, catchy and polemic titles nowadays.
Need to use global variables? Go ahead, do it. End of story,
Are you still using global variables in your applications? And how did you manage it? Is it not hard to maintain and expand your app?
What I've meant with my comment is that global variables exist for a reason. One shouldn't be afraid to use them, when necessary.
It's dangerous to make such affirmations such as "thing X is bad for you" when it comes to programming, since this can even hinder the development process.
Let's try again: "When possible you shouldn't use global variables". That, for me, is a much more sensible way to put it instead of all the FUD we see going around in this industry.
And yes, there are a few source codes where I do use global variables.