Hacker News new | past | comments | ask | show | jobs | submit login

> "What a function does" is encapsulated in that function's name.

I would like to suggest that the function's name should tell you the result (going to the store) and not have anything to do with what the function does (walk, bike, drive, fly) to get that result. Parameters could restrict how the function gets the result. In which case, a default parameter of ANY means no restriction and makes perfect sense with actually less mental effort for the reader.

  GoToTheStore();  /* get me to the store */
vs

  GoToTheStore(ANY);   /* does ANY refer to any store?  */
but when necessary

  GoToTheStore(DRIVE);  /* I'm feeling lazy, and don't want to walk. */



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: