Soham1087
Banned
I am a Java programmer in the corporate world. I recently created an application in Groovy and Java. Statics was utilized extensively throughout the code I created. The senior technical team urged me to reduce the amount of statics I utilized. I did some research and discovered that many programmers are opposed to utilizing static variables.
Static variables are more convenient for me to use. And I assume they're efficient as well (please correct me if I'm wrong), since if I had to make 10,000 calls to a function within a class as given in this example by scaler, I'd rather make the method static and use a simple Class.methodCall() on it rather than populating RAM with 10,000 instances of the class, correct?
Furthermore, statics eliminate interdependencies with other sections of the code. They can serve as ideal state bearers. Statics are also commonly implemented in other languages, such as Smalltalk and Scala. So, why is this anti-statics sentiment popular among programmers (particularly in the Java world)?
PS: Please inform me if my assumptions are incorrect.
Static variables are more convenient for me to use. And I assume they're efficient as well (please correct me if I'm wrong), since if I had to make 10,000 calls to a function within a class as given in this example by scaler, I'd rather make the method static and use a simple Class.methodCall() on it rather than populating RAM with 10,000 instances of the class, correct?
Furthermore, statics eliminate interdependencies with other sections of the code. They can serve as ideal state bearers. Statics are also commonly implemented in other languages, such as Smalltalk and Scala. So, why is this anti-statics sentiment popular among programmers (particularly in the Java world)?
PS: Please inform me if my assumptions are incorrect.