Interestingly enough, the well reviewed book The Art of Readable Code by Dustin Boswell and Trevor Foucher mocks this, calling it Yoda Notation and concludes:
Thankfully, modern compilers warn against code like if (obj = NULL), so “Yoda Notation” is becoming a thing of the past.
Boswell, Dustin; Foucher, Trevor. The Art of Readable Code (S.98). O'Reilly Media. Kindle-Version.
(I think it is a design mistake of the language to allow arbitrary expressions with various side effects in places where there should be a simple boolean result.)
View all comments
Show parent comment
5
u/[deleted] Mar 15 '22
Interestingly enough, the well reviewed book The Art of Readable Code by Dustin Boswell and Trevor Foucher mocks this, calling it Yoda Notation and concludes:
(I think it is a design mistake of the language to allow arbitrary expressions with various side effects in places where there should be a simple boolean result.)