Reputation: 2711
I wonder what prefix you guys use for methods that create or calculate a value based on given parameters. I tend to use "get", but that feels wrong, because it looks like a getter then. For methods that fetch from the database I use "fetch", but for methods that create a value based on the given input I haven't found a satisfying prefix yet. ("create" feels a bit too generic). Are there guidelines for this or is everyone just thinking up something for themselves?
Pseudo code example:
class myClass
{
method getOrderFlowpoint(par1, par2, par3) {
// do stuff based on the parameters
return orderFlowpoint;
}
}
Upvotes: 0
Views: 347
Reputation: 328608
If your class is only about OrderFlowPoints, I have seen the following, all linked to the Factory Pattern:
OrderFlowPoint.of(par1, par2, par3);
OrderFlowPoint.valueOf(par1, par2, par3);
OrderFlowPoint.newInstance(par1, par2, par3);
Upvotes: 1
Reputation: 174957
I tend to not use prefixes. I tend to name the method according to the exact function it fulfills.
If your function calculates the order flowpoint, that's exactly how you should name it. calculateOrderFlowpoint
.
Upvotes: 2