Why Petshop Changed all static methods to instance methods when upgrading from version 3.0 to versio

N

Neo

Is it because of perfomance or something else?
I was confused when to use static methods and when to use instance.

Please give me some points. Thanks.
 
S

Scott Allen

I haven't looked at Pet Shop in some time so I'm not sure what the current
design looks like. In general static methods will outperform instance methods,
but this is a general statement and has to be tested against specific code.

Really, the decision between an instance or static method should be a design
decision and not based on performance.

If your class represents an object (a Customer, a TextBox, a Message), then
your methods & properties should be instance methods & properties. Static
members are generally used as shortcut or helper methods (like Thread.CurrentThread
or HttpContext.Current). These methods return an object using a static member
as a shortcut.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top