Hacker News new | ask | show | jobs
by taneq 2951 days ago
In this example the two "drive to airport" actions are different.

    If (volcano_status == GONNA_BLOW)
        pack_everything_and_run();
    else if (volcano_status == NO_WORRIES)
        pack_suitcase_and_leave_for_holiday();
    else if (volcano_status == UNKNOWN)
        cancel_holiday();
1 comments

It depends on what you treat as a complete action. One could equally well decompose it as two actions and two conditionals:

if (volcano_status == GONNA_BLOW) refuel_car(); else if (volcano_status == NO_WORRIES) refuel_car(); else if (volcano_status == UNKNONW) nop();

then later

if (volcano_status == GONNA_BLOW) pack_everything_and_run(); else if (volcano_status == NO_WORRIES) pack_suitcase_and_leave_for_holiday(); else if (volcano_status == UNKNONW) call_to_cancel_holiday();

Then refueling the car is definitely the same action, even if it's followed by different actions later on.