Better HN
topnewbestaskshowjobs
Log inSign up

simplify

2,061 karma · joined May 24, 2009 (17y ago) · 911 submissions

Submissions

comment 11y ago · link · parent

Mithril is amazing. I've been using it for over a year and only like it more and more. Its fast initial load time is very relevant in today's world of mobile web apps.

comment 11y ago · link · parent

This is exactly what I thought too. From what the author described, it seems that they were just using REST incorrectly. When a view wants tags from a playlist, the solution is not to include tags in every other request. You can simply include a query parameter instead:

    GET /playlists/ID?tags=true
This lets the server knows to include the extra information for that request, keeping your original endpoint clean.

We don't know all the details, but from what the author wrote, it seems they were shortsighted to switch to a shiny new tech instead of looking for better ways to refactor what they currently had.

comment 11y ago · link · parent

How do LR(1) parsers compare to PEG?

comment 11y ago · link · parent

I find this fascinating, could you elaborate?

comment 11y ago · link · parent

Re implicit calling: what would you write if you wanted to access `foo.bar` as a function instead of calling it?

comment 11y ago · link · parent

What are the benefits of containerised apps in your case?

comment 11y ago · link · parent

For representing `if` statements in JavaScript, what was the reasoning for using a function over a ternary?

comment 11y ago · link · parent

What do you think would be a better way to enforce this separation of concerns? (genuinely curious)

comment 11y ago · link · parent

How do you verify that your mock behaves exactly as the real database? The type system certainly helps with function signatures, but what about behavior?

comment 11y ago · link · parent

When are you giving this talk? I am very interested.

comment 11y ago · link · parent

You said it: class syntax and React.createClass. In Mithril, a component is a plain JS object with two properties (controller and view).

Functional programming can mean many things, and no side-effects is one of them. However, JavaScript does not support immutable data structures very well, and React suffers by trying to force it, which results in unnecessary boilerplate code for common actions. Mithril does not enforce immutable data (though you can use something like immutable.js if you want to); it embraces JavaScript-the-language better in general.

comment 11y ago · link · parent

I tried it for a small project, but end up using Mithril.js for all my new projects instead. JSX, OOP, and Flux may be fine for some people, but I prefer to use plain, functional JavaScript.

comment 11y ago · link · parent

I feel your pain; try this starter project I created in response https://github.com/mindeavor/node-catapult . It only has three dependencies, yet it gives you a starting point to "npm install" in any direction you need (in the front end too, since browserify lets you require npm modules).

comment 11y ago · link · parent

I also had issue with the amount of setup with React, which is part of what drove me to Mithril, which has almost zero boilerplate. Nearly every line of code you write is either relevant application logic or declarative view code.

comment 11y ago · link · parent

A lot of people praise Mithril for its small file size and speed, but one of its greatest and perhaps most overlooked advantages is its small learning curve. You only really need to understand two things to get started: what a component is (a plain JS object with controller and view), and when a redraw happens (once on m.mount, and once after every event handler).

Why is a low learning curve important? Several reasons. If you're a developer, it's not a huge investment to learn (how difficult was it to learn backbone / angular / ember?). If you're a startup / company, you don't need to look for X developers, where X is a difficult-to-pick-up JavaScript framework. You also save money by having a shorter on-boarding period for those non-X developers.

I've worked in a hackathon group that picked Mithril up and created amazing results with it right away. I teach at a coding school, and by far Mithril has been the easiest JS framework for my students to learn and work with. For being so powerful, Mithril is quite easy to get started with – and that means a lot.

comment 11y ago · link · parent

It's getting more and more popular every day! It just doesn't have a billion dollar company's marketing budget to promote itself :)

comment 11y ago · link · parent

You are absolutely correct; this is what Mithril.js does. In Mithril, a component is a plain JavaScript object with only two properties: controller and view. No set / replaceState, no component[Will | Did][Mount | ReceiveProps] – just plain JavaScript data structures.

Because Mithril uses plain JavaScript constructs, you can use standard design patterns and techniques when constructing and managing your components. Everything works beautifully.

comment 11y ago · link · parent

From the article's introduction:

> That’s right: static typing! A lot of people were worried when they heard that, which is understandable; in the Ruby community we don’t get much exposure to static type systems, and they immediately make us think of languages like C and Java.

The author then proceeds to explain why static typing in ruby would be much better than "Java-flavoured-Ruby", and how it would "go beyond the features of the static type systems you’ve used in the past".

comment 11y ago · link · parent

You can just not use Meteor's built-in templating. I use Mithril instead (great combination, by the way).

comment 11y ago · link · parent

Definitely Mithril.js – classical MVC that takes care of the view layer (and more!), with everything else pure JS. No "model" wrappers, no event publishing/subscribing, no made-up module system. The better you get with Mithril, the better developer you'll be overall.

comment 11y ago · link · parent

> It makes it harder to read the code

I think it makes it much easier to read the code. Assigning it to a variable gives a nice, short description of what you're actually working with.

comment 11y ago · link · parent

Could you provide an example?

comment 11y ago · link · parent

Let me know when you release the OSX version, I'm very interested in purchasing.

comment 12y ago · link · parent

No package manager or dependencies seems strange. What would you call all the projects on this page? https://code.google.com/p/go-wiki/wiki/PackageManagementTool...

comment 12y ago · link · parent

I'm curious, could you expand on this?

comment 12y ago · link · parent

A specification is great, and I'm happy to see that. However, even though it's true that transpilers can compile JSX with arbitrary semantics, it still requires writing your own transpiler.

JSX is a great syntax, and these changes mean nothing if you're a transpiler writer. What I was hoping for was the JSX transpiler that React uses would become flexible enough for any library to use, without the need to modify/rewrite the transpiler itself.

Yes it's possible for someone else to write something like this, but writing a compiler is no small feat =/

comment 12y ago · link · parent

I'm disappointed that JSX is now so coupled to React. I was looking forward to JSX being used by many different JavaScript frameworks[1], but this change reveals the devs are not interested in moving that direction.

[1] Example: https://github.com/mrsweaters/mithril-rails

comment 12y ago · link · parent

Thank you for writing Mithril; it's a breath of fresh air coming from the complexity of Angular. Not to mention the small size (5kb!) - that'll be especially useful when we build our JavaScript embed widget.

comment 12y ago · link · parent

This is why I think a service like Sandstorm[1] will eventually be huge for web app development. Like OhLife, there are tons of apps that are useful enough for many people to use, but can't easily be monetized due to hosting costs. If OhLife were available on Sandstorm, someone like me could click-install OhLife on my own personal server, much like the app store for iOS. In addition, I the user also benefit by keeping my data private, i.e. not on someone else's servers.

[1] https://sandstorm.io/

comment 12y ago · link · parent

It's not a matter of skill, with games to 11 you can play 2 out of 3, which often turns out to be longer than games of 21. Personally I think games to 11 make it more exciting; it's really fun being down a game and then gaining hope when you win the next :)
1
262728
31