Option 1 if enabling led is action itself, not side effect.
This would justify having enable/disable specific side effects in those functions. This is unlikely for given example. Enabling/disabling led likely side effect itself. You don’t want to put side effects into side effects.
Option 2 if it’s a side effect of bigger process. Option 2 makes harder to add side effects which will drive (but not guarantee) better separation of concerns.
Though, I’d go with option 1 anyway since I trust my self to not nest side effects even when code doesn’t hint me
Correct answer - depends.
Option 1 if enabling led is action itself, not side effect. This would justify having enable/disable specific side effects in those functions. This is unlikely for given example. Enabling/disabling led likely side effect itself. You don’t want to put side effects into side effects.
Option 2 if it’s a side effect of bigger process. Option 2 makes harder to add side effects which will drive (but not guarantee) better separation of concerns.
Though, I’d go with option 1 anyway since I trust my self to not nest side effects even when code doesn’t hint me