When I see a question like this, I tend to ask myself: do I want to see the solution on a code review, or do I want to come across the solution while debugging the code during a grave prod issue at 3AM? Don't get me wrong, it's not your fault: it's the book's, but the answer is usually a big NO. —
lorro just now