News for hackers. Stuff that matters.
Re:Using the Specification Pattern to Build a Data-Driven Ru... by jdmichal on Tuesday March 24, 2020 @09:56AM (#22674769)
That's just an optimization layer, though. I actually have a hard time telling this apart from `java.util.function.Predicate` with its default `and`, `or`, and `negate` methods...

I can certainly understand using something like this when your users are building rules, because you don't know what they want to build so you just provide the base implementations and the operators. But if engineers are implementing all the logic, it seems like the criticisms called out in Wikipedia regarding obfuscation and re-implementation of basic operators would apply.

https://en.wikipedia.org/wiki/Specification_pattern#Criticis...

Re:Using the Specification Pattern to Build a Data-Driven Ru... by NicoJuicy on Tuesday March 24, 2020 @11:21AM (#22675307)
Predicates are also related to expression trees in my opinion
Re:Using the Specification Pattern to Build a Data-Driven Ru... by Merad on Tuesday March 24, 2020 @01:07PM (#22676408)
A predicate is really just a test that accepts an input and produces true or false. The expression only becomes necessary when you want to translate the predicate somehow (e.g. to SQL).