Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Front-End Funcional Com ELM - Front End SP #5
Search
Ana Luiza Portello
September 01, 2017
Programming
1
100
Front-End Funcional Com ELM - Front End SP #5
https://www.meetup.com/Frontend-Dev-SP-Meetup/events/242887383/?eventId=242887383
Ana Luiza Portello
September 01, 2017
Tweet
Share
More Decks by Ana Luiza Portello
See All by Ana Luiza Portello
FRONTIN | Elas Programam - Programação Funcional no Front-end
anabastos
0
70
Workshop JSFP - SEMCOMP 2021
anabastos
0
240
Clojure é um Java melhor que Java - Codecon 2021
anabastos
0
130
Clojure 101 - Criciuma Dev
anabastos
0
290
TDC POA - GraphQL
anabastos
1
240
TDC Porto Alegre 2019 - JS Funcional com Ramda
anabastos
0
220
BackEndSP - GraphQL
anabastos
0
210
Git & Github - RLadies
anabastos
1
210
Programaria Summit - Performance FrontEnd
anabastos
1
200
Other Decks in Programming
See All in Programming
楽しく向き合う例外対応
okutsu
0
730
The Clean ArchitectureがWebフロントエンドでしっくりこないのは何故か / Why The Clean Architecture does not fit with Web Frontend
twada
PRO
56
17k
コードを読んで理解するko build
bells17
1
120
CloudRun, Spanner に対する負荷試験の反省と オブザーバビリティによるアプローチ
oyasumipants
1
170
推しメソッドsource_locationのしくみを探る - はじめてRubyのコードを読んでみた
nobu09
2
360
Better Code Design in PHP
afilina
0
180
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
260
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
5
1.9k
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
170
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
250
From the Wild into the Clouds - Laravel Meetup Talk
neverything
0
180
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
290
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
34
3.1k
What's in a price? How to price your products and services
michaelherold
244
12k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
Speed Design
sergeychernyshev
28
820
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Adaptive Systems
keathley
40
2.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
For a Future-Friendly Web
brad_frost
176
9.6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Facilitating Awesome Meetings
lara
53
6.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Transcript
@anabastos ANA PORTELLO http://anabastos.github.io/ Full-Stack na Horizon Four.
JSLADIES https://fb.com/jsladiesbr https://twitter.com/jsladiessp https://meetup.com/JsLadies-BR/
ELM FRONT-END FUNCIONAL COM
PRECISAMOS FALAR SOBRE JAVASCRIPT
JORNADA DO JAVASCRIPT
Nenhum pattern que as pessoas falam que é o certo.
10 formas de fazer um objeto. 20 formas de invocar uma função.
http://www.phpied.com/files/location-location/location-location.html
“undefined is not a function” “cannot read property of undefined”
Terminal começa a jogar na nossa cara coisas tipo
None
WTFJS https://github.com/denysdovhan/wtfjs
None
None
None
SERÁ QUE APRENDER JS É SIMPLES?
None
O QUE É ELM?
Mantainable but kind of scary Tipos estaticos OO Langs Linguagens
Maneiras & Dinamicas Mantenabilidade (Facilidade p/ adicionar features) Usavel Fácil de aprender e de pôr em produção
O UNICÓRNIO MÁGICO DO FRONT-END
ELM é tanto uma linguagem de programação quanto um ECOSSISTEMA.
DESIGN da linguagem foi feito pra tentar de ajudar a
fazer APLICAÇÕES ROBUSTAS de forma simples.
FEITO PELO Evan Czaplicki
COMPILADO
HTML, JS, etc.. MAGICAL ELM CODE intuitive compiler...
Mensagens de ERRO informativas
None
É uma LINGUAGEM ESTATICAMENTE tipada.
String Bool List Float Int Record
É uma linguagem funcional
Nenhuma lib ou framework js pode te prover as vantagens
do funcional.
• Nunca fica legado: Codigo bem arquiteturado que continua bem
arquiteturado mesmo com o crescimento da sua aplicação • Anti-Gambiarra: Menos Bugs pq todas as funções são puras. • Declarativo: Sucinto, Reusavel, e deixa tudo muito mais claro quando vc está lidando com estado
IMUTÁVEL
“null” “NaN” “undefined is not a function”
Sem problemas de RUNTIME. Compilou tá certo.
NoRedInk has 80k+ lines of ELM, and after more than
a year in production, it still has not produced a single runtime exception. http://elm-lang.org/
É focado em ser SIMPLES e PERFORMÁTICO.
import html main = Html.text "Hello"
add x y = x + y
Valoriza MUITO simplicidade
CURVA DE APRENDIZAGEM Muito conteúdo, exemplos, tutoriais, etc.
None
None
None
AMBIENTE
npm install -g elm
SUPORTE PARA EDITORES DE TEXTO
elm-package http://package.elm-lang.org/
elm-package.json elm-stuff/ elm-package install elm-lang/html
elm-make
elm-repl
elm-format
elm-reactor
None
TIME TRAVELLING DEBUG http://debug.elm-lang.org/edit/Mario.elm
PROBLEMAS DE DOM
REAL DOM VIRTUAL DOM
?
BLAZING FAST RENDERING 50% mais rapido que React
None
Blazing fast DOM
REDUX é inspirado no ELM
ARQUITETURA
Dataflow UNIDIRECIONAL. Estado IMUTÁVEL. Efeitos COLATERAIS CONTROLADOS.
MODEL VIEW UPDATE RENDER M SG
main = contador { model = model, view = view,
update = update }
Descreve o estado da sua tela Model State
Model 0 { Model = 0 }
Recebe o estado e renderiza a nossa view(HTML) de forma
declarativa. View Render
View div [] [ button [ onClick Decrement ] [
text "-" ] , div [] [ text “” ] , button [ onClick Increment ] [ text "+" ] ] + - ~virtual dom~
View 0 view model = div [] [ button [
onClick Decrement ] [ text "-" ] , div [] [ text (toString model) ] , button [ onClick Increment ] [ text "+" ] ] + -
É o evento base p/ todos os eventos acontecendo quando
rola interação na ui(clicks, inputs, etc) Msgs Actions
type Msg = Increment | Decrement Increment Decrement 0 +
-
Recebe uma msg e state como input Retorna um novo
estado e cmd. Essa função é pura e não gera efeitos colaterais Update Reduce
type Msg = Increment | Decrement update msg model =
case msg of Increment -> model + 1 Decrement -> model - 1 0 + - Update
http://elm-lang.org/examples/buttons
DEMO
https://github.com/pzavolinsky/elm-bootstrap https://package.elm-lang.org/packages/jystic/elm-font-awesome https://package.elm-lang.org/packages/TheSeamau5/elm-material-icons https://github.com/debois/elm-mdl
REACT ELM COMPONENTS https://github.com/evancz/react-elm-components
try-elm/examples learnyouanelm.github.io/ elm-lang.org/ elmrepl.cuberoot.in/
t.me/elmbrasil elmlang.slack.com/ elmweekly.nl/
OBRIGADA :) https://speakerdeck.com/anabastos
DÚVIDAS?