4 ms·
To expand on Yuri's comment: the standard view of databases, with mutable data, is flawed in the same way that mutable data structures are flawed in programming
by gcv 13y ago
To expand on Yuri's comment: the standard view of databases, with mutable data, is flawed in the same way that mutable data structures are flawed in programming. Mutable state makes reasoning about program behavior more difficult than necessary. Datomic applies the same concept to databases — modifying a record no longer clobbers the previously-recorded information. This is a great safety feature, aside from its applicability to any auditing or reporting requirements.
- adambard 13y agoMutable data structures are a much more accurate abstraction when it comes to how computers actually store data in memory and on disc -- I don't think you can reasonably call them "flawed." A (properly-implemented) mutable memory structure will have better performance characteristics by definition. Don't get me wrong, I like immutable data and I use it over mutable whenever possible (Clojure is my favorite language), but to call it "flawed" is an overreach at best.
- YuriNiyazov 13y agoMutable data structures are a very accurate abstraction of how computers work. They are a very inaccurate abstraction of how the world works. At any given instant, the world is constant; time moves forward, and changing the world as it was 1 second ago is not possible. Insofar as most of business programming is trying to efficiently give answers about the state of the world at various points in time, I would agree with gcv that "flawed" is the appropriate term to use for mutable data structures.
- nnq 13y ago> They are a very inaccurate abstraction of how the world works. No, they are only inaccurate software abstractions of the business abstractions they are supposed to model. People like immutability and reversibility of concepts and that's why they try to apply it in business, law, finance etc. But the real/natural world, at least from our subjective perspective is not like that. Things in the world are not practically reversible or immutable - you cannot "restore" a deadbody. The real world is loosy and mutable, at least from an agent's perspective. The human brain is so efficient at what it does simply because it just "throws way* (irreversibly!) so much information every second, filtering for just what it needs. A small corner of the world is our "business/finance world" and using immutability and reversibility is great here, but there's way more to computing than implementing business/finances logic and processes in software!. ...if you think about it, classical OOP is inspired from cellular biology (can't find the reference now, some musing of Alan Kay I think...), so it's no wonder why it's such a trouble maker when used to model business logic, it was the wrong tool for the job from the get go. But generalizing that mutable data structures are a bad tool to model and understand the world in general is waaaay overstretched, the world is bigger than "business", and all modeling approaches are equally useful.
- gcv 13y agoUnless I'm missing the point of your argument, it sounds like you're saying that, e.g., computational biology does not benefit from representation as immutable data structures. Although I have no experience writing software for modeling cell or biological entity behavior, I strongly suspect that reasoning about the simulation itself by representing its states through immutable data structures, or immutable databases, will lend itself to a better piece of simulation software. If you think I'm wrong about this, I'd appreciate some examples.
- weavejester 13y agoMutability is change without chronology, which isn't the way the real world works. Immutability over time is a more accurate abstraction of physical processes, particularly when you get into smaller time increments and services distributed over larger distances. Mutability is useful as an optimisation, but I don't think it has much worth as a model.
- chongli 13y ago>The real world is loosy and mutable, at least from an agent's perspective. No, it's not. You cannot mutate any fact! You will never be able to change the fact that Hitler existed, for example. Facts never change. This is the purpose of Datomic: to store facts. Mutable databases only seem to be interested in maintaining the most recent fact about any particular piece of information.
- bct 13y agoYour comment is not a response to the comment you replied to. In particular, it was quite clear about the flaw in question: > Mutable state makes reasoning about program behavior more difficult than necessary. You could dispute that claim, but bringing up performance characteristics is totally irrelevant to it.
- sultezdukes 13y agoMutable data structures are a much more accurate abstraction when it comes to how computers actually store data in memory and on disc Yet programming in imperative, mutating, mainstream languages is nothing like how code works at the machine level. I understand you're talking about data, but I think the analogy still stands. Or maybe a better one is that a file system or even a database itself is an abstraction of how data is stored on disc.