Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"No reason to add extra complexity just to dodge having a single global variable"

Yes, yes there is. It's called "reducing side effects".



In all fairness, "reducing side-effects" is a means; "ease of composing a program," "ease of understanding a program" and "ease of extending or changing a program" are ends.

They're all reasons, but it's possible that adding complexity to facilitate a means may compromise the end, aka "winning the battle but losing the war."


Anyone who's been a programmer very long has pulled their hair out over programs which have been extended far beyond the intentions of the original developer. It's not the right reaction to make everything as extensible as possible either, but eventually one learns a healthy respect for the dangers of global variables.

Pacman is a toy application by today's standards. Imagine developing an MMO. Sometimes the biggest part of the problem is precisely figuring out what state lives where authoritatively and exactly how far out-of-date each asynchronous copy can be safely allowed to drift.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: