I am a Java programmer who is new to the corporate world. Recently I've developed an application using Groovy and Java. All through the code I've used quite a good number of statics. I was asked by the senior technical lot to cut out on the number of statics used. I've googled about the same, and I find that many programmers are fairly against using static variables.
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Tuesday, June 5, 2012
Why are static variables considered evil?
Sunday, June 3, 2012
How do you Require Login for Media Files in Django
I'm serving "sensitive" information in downloadable PDF's and Spreadsheets within a user registration section of a site.
Monday, May 21, 2012
Static classes in PHP via abstract keyword?
Thursday, April 19, 2012
what"s the point of declaring static functions in PHP?
So in PHP you can have
Class A{
function B(){}
}
Monday, April 16, 2012
Behaviour of final static method
I have been playing around with modifiers with static method and came across a weird behaviour.
Thursday, March 8, 2012
Are Java static initializers thread safe?
I'm using a static code block to initialize some controllers in a regsitry I have. My question is therefore, can I guarantee that this static code block will only absolutely be called once when the class is first loaded? I understand I cannot guarantee when this code block will be called, Im guessing its when the Classloader first loads it. I realize I could synchronize on the class in the static code block, but my guess is this is actually what happens anyway?
Friday, January 13, 2012
Unable to get Static declaration behaviour in PHP
class StaticTester
{
private static $id=0;
function__construct()
{
self::$id+=1;
}
public static function checkIdFromStaticMethod()
{
echo "Current Id from Static method is ".self::$id;
}
}
$st1=new StaticTester();
StaticTester::checkIdFromStaticMethod(); // this outputs 1.