I've just had an argument with someone I work with and it's really bugging me. If you have a class which just has methods like calculateRisk
or/and calculatePrice
, the class is immutable and has no member variables, should the methods be static so as not to have to create an instance of the class each time. I use the following example:
public class CalcService {
public int calcPrice(Trade trade, Date date) {
...
}
public double calcRisk(Trade trace, Date date) {
...
}
}
Should those methods be static
?