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
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
500
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
990
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
160
Jasprが凄い話
hyshu
0
180
PEPCは何を変えようとしていたのか
ken7253
3
290
.NET Frameworkでも汎用ホストが使いたい!
tomokusaba
0
200
もう少しテストを書きたいんじゃ〜 #phpstudy
o0h
PRO
19
4.2k
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
310
機能が複雑化しても 頼りになる FactoryBotの話
tamikof
1
220
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
220
Rubyと自由とAIと
yotii23
6
1.8k
CDK開発におけるコーディング規約の運用
yamanashi_ren01
2
260
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Cost Of JavaScript in 2023
addyosmani
47
7.4k
Faster Mobile Websites
deanohume
306
31k
Scaling GitHub
holman
459
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
For a Future-Friendly Web
brad_frost
176
9.6k
What's in a price? How to price your products and services
michaelherold
244
12k
Typedesign – Prime Four
hannesfritz
41
2.5k
The World Runs on Bad Software
bkeepers
PRO
67
11k
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?