DEV Community

Discussion on: Why are global variables bad?

Collapse
 
mervinsv profile image
Mervin

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?

Collapse
 
galvao profile image
Er Galvão Abbott

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.