Nice article. Not sure about the refactoring though. With rem and xor additions readability decreased. Not sure why it make it better, especially with the former?
As Martin Fowler once said 'Good programmers write code that humans can understand.'
I actually find the refactor more readable, but one man's variable is another man's constant I guess. To me, rem looks like remainder and xor is reminiscent of "except". The former is simpler and more traditional, but less semantic. At the end of the day though, it's a very simple exercise so I would have felt like I missed an opportunity to improve if I just solved it quick and moved on :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article. Not sure about the refactoring though. With rem and xor additions readability decreased. Not sure why it make it better, especially with the former?
As Martin Fowler once said 'Good programmers write code that humans can understand.'
I actually find the refactor more readable, but one man's variable is another man's constant I guess. To me,
rem
looks like remainder andxor
is reminiscent of "except". The former is simpler and more traditional, but less semantic. At the end of the day though, it's a very simple exercise so I would have felt like I missed an opportunity to improve if I just solved it quick and moved on :)