HNHacker News
TopNewBestAskShowJobs

daliwali

653 karma · joined June 6, 2012

sperging out online

https://daliwali.neocities.org

submissionscomments
daliwali··on Ask HN: Why is it so hard to get rid of passwords?
Any sort of public/private key would be pretty secure but humans would not be able to memorize them. And there's the usability problems for normal people, i.e. not knowing when to disclose public vs private key, generating them, keeping them secret, etc.
daliwali··on The problem with MongoDB
I don't think that this is the solution to MongoDB problems mostly because they're unsolvable. Here's why:

- 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.

daliwali··on React Tetris
If this were a student project or an intellectual exercise to implement Tetris in an obscure language, good on them. I can respect that.

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.

daliwali··on React Tetris
>If you just want to come here and fart on people for not always being 100% focused on the market... why?

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.

daliwali··on More than one million requests per second in Node.js
It has a mostly-compatible API but strict conformance doesn't seem to be the goal here. If your application does not make use of obscure features provided by core http (it could probably be refactored to do without anyways), then it's a free boost in performance.
daliwali··on React Tetris
Cool, we have the technology and know-how to replicate a 1984 video game using the hottest JS framework.

Does no one care what is the result as long as the developer put the "right" abstractions in making it?

daliwali··on How to avoid rewriting your JavaScript application
State change, eh? There's this, which diffs only local updates and doesn't use a vDOM: http://simulacra.js.org/

Disclosure: I'm the author.

daliwali··on How to avoid rewriting your JavaScript application
The end user doesn't know or care about implementation details. It's bikeshedding that nobody cares about except the developers themselves. Facebook could have built their web app with Angular or Ember or whatever and nobody would give a shit except developers. Even as a developer I don't give a shit about what framework a web app I'm using is made with as long as it works (if it's horribly broken then I know what to avoid).
daliwali··on How to avoid rewriting your JavaScript application
I think you just described one way of updating things on a web page. The paradigm which React uses is popular in this moment, but there are many other ways to update things on a web page. It does not actually do anything that couldn't be done before, or with other frameworks or libraries.
daliwali··on How to avoid rewriting your JavaScript application
The article opens with:

>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.

daliwali··on Show HN: Tesseract.js – Pure JavaScript OCR for 60 Languages
The title and description are very misleading: this is technically "pure JavaScript" but the JS is compiled from the original C++ library of the same name using emscripten. I think "pure JS" would imply that all of its sources are written in JS which is not the case here. It's mostly the C++ code doing the actual work, with a little JS wrapper on top.
daliwali··on Microsoft REST API Guidelines
I don't know why everyone wants to downvote this comment. It's absolutely right.

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

daliwali··on React: Mixins Considered Harmful
Yes, but why is the question. I think that is seriously not given much thought and people just accept man-made complexity as essential. It seems tautological to say that higher order components extend components, but it is only due to the design decisions of the React authors that application code must fit its own paradigm, not the other way around.
daliwali··on React: Mixins Considered Harmful
>“How do you parameterize Y by X?” “Create a function that takes X and returns Y.” Doesn’t really seem React-specific.

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?

daliwali··on React: Mixins Considered Harmful
>Higher-order functions are extremely common and useful in all functional languages.

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.

daliwali··on React: Mixins Considered Harmful
A corollary to what I'm saying is that the design patterns that are espoused by React authors can be eliminated by using another abstraction, they're specific to React and have nothing to do with programming in general. I wouldn't go so far as to say, never use mixins in JavaScript, for example.

>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.

daliwali··on React: Mixins Considered Harmful
It doesn't fare well that a framework that is only 3 years old already has an extensive list of anti-patterns and tons of statements on what not to do. Also having to do manual performance optimizations using the framework is a hassle to application developers and can be a major pitfall (ex. PureRenderMixin, shouldComponentUpdate).
daliwali··on Super Tiny Compiler
It's worth pointing out that Lisp is homoiconic, meaning that the code you see has the same structure as its AST, so writing a parser for a Lisp is pretty trivial and is part of the reason why this compiler looks super short. Other languages like C, however...

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).

daliwali··on Lell.js – FRP, State Model, No Boilerplate, Built on Rx
Actually it's quite faster to call the DOM API directly, even if the VDOM abstraction is very sophisticated it's still overhead. Facebook has convinced people that it's a necessary evil when it's not.

It doesn't even make sense to standardize VDOM since it's just an implementation detail.

daliwali··on Lell.js – FRP, State Model, No Boilerplate, Built on Rx
Am I the only one who couldn't connect this to "making things move in a web browser" for a minute? It wasn't until I saw the pseudo-HTML (JSX) code that it clicked. Even the headline is full of jargon.

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.

daliwali··on Xto6 modernizes your JavaScript code
Recently I've rewritten ES6 code to ES5, and have measured performance gains in doing so, not orders of magnitude faster but overall just a bit faster at everything. I think that even CoffeeScript does a better job at being succinct, and it transpiles to pretty fast ES5 code.
daliwali··on Xto6 modernizes your JavaScript code
I think this is incorrect, some features are by definition slower. Take for example the iterable protocol, it will always be slower than a traditional for loop [1] because the spec mandates a prototype lookup and function call [2].

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...

daliwali··on Xto6 modernizes your JavaScript code
Most ES6 features are either equal to or worse than their ES5 counterparts in terms of performance, some by orders of magnitude (!)

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

daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
>It does require the structure of the HTML to be very similar to the object

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.

daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
when installing modules from npm, it's customary to use commonjs and `require` them. or you could simply download the built version, include it as a script tag and use the global `window.simulacra`. I have yet to build a complex app using my own lib, but it's one of the main reasons why I wrote it.
daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
someone posted a similar criticism on reddit: https://www.reddit.com/r/javascript/comments/3tqw5l/simulacr...

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.

daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
I added a benchmark folder: https://github.com/0x8890/simulacra/tree/master/benchmark

cheers!

daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
I agree that it would be more informative to stress-test using a more real-world use case, I was just in a hurry and used the render benchmark from Mithril.js.

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.

daliwali··on Show HN: Simulacra.js – one-way data binding for web applications
author here - getting iteration and nesting to work was the hardest part, and I don't think the basic example on the homepage illustrates this too well.

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).

daliwali··on Ridiculously Simple React.js Forms – Without Flux, ES6, JSX, Libraries
All of the examples past the first one are broken in Firefox. Also this seems like overkill, why introduce React when you could do the same thing with just the DOM API, with less overhead? And you get to learn about the underlying standard instead of vendor lock-in library. 177 lines for rather trivial DOM manipulation is too much.
← PreviousPage 7 of 8Next →