Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
N00bPancakes7688175dIf it works...
AlgoRythm49318175dDo you often work with complex Boolean math? I don't come across it much. In fact the project I inherited is full of
Fast-Nop33932175dJesus said, but let your communication be, Yea, yea; Nay, nay: for whatsoever is more than these is a parity error.
I work in finance (fintech?) and the codebase is quickly heading towards flag hell.
There’s a lot of complicated logic around when to do something, when to show things, etc. and of course the PM always gives complicated conditions, and they are inverses of how I would represent them in code. (And some of the conditions are compound, like `.viable?` means “not closed and not suspended”)
Currently I’m refactoring something that’s a long list of nested ifs/ifelses with various compound conditions, and converting it into a set of functions with guards. So much easier to understand. But this involves simplifying the messy boolean logic trees, and inverting many of the branches.
And ofc writing specs that ensure the logic is correct, including negative tests which involve more inversions.
It’s been fun 😅
3rdWorldPoison868175dHmmm isn't it just simple to understand code if boolean logic actually follows if-else code-like structure.
Maybe you might have a lot of these conditional flags for which combinations may very well be closures/lambdas/whatever.
Edit: nvm your comment just updated for me @Root
Imagine, if you will, a world filled with branching logic trees. For this particular tree, all of the various endpoints modify or replace a shared array, or modify data that other endpoints will eventually inject into said array. Determining if the array will have a particular bit of data involves climbing through all of its parent branches, and often traversing the entire tree. Adding new data also involves understanding the entire tree.
Now, imagine a set of boxes with clearly defined rules atop. If the rules are met, the box is opens; if they are not, it remains locked. Constructing the array mentioned above amounts to opening each box in turn and gathering the contents. If you desire a particular bit of data, you need only check its box. Adding new boxes is likewise trivial.
As someone who got turned upside down a bit just yesterday with just a handful of true false cases (with a bunch checks for 'not false' and 'is false' and now the same with true ... GUIES STOP) in a row ... that does not sound fun.
On the other hand if it works in the end, does sound really fun.
heyheni22645175dWolframAlpha is amazing! no shame in using a great tool.
TheCommoner2821894175dDo you have a moment to speak about polymorphism, our lord and saviour?
devphobe8122174dI rely on Regex101.com way more than I should.
JFK4225836172dSame here. When I cant use KV-Maps this is pretty much the easiest option.
eeee3321172dFor complex boolean logic I always consider introducing proper types and leveraging polymorphism instead of extracting functions with guards. But that could be a first step towards getting stuff manageable and testable in smaller units.
l0rdkr0n0s2169dThat is great I didn’t know WolframAlpha could do that. I have been using Karnaugh Map to simply boolean expressions.
heyheni22645169d@l0rdkr0n0s WolframAlpha is amazing but they do a poor job in marketing and explaining what it can do for you.
And the interface hasn't been updated since they launced the website in 2009. So the appearance may seem dated and scare new user away.
😄 i showed WolframAlpha to a high school student once and he thanked me so much, as he hates math homework. With WolframAlpha homework becomes obsolete as the main skill of today lies in the knowledge where to get knowledge.
Google-fuu, YouTube tutorials, are the essential skills of today.
Number032Confession: I am not a dev, I actually work on an IT helpdesk telling people how to turn on their PC's everyda...
Lyon28I have a confession to make. I do most of my java coding in comic sans ;-; IT MAKES ME HAPPY FOR SOME REASON
redundandundant6Me trying to find a good risotto recipe. Sister-in-law, PhD: What about pumpkin or courgette and salmon? Me: ....