Closed sirhc101 closed 2 years ago
Oh! That's an interesting inversion of long-standing practice. I might want to sit with that one a bit, but you're right that it does make the readability much higher. Tagging some other reviewers for thoughts.
Just as an addition: Referring to this twitter thread https://twitter.com/waldo1001/status/1545455472693710848?s=21&t=biFnjpf0UdAUS0ne8kZ-KQ
It's also faster due to less code executed 😅
I actually apply this quite a lot .. . I like the "test near" kind of approach.
I must say - I'm not going to reject any code if people don't do this.
So for me, it's a pass ;-).
I do this all the time. I have found it also increases readability - AND - make it much easier to add and remove conditions, should the need arise.
I'm not sure you guys will like it, but I think it's at least good practice to do so and it helps to reduce complexity in source code and structuring your code.
Any hints or additions are very welcome.