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
110
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
88
Workshop JSFP - SEMCOMP 2021
anabastos
0
260
Clojure é um Java melhor que Java - Codecon 2021
anabastos
0
140
Clojure 101 - Criciuma Dev
anabastos
0
310
TDC POA - GraphQL
anabastos
1
260
TDC Porto Alegre 2019 - JS Funcional com Ramda
anabastos
0
230
BackEndSP - GraphQL
anabastos
0
220
Git & Github - RLadies
anabastos
1
230
Programaria Summit - Performance FrontEnd
anabastos
1
210
Other Decks in Programming
See All in Programming
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
110
ReadMoreTextView
fornewid
1
480
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
400
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
580
Haskell でアルゴリズムを抽象化する / 関数型言語で競技プログラミング
naoya
17
4.9k
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
230
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
260
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
190
エンジニア向け採用ピッチ資料
inusan
0
160
プロダクト志向なエンジニアがもう一歩先の価値を目指すために意識したこと
nealle
0
110
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
800
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
93
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Why You Should Never Use an ORM
jnunemaker
PRO
57
9.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Done Done
chrislema
184
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
A better future with KSS
kneath
239
17k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Writing Fast Ruby
sferik
628
61k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
670
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?