←back to thread

Against Best Practices

(www.arp242.net)
279 points ingve | 1 comments | | HN request time: 0.227s | source
1. uludag ◴[] No.42174368[source]
> “Don’t use globals” is obviously good, but “never use globals under any circumstances” is just silly

I'm actually not even convinced that this is a good rule. When it's explained it makes sense on the surface. I also think that since beginners to programming use global variables, they come to the conclusion that it must be universally bad since that's what their beginner self did.

Having work on codebases with most state being being stored as global variables (in a single namespace at that) is manageable at worst and easy to develop on at best, assuming certain conventions are followed.