L
lightning
In project, I feel that using SomeClass.someMethod() is very
convenient and quick to deal with sth.
e.g:
MailUtil.sendMail(String from,String to,String text) throws
XXXException...
In fact, I worte so much code to make tool methods in this way and
feel that not only me myself feel good but also others using my code
feel good.
However,
the code like:
SomeClass x= Somelocator.getSomeinstance();// or SomeClass
x=new ....
x.someMethod();
bothers us more.
What's the advantage of using instance methods instead of using static
methods in making tool methods?
Memory issue? GC or jvm issue? Or just design pattern issue?
convenient and quick to deal with sth.
e.g:
MailUtil.sendMail(String from,String to,String text) throws
XXXException...
In fact, I worte so much code to make tool methods in this way and
feel that not only me myself feel good but also others using my code
feel good.
However,
the code like:
SomeClass x= Somelocator.getSomeinstance();// or SomeClass
x=new ....
x.someMethod();
bothers us more.
What's the advantage of using instance methods instead of using static
methods in making tool methods?
Memory issue? GC or jvm issue? Or just design pattern issue?