When comparing Mithril vs Backbone, the Slant community recommends Backbone for most people. In the question“What are the best client-side JavaScript MV* frameworks?” Backbone is ranked 3rd while Mithril is ranked 6th. The most important reason people chose Backbone is:
A lightweight view class is provided but there is no default templating method implemented. Because views are minimal it allows for much more freedom to implement views however you would like, and because of this freedom it's possible to write views to more uniquely adapt to a problem. User interactions are done within an events object that allows these interactions to be segregated from the rest of the view code which makes the behavioral aspect of the view easier to read and manage.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Small, easy to learn API
Most other frameworks either offer a huge API to deal with model and view synchronization, or defer to other libraries & plugins to cater for relatively simple use cases. Mithril's API is tiny but complete. The natural reaction is to assume something is missing, but as you build you realise you incredibly fast, powerful and rich applications can be built using nothing but Mithril.
Pro Fast rendering
Mithril's loading times are very fast. This is because it's templates are compiled first and then served to the browser and because it uses a virtual DOM. The virtual DOM is a virtual tree containing all the nodes of the real DOM, every time anything changes in the virtual DOM, Mithril does not re-render the entire (real) DOM, instead it just searches and applies the differences.
Pro No need to learn another syntax to write views
Most MVC frameworks use HTML templates to render their views. They are good and useful because they are easy to read and understand. But they add more complication to an app because it's practically a new language and syntax that needs to be learned.
Mithril argues that separating markup from logic is just a separation of technologies and not concerns, so you can write Mithril views in JavaScript. Writing them in JavaScript also makes it easier to debug them (HTML templates can't be debugged).
Pro Familiar to people used to MVC
Doesn't lock you into any complicated conventions or structures, only one function is required to create either a Controller or a View. You're free to implement your architecture exactly as you want, so you can focus on the purpose of MVC, making connections between computer data and stuff in the end user's head.
Pro Small size
Weights just 8Kb gzipped and has no dependencies. A reactive stream module can be added for one extra Kb.
Pro Great documentation
Mithril has a large and expansive documentation despite it's relatively small API. Mithril's GitHub repo has more documentation than actual source code. None of that documentation is auto-generated
Pro Allows a smooth transition from other UI frameworks
One thing you need to start using Mithril is just a DOM node. With Mithril a developer is able to introduce the library step by step.
Pro Allows you to choose which JavaScript libraries to integrate in your project
Mithril gives to the developer the flexibility to chose the best JavaScript library to use for a specific task.
A huge framework like Angular instead forces you to use their API, which does not necessarily evolve as fast as the JavaScript ecosystem. Therefore you may end up in case when you are stuck using an API which is just not the best in terms of performance
Pro Can be used without build systems
It's plain old JavaScript, can be used without webpack, gulp or grunt, just include it into your HTML and start writing your app.
Pro Does not force you into a predefined structure
Mithril's API is pretty small compared to other frameworks. It forces developers to solve problems in JavaScript rather than in Mithril. Other frameworks with massive APIs force you to think in a way that suits the framework. Mithril doesn't do that.
Pro Gives you the freedom to implement views however you want
A lightweight view class is provided but there is no default templating method implemented. Because views are minimal it allows for much more freedom to implement views however you would like, and because of this freedom it's possible to write views to more uniquely adapt to a problem.
User interactions are done within an events object that allows these interactions to be segregated from the rest of the view code which makes the behavioral aspect of the view easier to read and manage.
Pro Can be combined with any library you want
Backbone can be combined with any library of your choosing, giving you the ultimate flexibility in creating customized solutions for unique projects. Even the only two backbone requirements, jQuery and underscore can be replaced with equivalent libraries like zepto or lo-dash.
Pro Large community
Backbone has existed longer than most frameworks, and has a large following of users and projects using it as a framework.
Pro You can call underscore.js methods directly on Backbone objects
Backbone collections and models are extended by underscore.js method allowing you to call underscore methods directly on the Backbone objects.
Pro Easy to interface with the API
Backbone provides Model and Collection classes that provide strong analogs to restful resources. These strong analogs allow you to interface more naturally with the API, and makes it easier to write custom behaviors for more complicated API interactions.
Collections provide a variety of powerful manipulation methods that are integrated from the underscore library, that allow you to manipulate, sort, and filter collection data easily.
Pro Easy to implement complex user interaction
Because all the state is managed by Models and Controllers, and they are extendable objects, you can isolate all the state logic onto those objects allowing the rest of the application to not worry about it. The app is simplified to just taking in input to modify the Models and Controllers, and updating the views to reflect them, but none of the state needs to be a concern outside of the Model and Controller classes.
Pro Doesn’t force you into a particular coding style or paradigm
There is no “magic” happening below the surface: the source code is clear, readable and well commented. Backbone is also “lightweight” in the sense that it doesn’t require a ton of buy-in to use. It can be easily integrated into an existing page, and you can choose to only use certain components of the library (Views without Models or Collections, for example). While there are many frameworks that seem to be faster to get started with, Backbone’s lack of surprises, clear documentation, speed & flexibility make it a good fit for all types of apps.
Pro Extendable with plugins
Because Backbone is so simple, and the different components are very well isolated, it is very easy to extend the functionality of Backbone. If you're writing your own extended code it's easy to keep it separated out, and share with the community.
The community also has many plugins already available, which you can pick and choose to use to fit your programming style.
Pro Easy to abstract interaction
All Backbone classes extend an events class that allows for listening and triggering functionality. Because all classes implement events by default it is easier to provide asynchronous communication between objects, and it allows better abstraction of interaction so the event emitting object does not need to know the structure or existence of the receiving object.
Cons
Con Small API can make it unsuitable for larger more complex projects
Mithril's small API and small number of functions while helpful for small projects and applications where speed is needed, can add another layer of complexity in larger more complex applications where a more extensive API is needed out of the box.
Con Requires more coding compared to other frameworks
Because many features are not provided out of the box, you either have to write more base class code to get those features, or find a plugin that provides them in a way you like.
It does not provide much structure either, things like memory management must be kept in mind by the developer, also the lack of view lifecycle management makes state changes prone to memory leaks.
Con Can easily lead you to spaghetti code
Heavy event-binding can lead to unmanageable spaghetti mess. BB tempts users to overuse it for no reason.
Con No data binding
Backbone does not have data binding support. However, there are some libraries that can be implemented in order to have data binding in Backbone. Such as Epoxy