Data-Driven Development Is a Lie
grishaev.me
grishaev.me
I think this needs to be emphasized and can easily be transferred to a whole bunch of other topics unrelated to DDD/Clojure.
Nobody ever talks about the negative sides of some new apparently cool thing, because it is assumed that doing so wouldn't attract an audience. While in reality, often cool new thing does only work as advertised in a minority of cases and the negative sides are more important to look at.
We should more often talk about the negative sides of "cool" new approaches.
APIs kept breaking, nobody knew what data was passed around, strings instead of ints etc.
Thanks, I hate it.
Whether that's a benefit or a liability is in the eye of the beholder...
---
I see DDD as a counter movement to OOP: expose your fields, don't bake behaviors into your data structures, and accept primitive types instead of instances of the internal class MyData.
To me it doesn't imply "convert your code into data", which seems to be OPs only gripe with it.
Most of the comments are either confusing data-driven development (which is possibly bad) for data-oriented design (which is good) and wondering what the author's issue is with the latter; asking or helping to define what data-driven development is; griping that "DDD" is a reserved term; or some combination of those!
I've basically sworn to never do it again.
I didn't know that I was doing "DDD", though. I was just trying to make it easier to make changes that I knew were common.
I swore it off years ago, right before my boss did exactly the same thing for a new system. sigh
Now, Co-pilot can write that glue code in a heartbeat, so it makes even less sense to try to write something like that in the future.
I've written conditional logic trees like this and they're pretty much always better than some hardcoded OOP/imperative code. I think what the author might have missed is that the conditions are labels for some functional result, usually from SQL as the app checks various fields on the user's database tables. So DDD doesn't actually work with data, but filters on data. The labels are to make the intermediate steps readable by humans, like how Prolog rules/predicates work.
In other words, I don't think that the article has said anything, because functional code can always be transformed to look like functions acting on conditions or conditions resulting from functions. At the end of the day, functional code is still a query composed of queries. The important part is to avoid mutable state, which would turn it back into imperative code which is hard to step through and reason about.
The idea is that if you just use dictionaries for objects instead of traditional, statically typed, classes, you get all of the dictionary APIs for free, so you can easily iterate over the keys, add more keys to the object as you're processing it (as opposed to defining a Foo class and a FooBuilder class, or similar), etc.
The pros and cons are obvious if you've worked in dynamically typed and statically typed languages.
That's not quite what this article is arguing against. This article is more arguing against a functional programming pattern, IMO.
I say this even though I don’t usually code this way: I think the big benefit for business code is sort of a constrained flexibility.
Objects tend to get really big (the alternative is you have a ton of classes). Think about all the data that makes up one Uber ride. So if I want to do anything with a Ride, I need everything. An even the many classes thing doesn’t really solve that because maybe what I want is cross-cutting. So either way, I just end up having to supply a bunch of stuff I don’t need.
The maps-first approach is more incremental. Every function takes what it needs and gives what it can.
Most architects would assign the DDD acronym to Domain-Driven Design.
</pedantic-rant>
Data DD
- Account.Insert
or
- Account.Create
Domain DD
- Account.Open
The former is a data store activity and the latter is a business activity.
Would software architects be aware of all the various paradigms applicable within a particular language? Much like me trying to pick the right tool to complete a particular project...
https://en.wikipedia.org/wiki/Programming_paradigm
is there a good reason why Domain-Driven Design is not linked in the article above, or just an oversight?
So just to spell it out: Domain-driven design (nor Data-driven development per the article title, nor Data-driven design) aren't programming paradigms, they are software design approaches.
Whereas Data-driven programming, as linked from the above wikipedia is infact a paradigm and something else entirely. Alright.
They have 'Data-oriented' listed in the wikipedia paradigm article, but it links to 'Data-oriented design' which is clarified as a software design paradigm, as distinct from a programming paradigm.
Also I assume that the author is equating DDD with Data-Oriented Programming. Here's a good book on the topic: https://www.manning.com/books/data-oriented-programming?ar=t...
One thing I don't love about the book though is that it tries to demonstrate how to do DOP with Object-Oriented languages, which looks to be difficult to accomplish
[0]: Or in earlier times for the Data-Display Debugger.
[0] https://nitter.net/sarahmei/status/1073234104311734273#m
The lines get blurry in Lisp, since the code is explicitly encoded as a data structure (tree).
But you know what I can do, in a day...
Take a rule, written as a function in C#, compile it to an assembly, save it in a database with a name and checksum, and then dynamically load it later when I want to execute it.
ta daaaaaa..... :-)
That way I can display the original rule as text to a user and let them modify it.
ta daaaaaa...
For example, in the case of an expert system, the data provides the specific facts of the domain and the logic is implemented by the program. In choosing to use an existing expert system engine, you have made a decision about how your system will go about achieving your goals, and that places significant constraints on how you should represent your data.
A complaint was that the data-driven development approach created a _poor_ DSL and then a non-DDD solution didn’t use a DSL at all…
What would a solution using a good DSL look like, and how would it differ from the DDD-based approach?
Serendipitous in some sort of a backwards-way that I have personally already gone that way ~a decade ago, with even func/interface-first, and the first example I found is https://github.com/drbig/ricons/blob/master/ricons.go#L57-L5... (it's an example, sorry).
As usual the devil is in the balancing, as in most languages functions won't be data but code. Unless Lisp (...that statement is superficial; homoiconicity is the word).
The point is that my opinion is that `declarative` is pretty neat and powerful. Easy? Maybe, but not really.
I understood the Data Orientation of Clojure as building mostly map-shaped, atom-wrapped representation of application state, and then functions and procedures that operate and transact on that state.
The ref to the data being the "backbone" of the application (so data oriented). Is this incorrect?
It seems to me like he's actually criticising the "data programmable engine" (I just finished Joy of Clojure where they describe it) where you feed data to a function to change it's behaviour (as opposed to example passing in a function?)
I am genuinely asking.
I would agree if so with the caveats that it's all fine unless the host language lacks a lot of semantic features that the DSL will add.
Then again, I don't understand the blog post. Is it about programmable programming language?
For me, "data-driven" approximately means "Something coaxed into a ~3NF/BCNF schema that the business stakeholders can simultaneously understand".
In my mind, this term doesn't imply any specific language or database technology. What it strongly implies to me is a certain modeling and normalization of the domain such that any reasonable business requirement can be realized within a ~constant cost factor.
Even apart from Clojure and so-called "DDD," there was a kind-of-recent push toward making your application logic as "declarative" as possible. Following that strategy would enable some compelling benefits, mostly related to scaling, but also enabling "self-service" for savvy application users.
Just stop being dogmatic and choose the right tool for the job.
> "Show me your [code] and conceal your [data structures], and I shall continue to be mystified. Show me your [data structures], and I won't usually need your [code]; it'll be obvious.''
as DDD.
Also my comment was probably incomplete in context... as in how perfectly fine piece of advice could have been abbreviated, misunderstood and became a cult.
He wanted to write a book about Clojure, but the publisher said that there was too little interest. So he "tricked the readership into reading a book which is about Clojure without saying that it is about Clojure". I'm paraphrasing, but that is the genuine gist of what he said (much to the non-amusement of the interviewer who must have felt deceived as well).
Source: https://changelog.com/podcast/522
I even read this stupid book because there was a hype at work and it is so full of strawman arguments it made me furious.