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. Advertisements

  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. Advertisements

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. Paul Opal
    Replies:
    12
    Views:
    1,211
    Paul Opal
    Oct 11, 2004
  2. SaravanaKumar
    Replies:
    6
    Views:
    9,906
    Tony Morris
    Oct 19, 2004
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,363
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,824
    Smokey Grindel
    Dec 2, 2006
  5. MowGreen [MVP]
    Replies:
    5
    Views:
    2,351
    PA Bear [MS MVP]
    Feb 9, 2008
  6. lightning
    Replies:
    4
    Views:
    1,151
    Daniel Pitts
    Oct 30, 2008
  7. Leon Bogaert
    Replies:
    19
    Views:
    570
    Robert Klemme
    Mar 23, 2008
  8. Kenneth McDonald
    Replies:
    5
    Views:
    645
    Kenneth McDonald
    Sep 26, 2008
Loading...