SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
MV*
Welcome.
Friday 20 September 13
MV*
Choice.
Friday 20 September 13
MV*It’s all about
you.
Friday 20 September 13
MV*Model
View
Whatever
Friday 20 September 13
MV*
Friday 20 September 13
MV*“Ask yourself how interactive your
web application needs to be. On
the less interactive side of the
scale, there are huge wins with
server side rendered HTML. The
more interactive your application
becomes, the more you’ll benefit
from a client side MVC
framework.” - Robin Ward
Friday 20 September 13
MV*Let’s
compare!
Friday 20 September 13
MV*
0
3200
6400
9600
12800
16000
14231
8207
15622
Backbone Ember Angular
Popularity: stars on github
Friday 20 September 13
MV*
Friday 20 September 13
MV*“Provides the common
foundation that data-rich web
applications with ambitious
interfaces require — while very
deliberately avoiding painting you
into a corner by making any
decisions that you're better
equipped to make yourself.”
Friday 20 September 13
MV*“Backbone is not a complete
framework. It's a set of building
blocks. It leaves much of the
application design, architecture
and scalability to the developer,
including memory management,
view management, and more.”
-Derick Bailey
Friday 20 September 13
MV*Models
! app.Transaction =
Backbone.Model.extend({});
Friday 20 September 13
MV*Models getters and setters
! transaction =
app.txns.create({desc: 'woolies'});
! transaction.set('desc', 'spar');
! transaction.get('desc');
Friday 20 September 13
MV*Collections
var Transactions =
Backbone.Collection.extend({
! ! model: app.Transaction
! });
Friday 20 September 13
MV*Views
! ! <script type="text/template"
id="txn-template">
! ! ! <div class="view">
! ! ! ! <label><%- desc %></label>
! ! ! </div>
! ! </script>
Friday 20 September 13
MV*Views part 2
app.TxnView = Backbone.View.extend({
! tagName: 'li',
! template: _.template($('#txn-template').html()),
! render: function () {
! this.$el
.html(this.template(this.model.toJSON()));
! return this;
! },
});
Friday 20 September 13
MV*Views with Marionette.js
app.TxnView =
Marionette.ItemView.extend({
template: '#txn-template'
});
Friday 20 September 13
MV*http://backplug.io
Friday 20 September 13
MV*
Friday 20 September 13
MV*
Friday 20 September 13
MV*“Allows developers to create scalable
single-page applications by incorporating
common idioms and best practices into a
framework that provides a rich object
model, declarative two-way data binding,
computed properties, automatically-
updating templates powered by
Handlebars.js, and a router for managing
application state.”
Friday 20 September 13
MV*Models
{
! description: "Woolworths HB",
! amount: -566
}
Friday 20 September 13
MV*A simple app (1/4) - app.html
<script type="text/x-handlebars">
<h3>My App</h3>
{{outlet}}
</script>
Friday 20 September 13
MV*A simple app (2/4) - app.js
App = Ember.Application.create({});
// route-> #/transactions
App.Router.map(function() {
this.resource('transactions');
});
Friday 20 September 13
MV*A simple app (3/4) - app.js
App.TransactionsRoute = Ember.Route.extend({
model: function() {
return $.getJSON('/txns.json').promise();
}
});
Friday 20 September 13
MV*A simple app (4/4) - app.html
<script
type="text/x-handlebars"
id="transactions">
{{#each model}}
<div>
{{description}} R{{amount}}
</div>
{{/each}}
</script>
Friday 20 September 13
MV*Very rails-like
<div>
{{#link-to 'transaction', this}}
!{{description}} R{{amount}}
{{/link-to}}
</div>
Friday 20 September 13
MV*
Friday 20 September 13
MV*
Friday 20 September 13
MV*“Declarative programming should
be used for building UIs and
wiring software components.
Imperative programming is
excellent for expressing business
logic.”
Friday 20 September 13
MV*“Unlike other frameworks, there
is no need to inherit from
proprietary types; to wrap the
model in accessors methods.
Just plain old JavaScript here.”
Friday 20 September 13
MV*Models
{
! description: "Woolworths HB",
! date: new Date(2013,8,19),
! amount: -566
}
Friday 20 September 13
MV*Routing
$routeProvider.when('/txns',
{
controller:TxnCtrl,
templateUrl:'txns.html'
}
);
Friday 20 September 13
MV*Controllers
function TxnCtrl($scope) {
! $scope.txns= [
! ! {
! ! ! description: "Woolworths"
! ! },
! ! {
! ! ! description: "Spar"
! ! }!!
! ]
}
Friday 20 September 13
MV*Angular views
<div ng-repeat="txn in txns">
{{ txn.description }}
</div>
Friday 20 September 13
MV*Directives
A directive allows you to extend
the HTML vocabulary in a
declarative fashion.
Friday 20 September 13
MV*Directives in action
<section id="main"
ng-show="txns.length"
ng-cloak>
Friday 20 September 13
MV*Not only attributes
<transaction
! description="{{desc}}"
! amount="{{amount}}" />
Friday 20 September 13
MV*Filters
<li ng-repeat="txn in txns">
{{txn|roundDown|formatWithZeroes}}
</li>
Friday 20 September 13
MV*Injection
function TxnCtrl($scope, $location)
{
return $location.path("/logon" );
}
Friday 20 September 13
MV*Doesn’t work
$.get('http://url.co',function(t){
! $scope.transaction = t;
});
Friday 20 September 13
MV*This works
function TxnCtrl($scope, $http){
! $http.get('http://url.co')
.success(function(t){
! ! $scope.transaction = t;
! });
}
Friday 20 September 13
MV*This also works
$.get('http://url.co',function(t){
! $scope.$apply(function () {
! ! $scope.transaction = t;
! });
});
Friday 20 September 13
MV*
Friday 20 September 13
MV*Remember, it’s
all about you.
Friday 20 September 13
MV*
Friday 20 September 13
MV*
Friday 20 September 13
MV*
Friday 20 September 13
MV*
hendrik.swanepoel@gmail.com
fluit fluit my storie is uit.
Friday 20 September 13

Mais conteúdo relacionado

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

A quick comparison of modern client-side MV* frameworks