Author a genius!
Perhaps we're all missing that the author is really trying to provide a bad example.
I suspect that the code has been ingeniously designed to demonstrate worst-practice.
...yes... that has to be it... this sort of code doesn't just come about from incompetence...