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
Seven Year Itch
Search
Andrew Best
March 17, 2015
Programming
0
320
Seven Year Itch
A brief tale of porting an Angular 1.x app to ReactJS, and a comparison of the two frameworks.
Andrew Best
March 17, 2015
Tweet
Share
More Decks by Andrew Best
See All by Andrew Best
The Surprising Truths Behind Good Mentoring
andrewabest
0
70
Learn Authentication The Hard Way
andrewabest
0
320
Finding The Sweet Spot BNE
andrewabest
1
230
Finding The Sweet Spot
andrewabest
0
440
Automating AWS
andrewabest
2
360
Conventional Wisdom
andrewabest
1
430
DSC a-b-c's
andrewabest
0
140
AWS a-b-c's
andrewabest
3
160
What is Git?
andrewabest
0
220
Other Decks in Programming
See All in Programming
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
私の後悔をAWS DMSで解決した話
hiramax
4
210
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
280
How Android Uses Data Structures Behind The Scenes
l2hyunwoo
0
400
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
はじめてのMaterial3 Expressive
ym223
2
250
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
330
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
110
rage against annotate_predecessor
junk0612
0
160
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
120
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
525
40k
Building Adaptive Systems
keathley
43
2.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Building Applications with DynamoDB
mza
96
6.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Designing for humans not robots
tammielis
253
25k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
BBQ
matthewcrist
89
9.8k
Into the Great Unknown - MozCon
thekraken
40
2k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Transcript
The seven year itch
Page A short Angular narrative › Mr White: I’m trying
to set a variable on my scope and it isn’t reflecting in the UI. › Mr Blue: I ususaly just use “if (!$scope.$$phase) $scope.$apply() “. › Mr Red: Don’t do that! You should use “$timeout()”, because “if (!$scope.$$phase) $scope.$apply() “ is an anti-pattern. › Me: THAT IS ALL AWFUL. / Copyright ©2014 by Readify Pty Ltd 2
Page Inspiration › Given angular v1 is effectively obsolete* ›
And given my recent pause for thought › And given there is a lot of noise around React as a front-end framework › When selecting a front-end framework for a new web project › Then [Insert conclusion here] * http://www.techinfine.com/post/231575/Announcements-from-ng-confsome interesting news at ng-confjust last week has injected some hope into Angular V1, although at the moment it is just that –hope. / Copyright ©2014 by Readify Pty Ltd 3
Page Empirical observation › Ease-of-componentization › Amount of magic (less
is better) › Grokkabilityof concepts › Availability of solutions to common problems › Speed of development › Extensibility › Amount of swearing induced during usage / Copyright ©2014 by Readify Pty Ltd 4
Page The angular app / Copyright ©2014 by Readify Pty
Ltd 5
Page Angular architecture › ‘no controller’ style componentization http://teropa.info/blog/2014/10/24/how-ive- improved-my-angular-apps-by-banning-ng-
controller.html › Factories for services › Authentication enforced by router › Basic NancyFX backend / Copyright ©2014 by Readify Pty Ltd 6
Page The react rebuild / Copyright ©2014 by Readify Pty
Ltd 7
Page Hello React › React.js and JSXTransformer.js › “script/jsx” ›
React.creatClass() › React.run() / Copyright ©2014 by Readify Pty Ltd 8
Page React-router › https://github.com/rackt/react-router › Uses components as route handlers
› Inspired by the Ember router / Copyright ©2014 by Readify Pty Ltd 9
Page UI Complete › Component construction and composition is super
easy › PropTypes enforce components expectations on props it requires › Component specifications › Component lifecycle methods / Copyright ©2014 by Readify Pty Ltd 10
Page Authentication › Like the angular apps implementation of this
cross cutting concern, leverage routing to enforce auth. › Use a mixin to inspect and redirect for auth. / Copyright ©2014 by Readify Pty Ltd 11
Page State Management › “State should be avoided” › State
is unavoidable › FLUX › Manage state in a way that gels with React / Copyright ©2014 by Readify Pty Ltd 12
Page W-T-Flux? › Created by Facebook with the intent of
making updating data in an application more explicit and traceable › Fluxxor › https://reactjsnews.com/the-state-of-flux/ / Copyright ©2014 by Readify Pty Ltd 13
Page Flux and async › Handling asynchronous interactions with the
server is easy enough with Fluxxor, but isn’t strictly in-built. › Need to dispatch actions on start, done and fail of interaction, and stores are used to supply state that the view can use to inform the user that things are happening. / Copyright ©2014 by Readify Pty Ltd 14
Page The weigh-in › Ease-of-componentization React › Amount of magic
(less is better) React › Grokkabilityof concepts React › Availability of solutions to common problems Angular › Speed of development Angular › Extensibility Angular › Amount of swearing induced during usage React / Copyright ©2014 by Readify Pty Ltd 15
Page Acknowledgements • Please Wait (https://github.com/Pathgather/plea se-wait) • Sweet Alert
(https://github.com/t4t5/sweetalert) • Bootswatch (https://bootswatch.com/darkly/) / Copyright ©2014 by Readify Pty Ltd 16
Thankyou! github.com/andrewabest @_AndrewB