Slide 1

Slide 1 text

JavaScript Web Application Frameworks What? When? Which? How? Fritz Lekschas PhD Candidate at Harvard @flekschas lekschas.de

Slide 2

Slide 2 text

Multiscale Visual Pattern Exploration in Genomics Davis et al. (2018) The Encyclopedia of DNA elements (ENCODE): data portal update. Fritz Lekschas PhD Candidate at Harvard Advisor: Hanspeter Pfister

Slide 3

Slide 3 text

CellFinder Semantic Body Browser Satori HiPiler HiGlass Peax

Slide 4

Slide 4 text

CellFinder Semantic Body Browser Satori HiPiler HiGlass Peax jQuery AngularJS Ember.js Knockout CanJS Backbone Aurelia React Angular React Vue.js Angular

Slide 5

Slide 5 text

CellFinder Semantic Body Browser Satori HiPiler HiGlass Peax jQuery AngularJS Ember.js Knockout CanJS Backbone Aurelia React Angular React Vue.js Angular React Vue.js Angular Svelte ?

Slide 6

Slide 6 text

What is a web application framework? When and why should we use a web framework? Which web framework are hot and which should we choose? How to work with a web framework?

Slide 7

Slide 7 text

What is a (web) application framework?

Slide 8

Slide 8 text

A framework is generic software to be adjusted by user-specific code to form an application. It provides a standard way to develop applications and the tools necessary for its implementation.

Slide 9

Slide 9 text

A framework is generic software to be adjusted by user-specific code to form an application. It provides a standard way to develop applications and the necessary tools for its implementation.

Slide 10

Slide 10 text

● ● No predefined end goal ● You decide about its purpose ● Provides the building blocks and a guide on how to compose them ● Framework ● ● Clear purpose ● You just use it ● Provides an interface and the means to its purpose ● Library

Slide 11

Slide 11 text

● ● No predefined end goal ● You decide about its purpose ● Provides the building blocks and a guide on how to compose them ● The framework orchestrates your code Framework ● ● Clear purpose ● You just use it ● Provides an interface and the means to its purpose ● Your code calls the library Library

Slide 12

Slide 12 text

Application Code Library Library Framework

Slide 13

Slide 13 text

http://jsf.lekschas.de 1

Slide 14

Slide 14 text

Framework HTML CSS JS Template/View Styling Behavior

Slide 15

Slide 15 text

http://jsf.lekschas.de 2

Slide 16

Slide 16 text

What types of frameworks?

Slide 17

Slide 17 text

Model View Controller Model ViewModel View MVC MVVM Changes Updates Changes Updates Translates

Slide 18

Slide 18 text

Model View Controller MVC Changes Updates Consume Interact Model ViewModel View MVVM Changes Updates Translates

Slide 19

Slide 19 text

“If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions.” Josh Smith https://www.codeproject.com/Articles/23241/Using-MVC-to-Unit-Test-WPF-Applications

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

http://jsf.lekschas.de 2

Slide 22

Slide 22 text

What do frameworks take care of?

Slide 23

Slide 23 text

Templating State Management Data Binding/Flow Synchronizing Create HTML Add, update, remove data Add event listeners Keep everything in sync

Slide 24

Slide 24 text

http://jsf.lekschas.de 1

Slide 25

Slide 25 text

When should we use a web framework?

Slide 26

Slide 26 text

What is the primary purpose of the application? Presentation: Maybe | Otherwise: Yes! What kind of view changes are anticipated? Only non-structural: Maybe | Otherwise: Yes! What is the scope of the application? Prototype: Maybe | Otherwise: Yes!

Slide 27

Slide 27 text

http://hipiler.lekschas.de

Slide 28

Slide 28 text

http://jsf.lekschas.de 3

Slide 29

Slide 29 text

HiGlass

Slide 30

Slide 30 text

https://higlass.io

Slide 31

Slide 31 text

Which frameworks are hot in 2020?

Slide 32

Slide 32 text

React Vue Angular Svelte

Slide 33

Slide 33 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 34

Slide 34 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 35

Slide 35 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 36

Slide 36 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 37

Slide 37 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 38

Slide 38 text

JS, HTML, and CSS handled together Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately Virtual DOM with diffing One-way data binding Relatively unopinionated Component focused JS, HTML, and CSS handled separately DOM with dynamic change detection Two-way data binding Highly opinionated Modularized React Vue Angular Svelte JS, HTML, and CSS handled together DOM with static change detection Two-way data binding Relatively unopinionated Component focused

Slide 39

Slide 39 text

http://jsf.lekschas.de 4-6

Slide 40

Slide 40 text

Which framework should you choose?

Slide 41

Slide 41 text

Simplicity: How fast can one get started? Expressivity: How much can the framework do? Community Support: How continuous is the community engagement? Tooling: How many good tools/libraries are already there?

Slide 42

Slide 42 text

State of the JavaScript 2019: Satisfaction https://2019.stateofjs.com/front-end-frameworks/

Slide 43

Slide 43 text

State of the JavaScript 2019: Interest https://2019.stateofjs.com/front-end-frameworks/

Slide 44

Slide 44 text

State of the JavaScript 2019: Awareness https://2019.stateofjs.com/front-end-frameworks/

Slide 45

Slide 45 text

Downloads

Slide 46

Slide 46 text

Google Trends React Angular jQuery Vue Svelte

Slide 47

Slide 47 text

React Svelte Vue > Angular = > Warning! Highly biased! My Personal Preferences

Slide 48

Slide 48 text

React Svelte Vue > Established Great tooling Getting Established Dead simple Angular = > Simple CSS transitions Blazing fast ??? But who am I to tell you? Test them for yourself! My Personal Preferences

Slide 49

Slide 49 text

React Vue Angular > Svelte = > My Recommendation Established Great tooling Managed by FB Established Good for complex applications Managed by Google Getting Established Supported by various companies Rising but small community No company support

Slide 50

Slide 50 text

How to work with web frameworks?

Slide 51

Slide 51 text

Clear separation of concerns: who is responsible for what? Write pure functional code: a function should have a single purpose and no side effects Rely as a little on the framework as possible Be wary of leaky abstractions and look behind the curtain

Slide 52

Slide 52 text

Purify Your Code

Slide 53

Slide 53 text

http://jsf.lekschas.de 7

Slide 54

Slide 54 text

Separation of Concerns: React with D3

Slide 55

Slide 55 text

http://jsf.lekschas.de 8

Slide 56

Slide 56 text

Leaky Abstraction

Slide 57

Slide 57 text

http://jsf.lekschas.de 9

Slide 58

Slide 58 text

Resources Composing Software from Eric Elliot leanpub.com/composingsoftware and medium.com/@_ericelliott State of JavaScript 2019 stateofjs.com Newsletters javascriptweekly.com, frontendfoc.us, react.statuscode.com, http://esnextnews.com Blogs overreacted.io, 2ality.com

Slide 59

Slide 59 text

Thanks! Questions?