jquery react angular

55
Frontend Málaga

Upload: rafa-d-latorre-lopez-villalta

Post on 22-Jan-2017

191 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Jquery react angular

Frontend

Málaga

Page 2: Jquery react angular

AGENDA 1. jQuery vs React vs Angular (Rafa) 2. Break (15 min) 3. Design in developers eyes (Dan) 4. Announcements 5. The minute round 6. Networking

Page 3: Jquery react angular

Join us at:

https://frontendmalaga.slack.comSubscribe at: http://bit.ly/1Suvbjj

#frontendmalagaor at:

Page 4: Jquery react angular

JQuery vs React vs Angular

Frontend

Málaga

Page 5: Jquery react angular

Hello. I’m Rafa

Rafael David Latorre López - Villalta

• Lead Frontend & UX Chief at Tolq.com • resetsociety.com founder

9 years of experience developing experiences which try to be easy for the user

Page 6: Jquery react angular

Today we are going to be talking about movies

Page 7: Jquery react angular
Page 8: Jquery react angular
Page 9: Jquery react angular
Page 10: Jquery react angular

Is that true?

Nope

Page 11: Jquery react angular

Lets give a closer look to them

Page 12: Jquery react angular

JQuery (or zepto)

• It’s just a library

• It allows us to access and change the DOM easily

• Unifies cross-browser inconsistent functionalities

• It is really easy to do interaction design with it

Page 13: Jquery react angular

JQuery vs Vainilla JS

vs

Page 14: Jquery react angular

Sample app

.element .toggle

.details.hidden

Page 15: Jquery react angular

Easiest and most common way:

• Backend with templating system renders everything (php, .net, rails, etc)

• Jquery just toggles a class to hide and show the extra content

• No Javascript rendering

• No AJAX

Page 16: Jquery react angular

Easiest and most common way:

Page 17: Jquery react angular

What if I want to render with JS ?

Page 18: Jquery react angular

Rendering markup with JS

Page 19: Jquery react angular

Rendering markup with JS

Page 20: Jquery react angular

if the markup is complex you should use

http://handlebarsjs.com/

Page 21: Jquery react angular

Loading from the server

Page 22: Jquery react angular

Pagination: better in the server

Page 23: Jquery react angular

Pagination: better in the server

• The code begins to become more unreadable

• Organising the code is not easy.

Page 24: Jquery react angular

Is then Jquery a bad choice for dynamic apps?

Nope

Page 25: Jquery react angular

This was created with Jquery

Page 26: Jquery react angular

The code

Page 27: Jquery react angular

Angular• It’s a complete framework

with:

• Data-binding, basic templating directives, form validation, routing, deep-linking, reusable components and dependency injection.

• Getting started is easy, mastering it is quite difficult.

• Double data binding

• Low Decision Fatigue

Page 28: Jquery react angular

Angular is BIG

Page 29: Jquery react angular

Sample app

Page 30: Jquery react angular

Easiest and most common way:

• Render full Angular template from the backend

• Everything is rendered via Javascript

• Doing AJAX is easy and advisable

Page 31: Jquery react angular

The view template

Page 32: Jquery react angular

The controller

Page 33: Jquery react angular

Paginating with AJAX

Page 34: Jquery react angular

Refactoring

Page 35: Jquery react angular

Refactoringindex.html

Page 36: Jquery react angular

Composing

personDetails.html

index.html

person-details.js

a piece of hell

Page 37: Jquery react angular

Angular 2 is coming

• In no more than a few months the beta will be stable

• Breaking changes everywhere

• Copies several good practices from React

Page 38: Jquery react angular

React• It’s just a library to render views

and give them more functionality with JS.

• It includes a Virtual DOM

• Simple to use and learn

• Can be rendered in the Server (Isomorphic JS)

• Unidirectional data flow

• Can create native mobile functionalities with React Native

Page 39: Jquery react angular

Sample app

Page 40: Jquery react angular

Easiest and most common way:

• Initialise a div with JSON props where React components will be rendered

• Everything is rendered via JSX + Javascript

• Doing AJAX is easy and advisable

Page 41: Jquery react angular

Normally you start with this:

Page 42: Jquery react angular

But quickly turns into this:

Page 43: Jquery react angular

Composing

Page 44: Jquery react angular

Paginating with AJAX:

{page}

Page 45: Jquery react angular

Recap

Page 46: Jquery react angular

Pros

Page 47: Jquery react angular

ReactAngularJQuery• Low entry barrier

• Trivial to set up anywhere

• Easier and simpler on basic DOM interactions

• Extremely popular

• It provides a big set of tools to deal with everything in the frontend

• Low decision fatigue

• Currently popular, plenty of apps that will need maintenance

• It’s easy to learn and master

• Fastest rendering

• Opens mobile development for frontend developers

• Isomorphic JS

Page 48: Jquery react angular

Cons

Page 49: Jquery react angular

ReactAngularJQuery• Rendering

markup is not elegant

• Requires very strict development strategies on complex products

• Mastering it is really hard

• It has unnecessarily complex features (some of which will disappear in 2.0)

• It’s going to be outdated in the coming months

• Restrictive in some cases

• Difficult to set up properly

• Decision fatigue

• Difficult to set up properly

Page 50: Jquery react angular

When should you use them?

Page 51: Jquery react angular

JQuery if:

• There is no need to render a lot of templates

• You are starting out

• You are doing mostly DOM & CSS manipulation

• You need the extra functionality it comes with ($.get, $.map, $.each)

Page 52: Jquery react angular

Angular if:

• You are an experienced programmer

• You already have experience with it

• You want one tool that deals with everything

• You framework allows it

Page 53: Jquery react angular

React if:

• You need fast rendering

• You are a beginner/intermediate programmer

• Your framework needs some flexibility

Page 54: Jquery react angular

Keep digging in:

• https://www.airpair.com/angularjs/posts/angular-vs-react-the-tie-breaker

• https://medium.freecodecamp.com/angular-2-versus-react-there-will-be-blood-66595faafd51#.midi90woe

Page 55: Jquery react angular

Thanks!