653 karma · joined June 6, 2012
https://daliwali.neocities.org
- When you update across multiple documents, you're not guaranteed that they all succeed or fail. This is why embedded documents is more consistent but less flexible: single document updates are atomic.
- When you make queries on multiple documents that depend on the previous query, the running query could be affected by updates that happen in between, otherwise known as lacking serializability. Again, this can be fixed by embedding documents.
- When you delete a document, there may be broken references to the deleted document. Unless you have denormalized the references to the deleted document, you must query the entire database to remove broken references.
If you go so far to emulate a relational database, you might as well just use one.
However it is undeniable that there are overkill levels of abstractions in play here, for the purpose of using what is currently the most commercially viable web framework. This is like taking FizzBuzz Enterprise Edition seriously for being written in Java.
>just someone having emotional meltdown and taking it on the random people around
I won't stoop down to your level of using personal attacks. You don't know me.
We are posting on a website run by a venture capital firm, maybe you can explain why the market is not relevant here.
As far as education goes, it's about learning how to use a particular framework, which is highly temporal knowledge and makes use of mostly crystallized intelligence. It's problematic and largely inefficient that most web developers jump from framework to framework as the market dictates. There is an endless cycle of learning mostly temporal knowledge that's discarded as soon as the next framework comes.
People talk of fundamental CS skills, but in reality it's almost never needed in web development, where there's frameworks that abstract everything away. A tetris clone in vanilla JS would perform much better, and the code would be more directly relevant to the application, but rarely is anyone hired to do just that. It serves business interests more to have developers who are conventional, easily replaceable cogs in a machine.
Does no one care what is the result as long as the developer put the "right" abstractions in making it?
Disclosure: I'm the author.
>Frameworks, libraries, package managers, guidelines… even languages and meta-languages themselves are changing so fast that there's little to no chance a common or standard way of building applications emerges.
...and then gives an example using React, JSX, and ES6 modules. This is just my opinion but I think React + JSX will look about as antiquated and irrelevant as jQuery in less time than it took jQuery to lose favor among web developers, rendering the argument for longetivity moot.
At least jQuery solved the practical problem of non-standard JS/DOM implementations, but now browser vendors have finally made basic things work among each other, making it irrelevant in most modern browsers. React solves what? Encapsulation? There's Web Components v1 right around the corner, and dozens of competing frameworks that may take its place as the most hyped framework.
I would add that REST has nothing to do with pretty URIs, JSON formatting, versioning, query strings, and more misconceptions that people seem to mistake for the architectural style. There is nothing that isn't RESTful with URIs like "/a89f30e9" instead of "/:type/:id". Even TBL thinks URIs should be opaque: https://www.w3.org/DesignIssues/Axioms.html#opaque
I'm not talking about the what, but why would anyone think of using higher order functions to build user interfaces in the first place. It complicates the use case: building and mutating DOM Nodes.
>I think the opposite is true. The abstractions are more powerful when they afford building higher level abstractions on top of them.
And what may I ask requires so much power for building web front-ends?
Yes but higher order components as you call them, seem to be an abstraction that you would only use because the base unit of organization is a React component. I'm of the opinion that design patterns emerge due to deficiencies in the language or abstraction level, and that they can be avoided.
>You don’t “have to” do those optimizations.
Sure, but it seems to be a trade off of complexity for user experience. It's just covering up a leaky abstraction.
The "code generator" part of this compiler doesn't do much, since it only translates from one high level language to another, not machine code which would understandably be far more complicated, as other commenters have pointed out.
This is a compiler from an altitude of 50km in the stratosphere, and won't actually teach you much about real world compilers that do so much more under the hood. Sorry to be Mr. Cranky HN commenter (ok, I'm not sorry).
It doesn't even make sense to standardize VDOM since it's just an implementation detail.
Seems that everyone is busy coming up with convoluted ways to do the same old thing (manipulating the DOM). When I look at early jQuery era front-end code, it's quite easy to follow what's going on. The language (ES3) was simpler, and the competing libraries at the time provided thin abstractions on top of the DOM API.
The DOM was more or less complete when DOM Level 3 was specified in 2004. How much of the front-end code being written now, will be able to be easily understood and maintained in ten years time, after the trendy fads have come and gone? Maybe that question is irrelevant since most business fail within that timeframe, but for posterity's sake, I'd like to look back and learn what went well and what went horribly wrong.
So far the only features that are actually fast are generators and the new data types (Map, Set, et al).
[1] https://jsperf.com/for-vs-for-of/2
[2] https://developer.mozilla.org/en/docs/Web/JavaScript/Referen...
For example, `class` has particularly bad performance characteristics because under the hood it has to set an object's prototype on the fly (at least this is how Babel implements it) [1] and `super` is also slow due to prototype lookup [2].
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[2] https://jsperf.com/es6-classes-super-es5-vs-transpiled/2
that's true, the basic nesting of objects has to be preserved in the html but i don't know how it could be possible otherwise. it just wouldn't make sense to bind a nested key to a dom node contained in an ancestor object but not itself.
it may have been a poor choice to use class names in the example, but I just wanted to demonstrate that the library is not coupled to a certain way of selecting dom nodes. it's entirely possible to use $('[data-binding="my-thing"]'), but not necessary at all.
cheers!
however I think that any benchmark may be skewed to favor a particular implementation. for example, Simulacra.js doesn't batch updates and render asynchronously, it's purely synchronous, so one could set up an artificial benchmark to thrash the DOM by setting different values over and over again in the same tick.
also I haven't yet committed the benchmark I used in git, will do later so that people can reproduce it.
the way it works is that every value gets cast into an array for rendering purposes if it isn't already. so in case of an array of objects, you don't need to explicitly define that you expect an array, it'll just render `n` objects with nested bindings.
to give an example, on the homepage there's an array that is rendered, `["Tall", "Grande", "Venti"]`. if a new array is set, for example, `["Tall", "Grande"]` (without "Venti"), it will re-render based on if the values at the indices changed, so in this case it would just remove the dom node for "Venti".
another cool thing is that with the mount function, you can either return nothing so that the node that was specified will be appended, or return a completely different node based on the value, which enables heterogeneous elements in a list. the mount function also gives you an opportunity to mutate a node in other ways than just setting the text/value/checked/whatever, such as setting a classname i.e. `node.className = "fa fa-hourglass"`. then there's the unmount function but 99% of the time won't be needed because dom nodes that aren't in the live tree and don't have a reference will just get GC'd.
it should be entirely possible to build a web app with Simulacra.js using a single bound object, a single template, and describing all possible bindings in one go. it's up to the developer to add whatever convoluted architectures are hip at the moment (stores, reducers, actions, what have you).