Re: Pros and Cons of Static Methods
From: kevinc (kevinc_at_elp.rr.com)
Date: 05/27/04
- Next message: Mark R Rivet: "solution to path problem"
- Previous message: perry anderson: "Re: Will this code need to be synchronized ?"
- In reply to: perry anderson: "Re: Pros and Cons of Static Methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 May 2004 15:30:27 GMT
Classes were not meant to become repositories for functions.
Using static methods. What you in fact have, is a function.
perry anderson wrote:
> things are done differently in Java than C++, you are in more of truely
> object-oriented world and thats not just a cute term. static methods are
> really class messages, that is, methods that act upon an entire
> classification of objects not just one instance. it is an elegant means
> by which to send messages to all instances or rather the class itself
> and thats how you have to start thinking.
>
> i know your sort of coming at it from an anti-global variable approach
> but static methods are not the same thing. typically they do not create
> the same hang ups as global methods used in non object-oriented languages.
>
> i could say more but first let me hear back if you understand what i am
> saying
>
> thanks
>
> - perry
>
>
> Axehelm wrote:
>
>> 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
>>
>>
>
- Next message: Mark R Rivet: "solution to path problem"
- Previous message: perry anderson: "Re: Will this code need to be synchronized ?"
- In reply to: perry anderson: "Re: Pros and Cons of Static Methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|