Twitter’s Flight JS Framework: First thoughts and comparison with Backbone
Jan 31
Hey,
Twitter released earlier today a new JS framework called Flight. You can check it out at Github
After reading the documentation, downloading it, and trying it for a while, I’ve my first thoughts.
Basically, what this framework provides is a way to create components. Each component is then “binded” or “assigned” to a certain node in the DOM element. This node can be a div, span, table, button or any other HTML element. That component will take care of all of the actions regarding it’s elements. It could be change one element’s color, adding another text, handling a button click or receiving custom events. Each component can trigger and “listen to” custom events or DOM events. This is the only way components can communicate with each other, as they’ll never know another component. It’s a 100% decoupled. I think this sums up what the new framework is about.
Now, some comments about this implementation:
I love and hate an event model at the same time. In one way, it’s 100% decoupled with actually rules, as you can reutilize each component wherever you want. However, working with events make it almost impossible to debug your code. You see tons of events “flying” around, with no easy way of knowing who, when, where and why each event was launched. It can be debugged, but it can be painful at first. So, it’s a tough call, but I actually still like events. I think that a way to debug this events easily should be added somehow.
Each of this components reminds me to Backbone’s View object. Backbone is a very well known MVP for JavaScript. In backbone each view is binded to an element as well, which can be received as a parameter, and then you can hook to both dom events and custom events. However, Backbone also has a Router (to handle URL changes via HTML5′s pushState or #!), models (Which can call your RestAPI easily) and that’s it.
However, in Backbone, one View can have a nested view or a list of nested views inside. So, imagine that you have an ul which is a Component or view. And, you want to dinamically add a lot of Li’s with some configuration. I haven’t found a way of having a Component “know” its child components in Flight. I know that that’s part of the architecture of no component knows another one, but I think that for child components, they should make an exception. I don’t think that a parent with its child should communicate via events. So, I do like that of Backbone and not on Flight.
What does Flight do really well? In my opinion 2 things.
1) Mixins. I love Flight’s mixins. You can create some “common” behaviour that can then be easily added to any component. So, let’s assume that all your components need to turn red if an event coolEvent is triggered. Instead of coding this in every Component, we just create a mixin that does it, and add this mixin to every component. This is awesome and makes you follow DRY (Don’t repeat yourself). Backbone should definitely add this!
2) Component’s lifecycle. When a certain Component is to be removed or changed from the DOM, it’s important to remove and clear certain JS variables so as not to have Memory Leaks. Flight allows us to do this with some cool hooks, but backbone doesn’t. I think that every JS frameworks should have a tearDown for objects. Open any webpage and leave it open for 1 hour and you’ll see that it consumes a bunch of memory. Every website has memory leaks. Yes, even Facebook! hahaah
So, will I use Flight? If I’m having some Rest API and then the Website, the answer is NO. Backbone has almost everything that Flight has, an even more. I thought that Backbone was lightweight but Flight is even more!
I hope you liked the quick review
See yaa!



Pingback: IT Digest: BlackBerry 10, Startups Incubator, Modern.IE, YouTube’s Paid Subscriptions and Much More | Zfort Group Blog
Pingback: Cheap Rolex
Pingback: Write highly decoupled Webapps using Twitter Flight | Ameya Karve's Weblog
Pingback: video sharing
Pingback: hostgator
Pingback: fsgb80v7cbwe
Pingback: kim kardashian halloween costume
Pingback: kim kardashian breast implants
Pingback: Matt Bacak
Pingback: mattbacak
Pingback: Freelance SEO
Pingback: Weight Loss Pills
Pingback: Jacquelyn Czarny
Pingback: kardashians full episodes
Pingback: buy real instagram followers
Pingback: Letisha Mcguinn
Pingback: Quentin Sammons
Pingback: Guaranteed Search Engine Optimization
Pingback: Antispam
Pingback: water ionizer
Pingback: دردشة الرياض
Pingback: depotonline
Pingback: mattbacak
Pingback: mattbacak
Pingback: water ionizer
Pingback: samsung nx300
Pingback: logiciel de facturation
Pingback: Antispam
Pingback: Buy Pinterest Followers
Pingback: kaos distro
Pingback: australian photographer
Pingback: ücretsiz lida
Pingback: ücretsiz seo
Pingback: Hotmail Inicio
Pingback: analyzer seo
Pingback: twitter
Pingback: traffic methods
Pingback: Veille | Pearltrees
Pingback: Kim Kardashian
Pingback: casino
Pingback: ibhciupshuwen1
Pingback: lida hapı satış
Pingback: xxx free porn
Pingback: auto insurance quote
Pingback: Sharron Peavy
Pingback: gmat tutor
Pingback: ibhciupshuwen12
Pingback: dai hua lida
Pingback: green coffee ultra gnc
Pingback: paris hilton sex tape online
Pingback: Lida hapı
Pingback: eye cream for dark circles
Pingback: top credit cards
Pingback: payday loans direct lender
Pingback: lida zayiflama
Pingback: payday loans las vegas
Pingback: payday loans direct lender
Pingback: cash advance houston
Pingback: cash advance las vegas
Pingback: cash advance
Pingback: online payday loan
Pingback: online home insurance quotes
Pingback: online payday loans
Pingback: payday loans dallas
Pingback: payday loans houston
Pingback: payday loans houston
Pingback: payday loans st louis mo
Pingback: online cash advance loans
Pingback: lesbian sex
Pingback: San Diego Bankruptcy Attorney
Pingback: hot men
Pingback: how to whiten teeth naturally
Pingback: how to lose weight fast
Pingback: cara membesarkan penis
Pingback: 500 fast cash
Pingback: lida bayisi
Pingback: Vancouver Kickboxing
Pingback: cara install wordpress di localhost
Pingback: click here
Pingback: free slots
Pingback: web hosting
Pingback: payday loans online
Pingback: hotmailiniciar.webs.com
Pingback: start up business loans
Pingback: building inspections adelaide
Pingback: Angular Cheilitis Free Forever
Pingback: see post
Pingback: batman arkham origins pre order
Pingback: weight loss lida
Pingback: Alopecia
Pingback: Diseño de paginas web
Pingback: cheap chanel handbags
Pingback: Dwayne Bradsher
Pingback: cup brown
Pingback: Genna Reives
Pingback: Kira Solum
Pingback: Lavenia Defusco
Pingback: Bret Kudley
Pingback: Gretchen Williar
Pingback: Chi Mercado
Pingback: Charlie Hastie
Pingback: Latonya Dorsainvil
Pingback: Mana Cobham
Pingback: Abel Behme
Pingback: Syreeta Minkowitz
Pingback: Jerry Politis
Pingback: Verna Waltmann
Pingback: Parker Ockleberry
Pingback: Marc Carasco
Pingback: Cecily Ruvolo
Pingback: Tracey Kollasch
Pingback: Jed Sheman
Pingback: cirugia plastica
Pingback: Quintin Thornbrugh
Pingback: Casimira Flash
Pingback: Norbert Howington
Pingback: Abram Juul
Pingback: Normand Mariner
Pingback: Anthony Aluarez
Pingback: Isiah Ster
Pingback: Louie Hardel
Pingback: Hollis Gsell
Pingback: Cyrus Crossin
Pingback: Nathanael Poskitt
Pingback: Dino Emmons
Pingback: Edwin Cotroneo
Pingback: Zachary Shrawder
Pingback: Grover Michele
Pingback: Flossie Andren
Pingback: Xuan Holliday
Pingback: Kenton Arsham
Pingback: Christi Hockaday
Pingback: Mauro Eckhart
Pingback: Todd Cadoff
Pingback: Frances Snowden
Pingback: Lashonda Aievoli
Pingback: Wilford Engelkes
Pingback: Malcolm Bourret
Pingback: Valda Shufelt
Pingback: Audry Partenope
Pingback: Karrie Godines
Pingback: Shanika Dengler
Pingback: Manuel Sammet
Pingback: Alyce Snaders
Pingback: Bradford Bosler
Pingback: Kirk Stiegler
Pingback: Merry Lambka
Pingback: Wilson Ounsy
Pingback: Emilio Freshwater
Pingback: Alberto Grandmaison
Pingback: Debby Urrutia
Pingback: Phyllis Croslen
Pingback: Floyd Ghormley
Pingback: Wynell Frazier
Pingback: Samira Ballard
Pingback: Tori Sonterre
Pingback: Hiroko Selman
Pingback: Franklyn Clause
Pingback: Fletcher Dagostino
Pingback: Pamula Schools
Pingback: Billy Musich
Pingback: Shalonda Yglesias
Pingback: Drema Eugley
Pingback: Jamee Deloatch
Pingback: Chasity Bergseng
Pingback: Freeman Redding
Pingback: Edmond Bugarin
Pingback: Luis Gutzmer
Pingback: Richard Ohotto
Pingback: Roland Sayas
Pingback: Aurea Stagnaro
Pingback: Pam Groetken
Pingback: Mohammed Jacquemin
Pingback: Elden Gaub
Pingback: Mayola Bragado
Pingback: August Melfi
Pingback: Coreen Hirons
Pingback: Richie Atchison
Pingback: Easter Darracott
Pingback: Clement Minehan
Pingback: Arlette Leberte
Pingback: Johnie Manlove
Pingback: Marcelle Thor
Pingback: Pamila Geris
Pingback: Annabell Wamser
Pingback: Bertram Mayon
Pingback: Faustino Poppen
Pingback: Cedar City Blog Shop
Pingback: Latasha Yeakle
Pingback: anonymous browsing
Pingback: Chu Tok
Pingback: vpn connection
Pingback: Wilma Goodlin
Pingback: Donny Dewitz
Pingback: Karine Harde
Pingback: Google
Pingback: Isreal Irvin
Pingback: Leo Filpo
Pingback: Vance Kassman
Pingback: czy aspartam jest szkodliwy
Pingback: Randy Neudeck
Pingback: Thi Colon
Pingback: Ursula Desmond
Pingback: Maria Yamada
Pingback: Nathanial Filter
Pingback: Toshiko Beauchemin
Pingback: Chau Jethro
Pingback: Theresa Killeen
Pingback: Herbert Lahaye
Pingback: Osvaldo Tovias
Pingback: Asa Kuhar
Pingback: Chere Gulotta
Pingback: Novella Schmeer
Pingback: Suzan Suominen
Pingback: Flossie Lindgren
Pingback: Norberto Leven
Pingback: Stanton Dutil
Pingback: Mayola Ellerbusch
Pingback: Reyes Schusterman
Pingback: Giovanni Ramsby
Pingback: Thora Lienke
Pingback: Ray Geltz
Pingback: Melvin Confrey
Pingback: Winnie Bartch
Pingback: Elia Springfield
Pingback: Jayna Eun
Pingback: Samara Miesse
Pingback: Windy Mckeithan
Pingback: Bradly Shake
Pingback: Gregg Pagni
Pingback: Venice Carkhuff
Pingback: Magen Snorden
Pingback: Faviola Kmatz
Pingback: Garfield Berrospe
Pingback: Jacqueline Harding
Pingback: Angle Kshywonis
Pingback: Shenita Verhoeven
Pingback: Dalene Misener
Pingback: Kris Tyssens
Pingback: Debora Lebouef
Pingback: Claretha Bodenschatz
Pingback: Arron Weiler
Pingback: Erik Angermeier
Pingback: Genaro Aristizabal
Pingback: Josue Darras
Pingback: Nannie Schallig
Pingback: Zachery Drivas
Pingback: 双向选择
Pingback: Bryce Maler
Pingback: aberturasdealuminio.webs.com
Pingback: Joi Makepeace
Pingback: Cherri Sebers
Pingback: Shaquita Aycox
Pingback: Maurine Blatt