News for hackers. Stuff that matters.
Re:Release of Mithril 1.0 by baconomatic on Monday January 30, 2017 @03:36PM (#13524766)
Does Mithril implement something akin to Redux? Otherwise, I'd argue that those graphs related to size aren't quite correct.

Also, fetch isn't required for either React or Vue.js, could certainly just use the built XHR API to get down even further.

Re:Release of Mithril 1.0 by lhorie on Monday January 30, 2017 @04:24PM (#13525171)
> Does Mithril implement something akin to Redux

Depends on what you mean by "akin". The core of Redux is just a few lines of code with a set of very opinionated conventions surrounding it, plus a bunch of utilities that people may or may not use. Angular's services serve a similar purpose to redux, but the approach is quite different. Mithril's idiomatic approach is similar to Redux in the sense that it's largely convention-based, but it doesn't actually require any specialized code. We could talk about non-idiomatic options, but from my observations, Redux is the most popular state management convention/library set for React and vuex is to Vue what Redux is to React.

In any case, were talking about a 2kb difference, so it's not like it makes that much of a difference.

Fetch is not required by any library, but a) realistically nobody uses the XHR API directly and b) projects typically do require XHR capabilities. If we're going to be removing things, note that Mithril and Angular are modular and can also be trimmed down if the comparison criteria involves removing things like XHR. Also, if "using the built-in XHR API" means re-inventing basic things like querystring parsing, then a library starts to look a lot more appealing again, and at that point, we're back to the point that Mithril's XHR utilities are smaller than most others that have comparable feature sets (e.g. Axios, superagent).

Re:Release of Mithril 1.0 by baconomatic on Monday January 30, 2017 @04:33PM (#13525245)
I'm not expecting there to be a huge difference, but it looks silly to include non-standard features for both React and Vue.

As for performance, do you have a setup that we could see that shows how those are generated? Just genuinely curious.

Re:Release of Mithril 1.0 by lhorie on Monday January 30, 2017 @04:49PM (#13525358)
Well, maybe we just disagree on this point, but I think it makes more sense to compare apples to apples. To frame in a different way, given that Mithril isn't solely a view library, would you say it makes more sense to compare against a typical Backbone setup including dependencies like jQuery, or just compare against Marionette alone?

The performance numbers are explained in more detailed in the frameworks comparison page (they're dbmonster average render times). There are links to each implementation (they are all naive, using production-mode versions).

Re:Release of Mithril 1.0 by baconomatic on Monday January 30, 2017 @07:49PM (#13526507)
Perhaps we do disagree, that's okay! I think a fair comparison would be Mithril vs Backbone, but not necessarily with using jQuery as you could use Zepto.

I think it's really tough to do comparisons well and what it really comes down to, in my opinion, is how useful the library more so than the size and performance (within reason).

Also, my mistake on missing the links to the implementations in the comparison. Perhaps there needs to be a bit more contrast between the copy and the links?

Anyways, I've used Mithril and I think it's great, just wanted to make sure that the comparisons were fair.

Re:Release of Mithril 1.0 by dwaltrip on Monday January 30, 2017 @05:27PM (#13525664)
Is redux considered "standard" in react land? I thought a lot of projects don't make use of it.
Re:Release of Mithril 1.0 by jbucaran on Monday January 30, 2017 @11:05PM (#13527473)
Redux is an opinionated implementation of the SAM pattern for React. The same pattern can be seen in the Elm Architecture.

• http://sam.js.org

Now, I don't know how old this pattern is, or whether it was already commonplace 15 years ago. I was introduced to these ideas first through Redux, then learned Elm, the found SAM.

Re:Release of Mithril 1.0 by jdubray on Tuesday January 31, 2017 @09:30AM (#13530787)
I am the author of the SAM pattern. It is based on the semantics of the work of Dr. Leslie Lamport who got a Turing award for it (TLA+ - Temporal Logic of Actions). TLA+ was popularized by Amazon as a tool to help fix complex defects in AWS.

SAM fixes three approximations that we have been using in Software Engineering for Decades:

- actions can manipulate application state

- assignments are equivalent to mutation

- there is no need to define precisely what is a programming step (for instance when you write a = b + c, is that a step or is it 3 steps: read b,c, compute b+c, mutate the value of a)

To a certain degree, Redux and Elm are trying to address these three approximations as well, but they do it from a FP point of view, not from a TLA+ point of view.

Their definition of action aligns with the one of event and their approach to mutation is immutability. The main difference between SAM and Redux/Elm is the way side-effects are treated. SAM embraces side-effects (in particular asynch calls) while Redux/Elm don't know how to deal with them. Redux for instance breaks its principle #1 (single state tree) by introducing Sagas.

SAM is a factoring of your code that fits in one line of code: V = State(Model.present(Action(event))).then(nextAction)

No need for a nebula of libraries or inventing a whole new language.

Re:Release of Mithril 1.0 by mlsarecmg on Wednesday February 01, 2017 @03:24AM (#13539251)
Redux-thunk makes it async aware without breaking the convention.
Re:Release of Mithril 1.0 by jdubray on Tuesday January 31, 2017 @11:00AM (#13531629)
Marcus Feitoza wrote an example of the SAM pattern with mithril https://jsfiddle.net/mfeitoza/pvdLkny7/
Re:Release of Mithril 1.0 by drecdroid on Tuesday January 31, 2017 @08:21AM (#13530263)
It is not, almost everything can follow SAM patern, but Redux, as is used by everyone, doesn't follow the pattern.
Re:Release of Mithril 1.0 by jdubray on Tuesday January 31, 2017 @09:32AM (#13530810)
that is correct
Re:Release of Mithril 1.0 by baconomatic on Monday January 30, 2017 @07:34PM (#13526410)
I'd say it's a standard when you are getting into bigger applications, but the Redux docs do say that you might need it: http://redux.js.org/

So, I wouldn't consider it a standard for doing performance/size comparisons.

Re:Release of Mithril 1.0 by wishinghand on Monday January 30, 2017 @04:58PM (#13525423)
> Also, fetch isn't required for either React or Vue.js, could certainly just use the built XHR API to get down even further.

While true, Mithril does have an XHR interface built in, while Vue doesn't and I don't think React does, so it's a fair comparison to include those in the bundle.

Re:Release of Mithril 1.0 by patricius on Monday January 30, 2017 @04:38PM (#13525283)
Complete sidenote: Here is an example with something Redux-like done with Mithril:

https://github.com/lhorie/mithril.js/blob/next/examples/todo...

Re:Release of Mithril 1.0 by barneycarroll on Tuesday January 31, 2017 @08:24AM (#13530290)
There's a stream lib (not included in core, it's a separate package), which fulfils some data flow concerns. The DbMonster implementation could have used those. TBH using Redux for DbMonster is a bit besides the point of the exercise IMO.