DEV Community

loading...

Discussion on: Write better code and be a better programmer by NEVER USING ELSE statements

Collapse
mcsee profile image
Maxi Contieri

Yes. I'm aware of that

But I think we are wrong. Calling something a 'Helper' is a code smell of a real world entity we are too lazy to find.

Here are some reasons not to use that name.

Thread Thread
dglsparsons profile image
Douglas Parsons Author

Arguing with standards or convention is a difficult line to take though.
e.g. why are most keyboards in a QWERTY layout? - it's an outdated convention from when typewriters would jam, but that doesn't mean keyboard or laptop manufacturers should deviate.

I've not come across a different terminology for a helper function personally. Calling it just a function could suffice but doesn't make a succinct point. As long as it's widely understood, I think it's okay - coming up with a different term could just cause more confusion.

Thread Thread
mcsee profile image
Maxi Contieri • Edited

Agreed with the standard part

I'm not suggesting replacing Helper with another standard.
I'm suggesting to change every helper to an intention revealing name according to the domain

in your case I think charitiesByCampaignAndCountry(campaign, country) is a very good name related to domain. But it is not a helper :)

Thread Thread
dglsparsons profile image
Douglas Parsons Author

I'm absolutely agreed with the names of the functions. Although I'd argue that as a concept, the function is still a helper 😜 (insofar as it's separating out the logical act of getting charities from the specific invocation of it).