r/ProgrammerHumor • • Mar 15 '22

static bool isCrazyMurderingRobot = false;

Post image
4.9k Upvotes

257 comments sorted by

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:

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.)

3

u/ClarityThrow999 Mar 15 '22

I guess you can call me yoda when it comes to languages that allow this. Different strokes for different folks.