Comment

Comment by hcarvalhoalves

The article builds a straw man though. The "bad example" is bad because it introduces OOP for no reason at all.

What's wrong with:

    def set_deadline(deadline):
      if deadline <= datetime.now():
          raise ValueError("Date must be in the future")

    set_task_deadline = set_deadline
    set_payment_deadline = set_deadline
You don't need code duplication to avoid bad abstractions.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton