off-topic

https://github.com/clojurians/community-development/blob/master/Code-of-Conduct.md Clojurians Slack Community Code of Conduct. Searchable message archives are at https://clojurians-log.clojureverse.org/
dgb23 2021-06-20T11:22:54.494500Z

I’m looking for a term, method for data modelling, which I think must exist in some way but I haven’t come across it yet. Context: I’ve recently (finally!) read Out of the Tar Pit, and it very much resonated with me. I’ve been naturally driven to declarative programming, specifically relational, but I’m also on a logic/math binge reading train since a few months. Now in terms of data modelling/design I have yet much to learn, I don’t know the jargon, common patterns as well as I would like to. (sidenote: any book recommendations are appreciated) The thing that I’m trying to find relates to this use-case: Given a (durable) application database and (user) events, I want a query that takes those events (encoded as raw data) and returns me another query/action/error message. I can imagine this being an in-memory database on top, or maybe a sophisticated enough subquery where the event is just a temporary thing. I don’t mind whether this is in SQL or Datalog. My intuition is that it might be a bit more natural/simpler in the latter, but the gist of it is that I care about some parts of ‘event’ in relation to some parts of ‘application database’, so there is some implicit join happening here on a ‘response’ relation. I haven’t figured out the details yet. My question: Do you recognize this pattern? Does it have a name? Are there conventions, common practices or books that you can point to? If not, do you think this is a bad idea or can you see this having merit in some cases?

sova-soars-the-sora 2021-06-21T16:59:13.497100Z

@tonsky has a great write-up about how you can use differential updates from the db to the client application, for web development, that i would recommend. it might unravel some questions you have. https://tonsky.me/blog/the-web-after-tomorrow/

🙏 1
pithyless 2021-06-22T05:53:43.497800Z

Another term floating around in this space is "differential dataflow": https://www.nikolasgoebel.com/2018/09/13/incremental-datalog.html

🙏 1
dgb23 2021-06-22T13:09:45.498700Z

ok goes much more in the direction of what my initial intuition was! thank you for pointing out those resources and tips

Thomas Moerman 2021-06-25T12:59:11.009600Z

Smells like a rules engine, at first sight.

Thomas Moerman 2021-06-25T13:01:18.009800Z

Suggesting an action when some pattern ( eg user events) arises can be modeled with a rules engine. In clj there are a few options: clara and o'doyle. The theory behind is the Rete Network. Not sure if this is what you are looking for though, kinda winging it here ;-)

dgb23 2021-06-25T13:29:15.010Z

@thomasmoerman Ty! from your suggestion I came across this blog post that attempts something with SQL: https://medium.com/@siddhesh.jog/an-sql-based-rule-engine-6a187e2d88d8 What I’m seeing here is that relational logic alone is not expressive enough for this. You’d always need some mechanism on the outside (like stored procedures) or a completely different paradigm like you are suggesting. Event Sourcing as suggested above implies that some arbitrary code is run to build up the state (or the query model). The problem is that my idea is just some intuition/curiosity. I don’t have a particular problem to solve. I’ll leave it at the back of my head and dig deeper into your and the other suggestions.

p-himik 2021-06-20T11:38:36.494600Z

I feel like it would be easier to understand if you gave an example, maybe in pseudo-code. I might be simply not in the know enough for me to recognize what you mean, but right now the question sounds to me as "what do you call a function that gets a bunch of numbers and returns another number".

😄 1
dgb23 2021-06-20T12:00:47.494900Z

When I reread the comment I realised that this was the case, sorry. I think I have to do an actual example and play around with it to understand what I’m trying to do exactly (which is what I’m doing today). Its way too vague right now!

respatialized 2021-06-20T13:47:59.495500Z

What you're describing sounds like it's somewhere in the space between "event sourcing" and "event driven" in terms of its approach to application state: https://martinfowler.com/articles/201701-event-driven.html

👍 1