Disjunctive Normal Form and other fine reads
It’s another week of DHH causing waves, which probably shouldn’t be surprising (not linking because I don’t really want to provide him a larger platform). But it does highlight one of the things I find fascinating about the Ruby community.
First, Ruby is probably one of the best first languages out there. It’s syntax is friendly to no and slightly closer to English. I mean it has some odd logical elements like ‘unless’ that feel more awkward as an experienced programmer than as a new learner, but it is a good place to start.
On the flip side the Ruby community is way more likely to use terms like “the disjunctive normal form”.
I was reading How We Turn Authorization Logic Into SQL and ran into “the disjunctive normal form”. So I looked it up.
It is: an OR
of ANDS
.
In SQL that means it looks something like:
WHERE (userID = 3 AND roleID = 2) OR (userID = 2 AND roleID = 1)
On the flip side the conjunctive normal form would be an AND
of OR
s.
WHERE (userID = 3 OR userID = 2) AND (roleID = 2 OR roleID = 1)
So there you go. Two less common logical terms you can throw around your next meeting/code review/conversation/party.
Originially published in this issue of the newsletter
If you enjoyed this article please share it! Also, I have a newsletter that you might enjoy as well. Thanks! -Daniel