The lack of code or documentation means it's very hard to take your comments seriously. But please correct me if I'm mistaken.
The lack of code or documentation means it's very hard to take your comments seriously. But please correct me if I'm mistaken.
After the talk, I was left with many unclear messages, lots of promises, few detailed explanations, IMVHO many flawed statements, and only one clear outcome: gun is a "script" (I wouldn't call it database) that offers "conflict resolution" based on data's lexicographical order (!!!).
I just probably understood everything wrong, or I'm simply inexperienced enough to appreciate gun. My apologies in advance.
One minor detail - while lexical sort is used in the conflict resolution algorithm it is only part of the equation (see https://github.com/amark/gun/wiki/Conflict-Resolution-with-G... ). As I mentioned in my talk, lexical ordering is intentionally naive because I rely upon deterministic behavior (not PAXOS, RAFT, consensus, or gossip protocols) which guarantees convergence.
But the way, why do you easily discard consensus protocols and rather rely on conflict resolution?
-------
I dislike consensus protocols because they are difficult to scale. Deterministic algorithms however are not. Why? Consensus requires communication, and communication takes time. As you add more peers, you then have to do more communication in order to maintain consensus. But as more communication occurs, things bottleneck and get even slower. However some problems require consensus (like finances, traditionally) and therefore GUN would not be a good choice.
Deterministic algorithms only need the same inputs and they then spit out the same output as any other machine (running that algorithm) anywhere in the universe. This is why "immutable data structures" are all the rage lately. This is incredibly scalable because as long as the inputs are received (which might have been sent slowly over the network) then all the databases will converge to the same result (for the same inputs) regardless of whatever current state those databases might be in. And because a database maintains state, this type of guarantee is really important for databases.
WARNING NOTE: Missing input causes the databases to be temporarily out of sync because their inputs are different, however when the inputs are finally received (via retries or what not) the databases will sync up regardless of the ordering. Making sure the inputs can be sent in any order or retried is the idea of idempotency and is explored more with CRDTs and commutativity. This means GUN is "Eventually Consistent" and not Strongly Consistent, so don't use GUN in those scenarios.
1) You assume that you have to have lots of code in order to solve hard problems. If that is your approach to code then I cannot appease you. GUN takes the UNIX/NodeJS philosophy - it is suppose to do one thing well and everything else is solved via extensions and plugins. What GUN focuses on is conflict resolution which you can see demos and learn more about here: https://youtu.be/-i-11T5ZI9o , https://github.com/amark/gun/wiki/Conflict-Resolution-with-G... , and towards the end of this tech talk https://youtu.be/kzrmAdBAnn4 .
2) I'm sorry you think my javascript is shoddy, however this is either a matter of arbitrary aesthetic opinion or some objective measure. You provide no objective measure. I'll propose one instead - does it work? And it does, however I'll be the first to admit it is not free of bugs. We're actually dealing with some bad bugs that emerge when you do more complicated permutations of commands, to which we're in the middle of a big rewrite. I hope you'll find the new version (0.3.x, not out yet) as less shoddy. However apart from subjective aesthetics, I don't find your comment to have any justification.
3) What do you mean that we have scratch test data in there intermingled with the main code? I don't think this is true, but I'm not sure what you mean. If you think this is an issue it would be great if you raised an issue on the project. Thanks in advance. :)
Please let me know if you've actually read through the entire wiki ( https://github.com/amark/gun/wiki ) and if there is anything you need to learn more about (which I'm sure there is) please don't hesitate to ask me and I'd be happy to write documentation on it. In fact, we need people like you to report what parts of the documentation are confusing or incomplete in order for us to know to fill it in.
Thanks for your comments, and please don't take me harshly - I just want to be hard on dispelling the terrible assumption that lines of code equates to quality or problem solving. Often times more lines just creates more bloat, monolithism, and increased bug complexity.
It doesn't matter if your ideas are great. You keep putting Gun forward as a kind of shiny, superior successor to Riak, Cassandra and CouchDB, which I'm afraid only makes you look foolish.
You seem to have done the branding before you did the code. First you need to demonstrate solid, mature code. Then you can try competing with the big boys.
A detailed critique of your code would take a lot of effort, but I've made some notes [1]. I find the code to be unreadable and full of bad code smell. With all the mutation and callbacks and events and what not going on, it's just too hard to tell how the code is intended to flow. I don't see a clean API, even an internal one, nor I see a clean structure. It needs a lot of cleanup [2].
When talking about code, it's rarely just aesthetic. My philosophy is that if one can't even manage the trivially superficial aspects of code (formatting, structuring files, naming variables, and so on), it's not worth talking about its inner workings.
Sorry if this comes across as terribly harsh, but I hope you can see I'm trying to be constructive.
---
[1] A few examples:
* Your code is littered with arbitrary console.log() statements that have no actual utility. They look the kind of temporary logging I insert whenever I need to trace a difficult behaviour.
* No code is documented, aside from childish comments like:
} // IT WORKS!!!!!!
* Lots of what looks like global state.* Lots of anonymously named variables like r, u, n.
* Big chunks of commented-out code (e.g., in radix.js).
* Lots of what looks like test data. Are you telling me this is part of the project?
rad('user/marknadal', {'#': 'asdf'});
* Lots of mutation. E.g., in s3.js you get some kind of event and then you modify the inputs.* Syntax formatting is inconsistent and shoddy.
* require() calls in the middle of code.
* You have a test folder, but it's barely got any actual tests. You do have at least one commented-out test in the middle of everything (list.js, line 25).
[2] You may want to look into replacing callbacks with promises, and restructure it using more classical ES6-based OO, as opposed to the prototype-based, lexically-scoped style you're using now.
Claim 1. That gun is realtime. Claim 2. That gun is offline-first. Claim 3. That gun is a graph database. Claim 4. That gun is decentralized.
I then linked to the follow 1min video ( https://youtu.be/-i-11T5ZI9o ) to back up my claims 1&2&3. Either I am cheating/lying in the video, or gun does as I claim. Which is true?
Then, after whether the above has been verified we can move onto the next issues (which you addressed, but ignored the earlier). Next up, I would agree that GUN is not production ready and therefore wouldn't be appropriate to stack up against Riak, Cassandra, and CouchDB. I will agree with you there. But this is merely a matter of time (we're already working on a battle suite test, hopefully getting Jepsen set up, etc.) and unfortunately it is important to do evangelism while you are developing a system so you can have beta testers. We need that. So please help out! Find bugs and problems, report them. :)
Third, regarding code I don't think we'll be able to find common ground (other than the fact that we are already doing a rewrite, which suggests we agree to some degree). Why? Because I'm not one of those ES6 fan-loving Promise-everything boys. I'm not sure if you are or not, but your comment seemed suggestive of that direction. This won't lead to a fruitful discussion, because it is again a subjective view of the aesthetics of code (I find single character variables as easier to logically understand and maintain, for instance. This makes most people balk, but why? Because I am not an app developer I do not know what people are going to use the data for. I'm a tool developer, which follows more the work and lines of mathematics... `x` is a variable! It could be an integer, a float, or whatever else. This again is a personal preference so please don't downvote me for my personal coding style.)
If you choose not to use GUN because you disagree with my coding style, that is your choice and saddens me. But I will be very strong: please do not use that as an excuse to dismiss my claims. My claims can be checked and verified and I have backed them up.