Pros and Cons of Static Methods

From: Axehelm (axehelm_at_mchsi.com)
Date: 05/27/04


Date: Wed, 26 May 2004 22:18:18 GMT

Okay, I'm in a debate over whether or not static methods are a good idea in
a general domain class.

I'm personally not a fan of static methods but we seem to be using them to
load an object. For example if you have an Employee class rather then
instantiating an instance you call a static method 'GetEmployees' and it
returns a List of Employee objects.

I'm looking for what other people are doing and if you feel this is a good
or bad idea.

Thanks



Relevant Pages

  • Re: Static Method Pros and Cons
    ... > I'm personally not a fan of static methods but we seem to be using them to ... For example if you have an Employee class rather then ... > instantiating an instance you call a static method 'GetEmployees' and it ... Somebody tell me what a "general domain class" is. ...
    (comp.lang.java.programmer)
  • Static Method Pros and Cons
    ... a general domain class. ... I'm personally not a fan of static methods but we seem to be using them to ... For example if you have an Employee class rather then ... instantiating an instance you call a static method 'GetEmployees' and it ...
    (comp.lang.java.programmer)
  • Re: Pros and Cons of Static Methods
    ... weight should be instance vars, but it would make sense for personCount (the ... > I'm personally not a fan of static methods but we seem to be using them to ... For example if you have an Employee class rather then ...
    (comp.lang.java)
  • Re: Static methods slower?
    ... I've never heard that static methods are slower. ... static then surely you have the overhead of instantiating an object ...
    (comp.lang.java.programmer)
  • Re: Pros and Cons of Static Methods
    ... Yes I understand what you are saying and yes I'm ant-global... ... Exposing multiple static methods in place of constructors ... > really class messages, that is, methods that act upon an entire ... For example if you have an Employee class rather then ...
    (comp.lang.java)