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

Discussion in 'ASP .Net' started by Neo, Jan 7, 2005.

  1. Neo

    Neo Guest

    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.
     
    Neo, Jan 7, 2005
    #1
    1. Advertising

  2. Neo

    Scott Allen Guest

    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.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    > 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.
    >
     
    Scott Allen, Jan 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SaravanaKumar
    Replies:
    6
    Views:
    9,410
    Tony Morris
    Oct 19, 2004
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,004
    Smokey Grindel
    Dec 2, 2006
  3. V Green
    Replies:
    0
    Views:
    863
    V Green
    Feb 5, 2008
  4. PA Bear [MS MVP]
    Replies:
    0
    Views:
    974
    PA Bear [MS MVP]
    Feb 5, 2008
  5. lightning
    Replies:
    4
    Views:
    912
    Daniel Pitts
    Oct 30, 2008
Loading...

Share This Page