I believe they are very full at times.
I got this comment on a LinkedIn post for the differences between Selenium testers and Selenium developers.
It is worth providing an answer.
Now, I am not a Java expert, far from it.
But others are.
For example, Simon Stewart.
Yes, that Simon Stewart who created Seleniumn WebDriver.
This is from his blog:
“Singletons? Static Methods? Also No.
Singletons (in the traditional “implemented as a static field in a class” sense, not in the “ideally we’d only have one of these” sense) destroy our ability to have fun and write tests that can run in parallel, slashing our potential productivity. Also, it leads people to start using the Service Locator pattern instead of Dependency Injection, and we take DI as an article of faith (see above), mainly because it facilitates TDD by making collaborators clear, like we (also) said above.”
So, static methods? Also no.
Do you need more reasons against static variables and methods?
They promote code that is not object oriented.
Object oriented code is about objects.
Every method is used on an object.
Since static variables or methods are for the class but not the class’s objects, you are writing code that does not use objects.
Have a look at the following articles for more details:
Still not convinced?
Read this topic from Stack Overflow.
Still in doubt?
Continue to use them.