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

Does anyone else hate foo(), bar() and baz() as example names. They are meaningless - except communicating that its a programmer selected name. Even func1(), func2() would be better.



f(), g() and h() are decent alternatives.

Of course, the real solution is to come up with an reasonable example scenario with meaningful names.


a, b, c seems more intuitive


Yep.


I dont think it matters


I'm ok with it but I think it does matter a bit.

here's a small example:

"Did baz call bar or did bar call baz ?" "Did func2 call func3 or did 3 call 2?"

Again not a big deal but if I'm trying to show a snippet of code then I would try to make that snippet as simple to follow to get my point across. I think it's a sensible rule.

In this case, could it have helped if instead of ,hypothetically, keeping this information in your head "foo called bar which baz" you could rely on meaningful names to help the reader ? Yes. Yes I think it would be beneficial (matters a bit).

Whether that's specifically "func2"..3 or very verbose names "funThrowsExceptionOn0()", I think it would help.

You can argue if that was necessary here for this example but I think it'd be hard to argue against meaningful names.




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

Search: