3 ms·
>This use-case has been achieved using a single Clojure variable. Can you expand more on how the business rules are executed with the variable ? Maybe a simple
by rawoke083600 4y ago
>This use-case has been achieved using a single Clojure variable.
Can you expand more on how the business rules are executed with the variable ? Maybe a simple example ?
Clojure-newbie looking to learn more :)
- dmichulke 4y agoEventually you want non-developers to develop business rules, so you come up with pseude-code like when X then do Y You can write them in Clojure like in the above example: [:rule [:when X] [:then Y]] which is kind of self-explanatory. X and Y can be any valid predefined expressions, e.g. [:rule [:when [:< amount 100]] [:then [:send-email-to-boss]]] If you had such a rule, you'd just parse that line as edn, substitute all symbols (check for injection attacks) and execute it. However, effectively clojure itself is most often the smallest representation: (when (< amount 100) (send-email-to-boss)) It's just not that readable because it's missing the "then", but it would be valid clojure right away. In the end it's like a code snippet that non-developers can write without having to set up a compiler, run-time, syntax-checker
- vincnetas 4y agofrom my experience im very sceptical each time when someone says that business people will write these rules. on paper it looks nice but at the end if rule is a bit more complicated developers end up writing or updating the rule while someone standing behind their back :)
- vamega 4y agoI’ve seen business people write rules in excel. A. lightweight dsl with a quick feedback loop (provided by a REPL in Clojure, and the UI of excel) seems to be key features to avoid ending up in the scenario you describe