Hacker News new | comments | show | ask | jobs | submit login
Building modular applications with Riot.js, the 1kb MVP library (moot.it)
31 points by tipiirai 1377 days ago | hide | past | web | 19 comments | favorite

Riot.js has a big advantage, being very tiny and fast, unlike any other bloated MV* solutions. In fact, everything you need is included in pure JavaScript + a little of glue code which this library provides. Moot proves that there is no need for overcomplicated large frameworks to make a fully featured web app. Speed is the king. That is why I think this microlibrary approach has a future.

Until you application is tens or hundreds of thousands lines of JavaScript.

And when you have gone and reimplemented every single operation from some "bloated" library.

Then you will be enlightened.

Wrong. Please read the docs.

What a great response from the developer.

I was already leaning towards 'no' regarding the project, but this has sealed the deal.

I have, what am I missing?

The demo application https://moot.it/riotjs/demo/ uses Riot and jQuery only and it has all the major features of a single page application. What operations are you talking about? What additional benefit the current frameworks offer?

Here's the older post about riot.js: https://news.ycombinator.com/item?id=6653024

Yes, but most of comments under that post are irrelevant since Riot.js no longer depends on jQuery.

Is that why there's a whole section in the linked article talking about jQuery and how great it is and how it works really great with Riot.js?

And, sure, you can use something lighter-weight than the full ca. 100Kb jQuery reference implementation, but "1Kb MVP framework", while it sounds awfully nifty, still lacks something in basic honesty by comparison with "1Kb MVP framework, oh, and you have to write a ton of jQuery glue to make anything work with it."

[Edit: Don't believe me? Take a look at the Riot.js TodoMVC example[1]. This isn't a framework; this is jQuery with extra hair.]

[1] https://github.com/moot/riotjs/blob/master/todomvc/

There is nothing wrong in using jQuery if you wish, but you can get rid of it as well and just use document.querySelector() and el.addEventListener(). Riot.js is standalone.

Great, so I can write a bunch of document.querySelector() and el.addEventListener() glue instead. That's a real improvement.

I like jQuery. Which library do you prefer for DOM manipulation?

I don't have anything against jQuery per se, but part of the idea behind a client-side framework, or so at least I had gathered in my usual imperfect fashion, was to relieve the developer of the need for a bunch of hand-written DOM-fiddling code, by both attending flawlessly to the common cases and giving the developer flexibility enough to handle the rest as and when it's necessary to do so.

That's the point I'm making: I prefer, inasmuch as possible, not to do manual DOM manipulation at all, which renders your question somewhat moot.

Perhaps it's different for someone who hasn't written that kind of code enough times to grow thoroughly tired of it, but I have written it that many times, and I am therefore very much open to the suggestion that there's value in a framework which handles the great bulk of such cases automatically, and in so doing gives me more time and effort to spend on whatever project I'm actually working on. Angular, in particular, I've found to be quite good for this; Riot.js, on the other hand, not only doesn't bother with it at all, but takes what I consider to be an unduly snobbish attitude toward the whole concept.

For a tiny chat app that's designed to be embedded in third-party pages, I can see some sense in taking the lightweight microframework-style approach. But when its developer and its devotees promulgate it as the prescription for every problem, while denigrating much more capable and general-purpose solutions as "bloated" and casting veiled aspersions upon the competence of the developers who employ them? That's a real problem, and I strongly misdoubt I am the only one to think so.

No doubt Riot.js is quite useful in a specific subset of cases, albeit only those closely similar to the one in which it found its origin. But this sort of behavior, on the part of those who already have a stake in it, can only make it less likely that anyone who doesn't have a stake will decide they want one.

Certainly it's had that effect on me! -- I was quite interested in Riot.js when it first appeared on HN a few months ago, but that initial interest quickly cooled when I saw how the developer behaves toward his critics. The choice to use any framework, but especially any of the relatively new Javascript ones, implies almost of necessity that the developer so choosing must participate in the community around that framework -- and a community led by someone, who behaves as I've seen the Riot.js developer do, is no community in which I desire to take part. Of course it is that developer's prerogative to behave as he does -- but it is equally the prerogative of anyone else to decide that interacting with someone, who has such an unpleasant attitude toward anyone not unreservedly laudatory of his work, is best avoided.

That's precisely the decision I made upon reviewing the original Riot.js thread on HN, and this latest article from the Riot.js developer, in which he arguably outright lies both about the drawbacks of his competition and the benefits of his own entry in the great framework shootout, only reinforces that decision -- and, again, I much misdoubt I'm the only one.

Hey! I'm the annoying developer :) I'm sorry if I came out in a bad way. It's not my intention to be harsh and I'm trying to be open to the critics. It's just a damn hard to point out that the current frameworks are mostly unnecessary and you can make large scale apps with Riot that only has 3 extra methods. It can totally understand that people don't take it easily. And it's especially hard if you are already using a certain framework and feeling good with it.

I can see from your comment that you are biased towards MVVP and Angular in particular. You prefer to express the logic in the HTML template and use two-way data binding and avoid using jQuery (Official Angular suggestion). It's a very different approach and you cannot really compare Riot and Angular directly. It's a much broader comparison between MVP and MVVM patterns. A massive topic.

I strongly think that MVP scales much better than MVVP and is better for bigger applications/teams. It's easier structure the codebase in modular fashion. Riot documentation focuses solely on this topic. Moot is not a "tiny chat app", it has pretty vast feature set and the code is split into 50 different files. MVP definitely scales.

I honestly first read this as "1kb Minimum Viable Product library", which would admittedly be kinda cool.

A list of guidelines and short advice to build a Minimum Viable Product could certainly fit in 1kb of plaintext, but like all JS microlibraries, most of the hard work would be left to the user.

Hmm... now, I'm curious about using this with React for super responsive UI's with decent separation of concerns. I might have a play and see how they go together.

The semicolons are still randomly used.

The demo application has several scripts after /body. `navi` should be `nav`.

> Pure HTML is cleaner and passes W3C validator.

The demo does not pass the W3C validator.

The demo now passes W3C validator. Thanks!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact