Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Why Vue is the Best Frontend Framework

Why Vue is the Best Frontend Framework

Opinionated argument for why I believe VueJS offers the perfect balance in framework design and why it should be the default choice for most use cases

Avatar for Michael Timbs

Michael Timbs

February 06, 2020
Tweet

Other Decks in Programming

Transcript

  1. Senior Full-Stack Developer / Team Lead @michael_timbs Also full stack

    developer and lead a team of 4 at Fleet We do satellites and industrial IoT We are hiring a senior backend or full stack engineer
  2. JSConf.Asia 2019 - https://youtu.be/ANtSWq-zI0s Anything that sounds reasonably coherent is

    likely shameless stolen from this great talk. Evan is just too modest to state the logical conclusion that Vue is the best. Lots of great talks about Vue but I like this one because most people understand software is about tradeoffs.
  3. SPEED $38/hr AWS EC2 (4TB RAM, 128 CPUs) $100/hr Senior

    Developer The tradeoff I am going to focus on in this talk is Speed because I feel it’s generally the most influential in decision making. Concept of Carbon Time v Silicon Time. How fast can you write it, how fast does it run. Developer hours are more expensive than compute hours. Front end does have resource constraints based on browser and network performance so is still a consideration
  4. Silicon Time Performance Templates Raw Performance Ahead Of Time JSX

    Expressiveness Runtime Scheduling People like JSX because of expressiveness. Turing complete power of JS to build arbitrarily complex logic. JSX allows you to treat view as data. V-DOM is inherently expensive. Vue (2.5) runtime is faster than React because In React, when a component’s state changes, it triggers the re-render of the entire component sub-tree. In Vue, a component’s dependencies are automatically tracked during its render, so the system knows precisely which components actually need to re-render when state changes. But in Vue 3……..
  5. Standard VDOM diffing cost is relative to the total size

    of your view, rather than the number of nodes that need to change Diff <div> Diff props of <div> Diff children on <div> Diff <p> Diff props of <p> Diff children of <p> Vue 3 is able to tell what can and can’t change and only tracks things that can possibly change in the vdom diff
  6. Fully dynamic render logic doesn’t provide enough information for safe

    Ahead Of Time optimisations. React Fibre improves perceived performance via runtime scheduling but requires a heavy runtime (20-30kb of JS) which also hurts load time performance.
  7. Compiling code from a template can produce more direct render

    instructions with better raw perf Svelte code only checks if name changed and then updates it. Doesn’t need runtime hacks so leads to lighter runtime and raw speed. Cons = constrained by template syntax and lose expressiveness of Javascript
  8. VDOM & Templates ✅ Compilation step optimised VDOM render functions

    ✅ Option to skip template and manually write JSX ❌ Never be as fast as Svelte but trade off for flexibility Vue 2 is already faster than React. Vue 3 is about 5-6x faster than Vue 2 (with smaller runtime ).
  9. Small Scope ✅ Fewer concepts to get started ✅ More

    user-land opportunities for people to build on ❌ More plumbing work needed ❌ Patterns evolve and become semi-required knowledge that aren’t documented as part of the library Fewer concepts -> component model, props and return v-dom tree. Can build arbitrarily complex systems on top of that = large ecosystem and lots of user land opportunities Lots of work to solve complex problems with simple concepts State Management options, CSS in JS, Higher Order Components, router choices. Not officially documented or endorsed which means have implicit required knowledge outside library.
  10. Large Scope ✅ Most common problems solved with built-in abstractions

    ✅ Consistent and coherent ecosystems ❌ Higher upfront learning ❌ Inflexible if built-in solution doesn’t fit ❌ Harder to change and grow due to large surface Just use the framework and you can do most things Dont shop for 10 different implementations. Lean into the framework Framework maintainers have more to maintain which means less time exploring
  11. Progressive in Scope ✅ Layered design for opt-in progressive manner

    ✅ Low entry learning barrier (lower than react) ❌ Not as diverse in solutions because official solutions Layered design 1. Pull in from CDN -> Vue basic -> Vuex -> Vue Router Better and more consistent documentation React is apparently just JS but Vue can be HTML, CSS with JS sprinkled. HTML is not dead. Designers can build
  12. SCALABILITY All scale. Vue has smallest learning curve, most maintainable

    code. Adopted solutions. SFC are great way to seperate concerns ✅ ✅ ✅
  13. JOB MARKET React wins in terms of total number followed

    by Angular ✅ Vue and React have roughly about 2x more jobs than developers though. More competition for React jobs and it has been mainstream for longer so tougher at top end too.
  14. Vue Competitive Advantage React isn’t bad, there’s just nothing it

    does better than Vue. Vue lets you build more, in less time, with less experience. Vue has better performance and smaller bundle size. Vue code is easier/cleaner to maintain
  15. When to use React Already have React code base Team

    only has experience with React Doesn’t make sense to throw it in the bin and use Vue just because it is objectively better in every way. If an opportunity comes up for a small product - new marketing site, small dashboard etc. Give Vue a try.
  16. Some people smarter than me Evan You (Vue) - @youyuxi

    Dan Abramov (React) - @dan_abramov Rich Harris (Svelte) - @Rich_Harris If you want to hear more about this stuff here are some people who know what they are talking about and publish amazing content
  17. More About Vue Evan You - Jsconf.Asia 2019 - Seeking

    balance in framework design https://youtu.be/ANtSWq-zI0s FullstackRadio - Evan You - Whats coming in Vue3 http:// www.fullstackradio.com/129 Interested in hearing more about Vue(3) I suggest these sources.
  18. Want to Learn Vue ? http://vuecasts.com/ (FREE) https://adamwathan.me/advanced-vue-component-design/ I’m sure

    there’s more but after these two, coupled with some of the best documentation you will find I didn’t need to keep looking