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

Jimmy Koppel wrote about this 6 years ago [1]. It's one of the first exercises in his software design course [2].

Two identical pieces of code can have different specifications.

  # x is an age of a person; the code checks if the person is past the retirement age in the US
  def is_of_retirement_age(x):
    return x >= 65;

  # x is an ASCII character which is already known to be alphanumeric; this code checks if it’s a letter.
  def is_ascii_letter(x):
    return x >= 65;

[1] https://www.pathsensitive.com/2018/01/the-design-of-software...

[2] https://www.mirdin.com



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

Search: