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

I don't see any code being improved in this article. The author does the same thing I've noticed Clean Code adherents do: he focuses on the busywork of splitting functions into tiny pieces while missing the actual place that requires the most mental effort to understand and is the most likely to become a source of bugs. In this case, it's the complex boolean expression that relies on Python's operator precedence. It could be rewritten like so:

  if (
      (
          has_passed_probation(employee)
          and is_paid_monthly(employee)
          and is_end_of_month
      ) or (
          is_paid_weekly(employee)
          and is_end_of_week
      )
  ):
to make it clearer that the has_passed_probation check only applies in the monthly case.



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

Search: