News for hackers. Stuff that matters.
Re:Ask HN: What can lead to misleading names of functions? by lostdog on Thursday November 25, 2021 @11:44PM (#29347542)
Not caring enough to try to come up with good names.

I see tons of functions named update_data and get_state and add_items in the business logic sections, which should be named for the specific things they touch. But laziness leads to using meaningless generic terms.

The other two are lack of English knowledge (both in native and non-native speakers), and when the function used to do something else but the name wasn't updated.

Re:Ask HN: What can lead to misleading names of functions? by JZN666 on Friday November 26, 2021 @01:32PM (#29352727)
> I see tons of functions named update_data and get_state and add_items in the business logic sections

Maybe they're bounded by some clear context like class or module which serves specific set of tasks? Writing in well designed context MyPartOfSystem things like MyPartOfSystemUpdateData is another smellish side of naming I think. Or writing just long names that are used only in very short context (ex. variable "drivingLicenseCard" instead of "e", "entry" in "drivingLicenseCards.every((drivingLicenseCard) => drivingLicenseCard && checkSomehow(drivingLicenseCard))").

If they're not bound, then we have another source of spaghetti monster.

Re:Ask HN: What can lead to misleading names of functions? by lostdog on Saturday November 27, 2021 @02:35AM (#29358339)
No, they are not bounded.