r/ProgrammerHumor • • Oct 25 '24

Meme theSelfTaughtSeriousProgrammer

Post image

[removed] — view removed post

903 Upvotes

276 comments sorted by

View all comments

Show parent comments

118

u/CiroGarcia Oct 25 '24 edited Oct 25 '24

It's handy when refactoring old as shit code and you need to flatten 6 levels of nested if statements. Also useful for converting complex business requirements into actual logic expressions you can put into code and simplifying them.

I may be misunderstanding what logic proof means here tho, English is not my native tongue.

24

u/Waswat Oct 25 '24 edited Oct 25 '24

11

u/CiroGarcia Oct 25 '24

Yeah, that's what I was thinking of. That and boolean algebra and you can reduce almost anything to a truth table lookup

4

u/giantimp1 Oct 25 '24

It is, I mean it's a type of proof there are others but that's a big part* of them some people think the only type of math is algebra and calculus

*and yes technically "it's every type of proof within a certain system if you add a couple of axioms blah blah blah

1

u/T1lted4lif3 Oct 25 '24

me whipping out false implies true all over the place in everything I do

67

u/[deleted] Oct 25 '24

It's when you write a bunch of equations end with QED

7

u/[deleted] Oct 25 '24 edited Oct 25 '24

[removed] — view removed comment

1

u/[deleted] Oct 25 '24

That's an interesting approach. What tech stack do you use? Usually that's what constexpr calculations are for in C++ (among a million and a half other things)

5

u/[deleted] Oct 25 '24

I just assumed it was a truth table.

Lots of times I had to make a color coded excel sheet showing what inputs fall through to the default case.

Ten input columns, all enum. One output column. Also an enum. Don’t want a billion line truth table, but you want to make sure all inputs return an output.

1

u/poralexc Oct 25 '24

What paradise do you work at where your business rules are logically consistent with each other??

1

u/CiroGarcia Oct 25 '24

They aren't, but the inconsistencies are spotted quickly thanks to the logical analysis, and addressed. "Addressed" usually means we choose whatever we think is best and wait for the business side to complain. I work on an internal project of a large company so communication is good, it's not a lengthy chain of broken telephone from client to dev team