Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's all dependent on what you are familiar and comfortable with. You, apparently, are familiar with and feel comfortable using C style for loops over collections to sum an attribute. In Perl I would write your example as:

  my @totals = map { $_->{total} } @orders;
Does that make Perl better or worse in any way because of that? No, it's simple the idiomatic way to achieve that result given the current environment.

What we are really doing, is mapping a concept to the language. The concept in this case can be expressed in a few ways, but I would express it as:

  Collect the total for each order.
I don't expect programmers to try to match the structure of how that was expressed in English perfectly in their language/environment, but I DO expect them to map it into the idiomatic way to do it in that environment.

The key point is the environment. If I'm programming in perl, I expect others that will add or modify my code to be familiar with perl. If I'm also using Mojolicious, I expect others that are tasked to work on that code to be familiar with Mojolicious as well, or at least willing to look up resources to try to figure it out. In short, I expect familiarity with the chosen tools. If that's not a valid assumption, then those tools should not be in use.

Similarly, I don't feel the need to dumb down my vocabulary or concepts for HN, but I might for a different audience.



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

Search: