2 ms·
They're students, of course they ask why. And while nobody had a nervous breakdown, yes, the need to pass references around extremely redundantly because this
by shadowgovt 3y ago
They're students, of course they ask why.
And while nobody had a nervous breakdown, yes, the need to pass references around extremely redundantly because this language lacks any way to establish a global context and top level non-class variables was a continuous impediment to their ability to accomplish the task.
I've seen some good suggestions in this topic though; I think next year I may recommend a top-level container class that has init called on it one time and can then be referenced in all other class files. It's the closest thing to global variables Java has to offer, and would save them a lot of hardship passing references around for no other reason than passing references around.
- dools 3y agoRight, yeah that sounds like the task for which I typically use a Singleton: https://www.digitalocean.com/community/tutorials/java-singleton-design-pattern-best-practices-examples https://www.digitalocean.com/community/tutorials/java-single... Things like connections to databases, network resources, motors and those types of things.