Which should I learn: Mithril, Vue, or Angular?

来源:互联网 发布:纵向科研经费知乎 编辑:程序博客网 时间:2024/05/15 23:52

Disclaimer: I am the author of Vue.js.

It kind of annoys me that many answers jump right into the technical comparisons or  "Go with framework X" verdicts without even asking what the OP is trying to achieve. So let's ask that question first: what are you trying to achieve by picking a framework?

  1. To get a job in the short term
  2. To build something as fast as possible
  3. As a learning experience to level up your JavaScript skill

If your goal is solely (1), then you are most likely better off going with Angular or React (Note: not Angular 2, at least for now), since these two are the most mature, most widely used, and gives you the best "hire-ability" on the market. Angular 1 being a bit more enterprise-y while React being more startup-y.

For goal (2), it further depends on the type of app you are building. Is it a largely backend-rendered app or a pure SPA? For the former, you'd be better off with something that is lighter, less-intrusive, requires no specific tooling, and plays nicely with HTML (hint: Vue). For SPAs, then we have to dive into actual technical comparisons on performance, features, API friendly-ness, tooling support, ecosystem maturity and all that. But that's a fairly large topic in itself, and it can also be subjective and highly project-dependent.

For goal (3), you are again better off starting with something lighter-weight, because full-solution frameworks like Angular/Ember throws too many concepts upfront, and since you cede control to the framework, you end up mostly learning about framework-specific APIs and conventions rather than universally-applicable skills. On the other hand, smaller libraries, due to their smaller API surfaces, forces you to take more control and understand how different pieces actually fit together (which in fact helps you pick up larger frameworks later).

---

Now here's the actual suggestion: learn JavaScript itself first, and learn it damn well. That is the safest bet. With solid basics you should be able to pick up the basics of Vue/React/Mithril/Riot in a matter of days. You should then build a small app with each, without complex tooling, just to (1) understand what problems these frameworks solve; (2) understand your own preference - i.e. what API style makes you more productive. From there you can then try out larger frameworks because you are now much better prepared for them. This whole process will probably take some time, but it's going to be a worthwhile investment, way better than diving deep into a single framework for a few months and then realizing it's not for you.

On the other hand - you should also learn about framework-agnostic skills like ES2015, basic Node.js, how NPM works, module systems/bundlers (Browserify/Webpack/System.js) - these tooling are inescapable in large SPAs no matter what framework you are using.

The core idea is don't put all your eggs in a single basket. Picking a JavaScript framework is not a one-or-the-other scenario; you don't have to stick with one forever. And no matter what others say, it's impossible to make the best decision for yourself without trying them out and get first-hand experience with it. If you just go with one and ignore the others, you are almost certainly doing it wrong.


0 0
原创粉丝点击