Mithril.js Interview with Gilbert
Next came Angular. Backed by Google, Angular’s two-way data binding demo took JS pop culture by storm. Frustrated with my experiences with maintaining large Backbone apps, I took a lesson from history and avoided investing any time learning Angular (in hindsight this was a good idea). The ideas behind Angular 1.0 came from the Java enterprise world, are by no means idiomatic, and — according to other developers — its performance turned out to be hard to debug in large applications (ironically because of two-way data binding, the very feature that made it popular).
What are Mithril’s greatest strengths? I believe one of Mithril’s greatest strengths is its low learning curve. You only have to learn three or so methods to get started, yet you can do so much. I think a framework with a low learning curve is vastly underrated. When something is easy to learn, you’ll have a much easier time hiring other developers and getting them up to speed. Not to mention reading your own code months down the line ☺
<div onclick="showModal(event)" />
That taboo was so prevalent, so strong that it affects developers even today; when some look at how Mithril handles views, they get a chill sense of the past, and immediately dismiss the framework altogether. I was wary myself — it was probably the reason I didn’t get into Mithril the first time my friend linked me to it. In the end, though, views need logic to be useful (view logic, not business logic). Inventing a pseudo-html language like Angular’s only adds another layer of complexity to learn, debug, and maintain.
One potential weakness of Mithril is that it doesn’t prescribe anything for your Model in MVC. If thinking about code design and patterns makes you uncomfortable, you might want to wait until someone releases an opinionated framework that sits on top of Mithril.
You’re involved in the Mithril community. What are some of the most notable recent changes (or impending changes)? True, I am involved in a lot of Mithril’s feature discussions. If you hang out in the gitter chat room, you’ll find people discussing and posting a lot of really neat patterns. You can also ask for help; me and others are very willing to help you get started.
Just recently Mithril released support for nesting components. This makes it super easy to build a top-down component architecture. It was the one ingredient that I missed from using React.js.
What are some more advanced things you’ve done with Mithril that you think are really cool? One day I was working on a client project that needed functionality similar to datatables. After wrestling with the library for hours, I got fed up with it. When I think about it, it’s funny how as I become more experienced, I become less tolerant of certain kinds of programming hurdles — in this case, poorly designed APIs. There’s just not enough time in the day to deal with things that should not be this difficult.
Anyways, suddenly I had the thought, “wait, this wouldn’t be that hard to implement in Mithril, would it”? I decided to do it, and at the end of the day I had datatables-like functionality in my client’s project, complete with AJAX and pagination.
Besides the docs and your own tutorial, what are some of the best resources for learning more about Mithril? There is now a wiki that is actively maintained by the community. One of the wiki pages has a list of tutorials on getting started.