Of course I’m asking in good faith. I wouldn’t have asked how you’d implement the same problem yourself if I wasn’t interested.
But you also have to understand that it’s very easy for people to say “x is bad” when actual real world problems sometimes require a small smattering of ugly code. So it’s not unreasonable for me (or anyone else) to ask how you’d write a solution to the same problem.
Now what I’m trying to understand is whether the examples highlighted by the author as ugly, was ugly because it’s bad code. Or ugly because it was the right solution which lead to ugly code. Which is why I was asking for your preferred solution.