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
67
Workshop JSFP - SEMCOMP 2021
anabastos
0
240
Clojure é um Java melhor que Java - Codecon 2021
anabastos
0
120
Clojure 101 - Criciuma Dev
anabastos
0
290
TDC POA - GraphQL
anabastos
1
240
TDC Porto Alegre 2019 - JS Funcional com Ramda
anabastos
0
210
BackEndSP - GraphQL
anabastos
0
200
Git & Github - RLadies
anabastos
1
210
Programaria Summit - Performance FrontEnd
anabastos
1
200
Other Decks in Programming
See All in Programming
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.7k
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
200
テストをしないQAエンジニアは何をしているか?
nealle
0
130
SRE、開発、QAが協業して挑んだリリースプロセス改革@SRE Kaigi 2025
nealle
3
4.1k
GAEログのコスト削減
mot_techtalk
0
110
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
2
300
DROBEの生成AI活用事例 with AWS
ippey
0
130
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
340
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
Honoをフロントエンドで使う 3つのやり方
yusukebe
4
2.1k
お前もAI鬼にならないか?👹Bolt & Cursor & Supabase & Vercelで人間をやめるぞ、ジョジョー!👺
taishiyade
5
3.8k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Agile that works and the tools we love
rasmusluckow
328
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Embracing the Ebb and Flow
colly
84
4.6k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Designing for Performance
lara
604
68k
Statistics for Hackers
jakevdp
797
220k
Git: the NoSQL Database
bkeepers
PRO
427
64k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
RailsConf 2023
tenderlove
29
1k
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?