SlideShare a Scribd company logo
1 of 48
Download to read offline
SOFEA 
Arquiteturas REST com
Backbone e HTML5
Gabriel Zigolis / @zigolis
WTF is 
SOFEA 
?
S O F E A
Service Oriented Front End Architecture
SOFEA
“Proposes to remove all presentation
layer logic from the server to JavaScript
logic on the client.”
thinserverarchitecture.com
Divisão de responsabilidades no desenvolvimento
Baixo acoplamento das camadas
Comunicação client/server através de verbos HTTP
O client requisita o que e quando
O que nós ganhamos com isso?
REST
in peace
R E S T
“Software architectural style consisting of a
coordinated set of architectural constraints applied
components, conectors and data elements, within
a distributed hypermedia system.”
Roy Thomas Fielding
Características
Client‑Server
Stateless
Cache
HTTP verbs: GET, POST, PUT, DELETE...
Backbone
“Gives structure to web applications by providing
models, collections and views to consume API over
a RESTful JSON interface.”
backbonejs.org
Características
Poderosa LIB JavaScript
Adaptável, baseada no padrão MV*
Moderninha, largamente usada em SPA
Magrinha, apenas 6.5Kb
HTML5 é a n...
Tá de 
brinqueichon 
uite me,
cara?
HTML5 Rocks
W3C
Material em PT
Collection
Wooow...
What's happened?
Magic?
WebSocket?
Fala para eles, Isabelle
Collection
Hands on
JavaScript é terapia!
Mulinari, King of Xanxerê
ListView
FollowCollection
var FollowCollection = Backbone.Collection.extend({
url: '/api/following/',
model: FollowModel
});
return FollowCollection;
FollowModel
var FollowModel = Backbone.Model.extend({
urlRoot: function() {
return '/api/follow/'
}
});
return FollowModel;
FollowView
var FollowView = Backbone.View.extend({
initialize: function() {
this.collection = new FollowCollection();
this.collection.fetch();
}
...
});
return FollowView;
FollowView @followList
initialize: function() {
...
this.followList = new FollowListView({
'collection': this.collection,
'el': this.$('.list‑view')
});
}
FollowListView
var FollowListView = Backbone.View.extend({
template: _.template( $('#tmp‑list‑view').html() ),
initialize: function() {
this.listenTo( this.collection, 'sync remove add', this.render );
},
...
});
return FollowListView;
FollowListView @render
...
render: function() {
this.$el.html(this.template({
'collection': this.collection,
'view': this
}));
}
FollowButton
ButtonModel
var ButtonModel = Backbone.Model.extend({
"defaults": {
"follow": false
},
urlRoot: function() {
return '/api/follow/'
}
});
return ButtonModel;
ButtonView
var ButtonView = Backbone.View.extend({
el: '.follow‑section',
events: {
'click .follow' : 'follow'
},
...
});
return ButtonView;
ButtonView @initialize
...
initialize: function() {
this.model = new ButtonModel();
this.listenTo( this.model, "change", follow );
},
...
ButtonView @follow
...
follow: function() {
this.model.set({ follow: true });
this.model.save()
.done(function(data) {
...
}
ButtonView @follow
...
.done(function(data) {
model = new FollowModel(data);
Backbone.trigger( "u:follow", model );
Backbone.trigger( "u:followCount" );
this.following();
});
...
Here is where the magic happens!
FollowView
var FollowView = Backbone.View.extend({
initialize: function(){
Backbone.on( 'u:follow', this.addToCollection, this );
},
addToCollection: function(model) {
this.collection.add(model);
}
});
return FollowView;
...and the magic goes on and on
That's all, folks.
e não esqueçam do ;
gabriel.zigolis@gmail.com
Gabriel Zigolis
zigolis.com
github.com/zigolis
speakerdeck.com/zigolis
slideshare.com/zigolis

More Related Content

What's hot (7)

iOS 10 & XCode 8, Swift 3.0 features and changes
iOS 10 & XCode 8, Swift 3.0 features and changesiOS 10 & XCode 8, Swift 3.0 features and changes
iOS 10 & XCode 8, Swift 3.0 features and changes
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
Asp.net mvc 4
Asp.net mvc 4Asp.net mvc 4
Asp.net mvc 4
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Mule saas
Mule  saasMule  saas
Mule saas
 
[WSO2Con EU 2017] Ballerina Connectors for Seamless Integration
[WSO2Con EU 2017] Ballerina Connectors for Seamless Integration[WSO2Con EU 2017] Ballerina Connectors for Seamless Integration
[WSO2Con EU 2017] Ballerina Connectors for Seamless Integration
 

Viewers also liked

Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge
Apigee | Google Cloud
 

Viewers also liked (6)

Jose informatica
Jose informaticaJose informatica
Jose informatica
 
Technology Keynote I Love APIs 2015: Anant Jhingran, Apigee CTO
Technology Keynote I Love APIs 2015: Anant Jhingran, Apigee CTOTechnology Keynote I Love APIs 2015: Anant Jhingran, Apigee CTO
Technology Keynote I Love APIs 2015: Anant Jhingran, Apigee CTO
 
Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge
 
Deep-Dive: Secure API Management
Deep-Dive: Secure API ManagementDeep-Dive: Secure API Management
Deep-Dive: Secure API Management
 
Build APIs in Node.js and Swagger 2.0 with Apigee-127
Build APIs in Node.js and Swagger 2.0 with Apigee-127Build APIs in Node.js and Swagger 2.0 with Apigee-127
Build APIs in Node.js and Swagger 2.0 with Apigee-127
 
Building APIs with Apigee Edge and Microsoft Azure
Building APIs with Apigee Edge and Microsoft AzureBuilding APIs with Apigee Edge and Microsoft Azure
Building APIs with Apigee Edge and Microsoft Azure
 

Similar to SOFEA - Arquiteturas REST com Backbone & HTML5 by Gabriel Zigolis

REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
PHP is the king, nodejs is the prince and Lua is the fool
PHP is the king, nodejs is the prince and Lua is the foolPHP is the king, nodejs is the prince and Lua is the fool
PHP is the king, nodejs is the prince and Lua is the fool
Alessandro Cinelli (cirpo)
 
Service stack linkedin
Service stack linkedinService stack linkedin
Service stack linkedin
Raju Golla
 

Similar to SOFEA - Arquiteturas REST com Backbone & HTML5 by Gabriel Zigolis (20)

REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
 
PHP is the King, nodejs is the Prince and Lua is the fool
PHP is the King, nodejs is the Prince and Lua is the foolPHP is the King, nodejs is the Prince and Lua is the fool
PHP is the King, nodejs is the Prince and Lua is the fool
 
PHP is the king, nodejs is the prince and Lua is the fool
PHP is the king, nodejs is the prince and Lua is the foolPHP is the king, nodejs is the prince and Lua is the fool
PHP is the king, nodejs is the prince and Lua is the fool
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
 
REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)
 
REST full API Design
REST full API DesignREST full API Design
REST full API Design
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Vue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrareVue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrare
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devs
 
Service stack linkedin
Service stack linkedinService stack linkedin
Service stack linkedin
 
Getting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi FrameworkGetting Started with the Node.js LoopBack APi Framework
Getting Started with the Node.js LoopBack APi Framework
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
 
Building Rich Applications with Appcelerator
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
 
sMash_for_zOS-users
sMash_for_zOS-userssMash_for_zOS-users
sMash_for_zOS-users
 
REST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of ConfusionREST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of Confusion
 
Introduction to React Language (1).pptx
Introduction to React Language  (1).pptxIntroduction to React Language  (1).pptx
Introduction to React Language (1).pptx
 
BRushen Resume
BRushen ResumeBRushen Resume
BRushen Resume
 
APIdays San Francisco, 06/22/2013
APIdays San Francisco, 06/22/2013APIdays San Francisco, 06/22/2013
APIdays San Francisco, 06/22/2013
 
From Web APIs to Cross-Device Web Sites
From Web APIs to Cross-Device Web SitesFrom Web APIs to Cross-Device Web Sites
From Web APIs to Cross-Device Web Sites
 

Recently uploaded

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

SOFEA - Arquiteturas REST com Backbone & HTML5 by Gabriel Zigolis