Top Banner
@LostInBrittany #polymer @pariswebComps Battle of Frameworks: Polymer Horacio Gonzalez @LostInBrittany
24

Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

Apr 07, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Battle of Frameworks:Polymer

Horacio Gonzalez @LostInBrittany

Page 2: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Horacio Gonzalez

@LostInBrittany

Cityzen Datahttp://cityzendata.com

Spaniard lost in Brittany, developer, dreamer and all-around geek

Page 3: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Polymer EcosystemDevTools, task runner...

Page 4: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Until Google I/O 2016

The Polymer library is for building components

out of components

out of components

out of components

out of components...

Page 5: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

How do I write an app with Polymer?

How about routing? Use your favorite routing lib, in a custom element

How about i18n? Use your favorite i18n lib, in a custom element

How about xyz? Use your favorite xyz lib, in a custom element

To be fair, it felt too light for big apps

Until Google I/O 2016

Page 7: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Polymer App-Toolbox

Everything you needed to build big apps

● app-layout elements

● app-route

● app-localize-behavior

● app-storage

● Polymer CLI

Page 8: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

● If you write a full Polymer app

The App-Toolbox is all you need

● If you use Polymer components in an app

Use the tools you have with your app

DevTools? Task Runner?

Page 9: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Let's look to your app

A challenge is a challenge, show us the code!

Imag

e: K

en S

hirr

iff

Page 10: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

An app? More, a PWA!

Page 11: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Routing

How navigation works

Page 12: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

app-location & app-route

<app-location> speaks with browser location<app-route> enables declarative, self-describing routing

<app-location route="{{route}}"></app-location>

<app-route

route="{{route}}"

pattern="/:page"

data="{{data}}"

tail="{{tail}}">

</app-route>

Page 13: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Route cascading

Route cascading allows for complex routingChild <app-route> can be declared in any element...

<app-location route="{{route}}"></app-location>

<app-route

route="{{route}}"

pattern="/:page"

data="{{data}}"

tail="{{tail}}">

</app-route>

<app-route

route="{{subroute}}"

pattern="/:id"

data="{{subrouteData}}">

</app-route>

Page 14: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Forms

Creating, using and validating forms

Page 15: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Polymer ❤ Material Design

Two canonical implementations: Android & Polymer

MD is native in Polymer: paper-elements

Page 16: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

<paper-input>

<paper-input floatinglabel

label="Type only numbers... (floating)"

validate="^[0-9]*$"

error="Input is not a number!">

</paper-input>

Page 17: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Why to choose Polymer?

That's the wrong question

Page 18: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

I ❤several JS frameworks

Page 19: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

But I don't want to be locked in

Page 20: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Web-components simply work

I can use (and I have used) my on:

Page 21: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

A good pattern

Use your framework for the app high level logic

And use web-components for all the rest

Now forcibly Polymer

Page 22: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Build a good catalog of components

Your business logic inside web components

A lifecycle different to the framework

"Never again locked with a useless stack of directives"

Page 23: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Conclusion

Image: dcplanet.fr

That's all folks!

Page 24: Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09

@LostInBrittany#polymer @pariswebComps

Thank you !