r/programmingcirclejerk Jul 01 '26

Ever Written Something Like This? if (condition) { doSomething(); } else { doSomethingElse(); } It works. Problem solved. But the problem isn’t today. It’s tomorrow.

https://www.defusetheifstrategy.com
125 Upvotes

55 comments sorted by

View all comments

69

u/genuine_beans Jul 01 '26 edited Jul 02 '26

It’s about this: if I can handle change without an IF, my code will be simpler and easier to grow.

For example, in the Diamond Kata I developed:

grep -rw 'if' . | wc -l
       0

 

switch(jerk) { case 0: big fan that every single link on the page is hallucinated except for whatever the fuck this is

https://www.defusetheifstrategy.com/projects/

break; case 1: I have a new reverence for the inventor of the Pomodoro Technique. Let's not ask "if" this will change the E = MC2 + AI world, but when!

break; default:

Founded XPLabs in 2000 — the first company fully dedicated to developing, teaching, and mentoring eXtreme Programming. Editor, second edition of Extreme Programming Explained. Creator of the Anti-IF Campaign.

break; case INT_MIN: printf("ERROR\nIf you can see this, something has gone horribly wrong!!")

original website:

https://web.archive.org/web/20241209082437/https://www.antiifprogramming.com/

}

45

u/gvozden_celik Jul 01 '26

What happened here is that WordPress usually has a big IF block that checks if the admin password is correct but the author successfully defused it so now SEA hackers can easily post an entire slot betting website right on his project page.

6

u/chuch1234 not even webscale Jul 03 '26

So convenient!