I am puzzled by this. Object oriented programming and local, object-bound states have worked very well for me in the past 20 years. Globals - call them global state, or call them just globals because that's what it is - always cause trouble over the lifespan of a product.
If it's a simple product, you can deal with the trouble (add more cases!). This costs time.
If it's a complex product, you will get into the "unmaintainable, unfixable, basically throw-away" state of codebase very quickly.
The less all the different pieces of code know about each other, and need to know about each other, the better. You get a better codebase, with fewer errors, that is much easier to maintain. The only downside is you have to think about your architecture so your initial implementation might be a bit slower, and you might have to refactor a few times along the way as it's impossible to get an architecture right on the first try.
Don't use global variables is basically one of the tenets of programming. I don't think that there's exceptions to where this would not apply, or that somehow because of some framework, it's OK now.
High coupling is a bad practice in software engineering. Global variables lead to high coupling.
It seems like the same lessons have to be learned over and over again?
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 am puzzled by this. Object oriented programming and local, object-bound states have worked very well for me in the past 20 years. Globals - call them global state, or call them just globals because that's what it is - always cause trouble over the lifespan of a product.
If it's a simple product, you can deal with the trouble (add more cases!). This costs time.
If it's a complex product, you will get into the "unmaintainable, unfixable, basically throw-away" state of codebase very quickly.
The less all the different pieces of code know about each other, and need to know about each other, the better. You get a better codebase, with fewer errors, that is much easier to maintain. The only downside is you have to think about your architecture so your initial implementation might be a bit slower, and you might have to refactor a few times along the way as it's impossible to get an architecture right on the first try.
Don't use global variables is basically one of the tenets of programming. I don't think that there's exceptions to where this would not apply, or that somehow because of some framework, it's OK now.
High coupling is a bad practice in software engineering. Global variables lead to high coupling.
It seems like the same lessons have to be learned over and over again?