SlideShare a Scribd company logo
1 of 31
Download to read offline
HTML5 Frontend Development

Debugging di applicazioni web Backbone con
Backbone Debugger
Manuel Dell’Elce
@Maluen0
https://github.com/Maluen/
Backbone Debugger

INTRODUZIONE
Perchè il web è così popolare?
Scambio di informazioni multimediali
Comunicazione e collaborazione
Scambio di informazioni multimediali
Accesso alle informazioni
Scambio di informazioni multimediali
Testo
Scambio di informazioni multimediali
Immagini
Scambio di informazioni multimediali
Audio
Scambio di informazioni multimediali
Video
Dove porta tutto ciò?
Le applicazioni web HTML5
Framework e librerie
Framework

Librerie

+ Svluppo out of the box
- Learning curve maggiore
- Flessibilità

+ Flessibilità
+ Learning curve minore
- Molte decisioni da
prendere
- Sviluppo di funzionalità
«base>

VS
Backbone App

Views

Models
DOM Magagement

Collections

Routers

URL Change

Usato a livello di produzione da attori quali

14
Problema
I debugger dei browser sono orientati a livello del
codice eseguito e non dell’applicazione Backbone
rappresentata:

15
Una possibile soluzione:
«Backbone Debugger»

16
Installazione e codice sorgente
• Installazione (Chrome Web Store):
http://bit.ly/1ePQ1DV

• Codice sorgente e sviluppo (GitHub):
http://www.github.com/Maluen/Backbone-Debugger/
Backbone Debugger

DEMO!
Backbone Debugger

REALIZZAZIONE
L’estensione Chrome
Pagina ispezionata

App: l’applicazione
Backbone eseguita.
Backbone Agent: raccoglie
informazioni sull’App.
Javascript window object: il contesto globale utilizzato da
entrambi.
Backbone Agent
DevTools
// custom panel
chrome.devtools.panels.create("Backbone Debugger", "img/panel.png",
"panel.html");
// custom sidebar pane in the elements panel
chrome.devtools.panels.elements.createSidebarPane("Backbone Debugger",
function(sidebar) {
chrome.devtools.panels.elements.onSelectionChanged.addListener(function() {
sidebar.setHeight("35px");
sidebar.setPage("elementsSidebar.html");
});
});
Pannello dei DevTools
Pannello dei DevTools (2)
Elements sidebar
Eseguito ogni volta che si seleziona un elemento html
Content Script
// Receives messages from the inspected page and redirects
// them to the background, building up the first step towards
// the communication between the backbone agent and the panel.
window.addEventListener("message", function(event) {
// We only accept messages from ourselves
if (event.source != window) return;
var message = event.data;
chrome.extension.sendMessage(message);
}, false);
// Sends a message to the background when the DOM of the
// inspected page is ready (typically used by the panel
// to check if the backbone agent is on the page).
window.addEventListener('DOMContentLoaded', function() {
chrome.extension.sendMessage({
target: 'page',
name: 'ready'
});
}, false);
Background
Registra le porte di comunicazione aperte dai pannelli,
ridirezionando su di essa i messaggi ricevuti dai Content Script:
// Hash <panel tab id, panel commmunication port>
var panelPorts = {};
// Panel registration
chrome.extension.onConnect.addListener(function(port) {
if (port.name !== "devtoolspanel") return;
port.onMessage.addListener(function(message) {
if (message.name == "identification") {
var tabId = message.data;
panelPorts[tabId] = port;
}
});
});
// Receives messages from the content scripts and
// redirects them to the respective panels, completing
// the communication between the backbone agent and the panel.
chrome.extension.onMessage.addListener(function(message, sender, sendResponse) {
if (sender.tab) {
var port = panelPorts[sender.tab.id];
if (port) {
port.postMessage(message);
}
}
});
Background (2)
Utilizza le porte di comunicazione registrate per avvisare i
pannelli degli aggiornamenti delle rispettive pagine ispezionate:
chrome.tabs.onUpdated.addListener(function(updatedTabId, changeInfo) {
if (changeInfo.status == "loading") {
var port = panelPorts[updatedTabId];
if (port) {
port.postMessage({
target: 'page',
name: 'updated'
});
}
}
});
Architettura

30
Sviluppi futuri
• Modalità alternative di visualizzazione
• Una nuova scheda con tutte le azioni dell’applicazione
• Filtrare e raggruppare i risultati visualizzati

• Personalizzazione
dell’interfaccia
tramite
file
di
configurazione globali o specifici per la singola applicazione

Oppure... Github -> New issue!

More Related Content

More from Ivano Malavolta

Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Ivano Malavolta
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Ivano Malavolta
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Ivano Malavolta
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Ivano Malavolta
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Ivano Malavolta
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Ivano Malavolta
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Ivano Malavolta
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Ivano Malavolta
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile developmentIvano Malavolta
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architecturesIvano Malavolta
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design LanguageIvano Malavolta
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languagesIvano Malavolta
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software ArchitectureIvano Malavolta
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineeringIvano Malavolta
 
Mobile Apps quality - a tale about energy, performance, and users’ perception
Mobile Apps quality - a tale about energy, performance, and users’ perceptionMobile Apps quality - a tale about energy, performance, and users’ perception
Mobile Apps quality - a tale about energy, performance, and users’ perceptionIvano Malavolta
 
[13 - B] Experiment reporting
[13 - B] Experiment reporting[13 - B] Experiment reporting
[13 - B] Experiment reportingIvano Malavolta
 
[13 - A] Experiment validity
[13 - A] Experiment validity[13 - A] Experiment validity
[13 - A] Experiment validityIvano Malavolta
 
[09-A] Statistical tests and effect size
[09-A] Statistical tests and effect size[09-A] Statistical tests and effect size
[09-A] Statistical tests and effect sizeIvano Malavolta
 
[07-B] Statistical hypothesis testing
[07-B] Statistical hypothesis testing[07-B] Statistical hypothesis testing
[07-B] Statistical hypothesis testingIvano Malavolta
 
[07-A] Descriptive Statistics and data exploration
[07-A] Descriptive Statistics and data exploration[07-A] Descriptive Statistics and data exploration
[07-A] Descriptive Statistics and data explorationIvano Malavolta
 

More from Ivano Malavolta (20)

Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile development
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architectures
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languages
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering
 
Mobile Apps quality - a tale about energy, performance, and users’ perception
Mobile Apps quality - a tale about energy, performance, and users’ perceptionMobile Apps quality - a tale about energy, performance, and users’ perception
Mobile Apps quality - a tale about energy, performance, and users’ perception
 
[13 - B] Experiment reporting
[13 - B] Experiment reporting[13 - B] Experiment reporting
[13 - B] Experiment reporting
 
[13 - A] Experiment validity
[13 - A] Experiment validity[13 - A] Experiment validity
[13 - A] Experiment validity
 
[09-A] Statistical tests and effect size
[09-A] Statistical tests and effect size[09-A] Statistical tests and effect size
[09-A] Statistical tests and effect size
 
[07-B] Statistical hypothesis testing
[07-B] Statistical hypothesis testing[07-B] Statistical hypothesis testing
[07-B] Statistical hypothesis testing
 
[07-A] Descriptive Statistics and data exploration
[07-A] Descriptive Statistics and data exploration[07-A] Descriptive Statistics and data exploration
[07-A] Descriptive Statistics and data exploration
 

Debugging di applicazioni web Backbone con Backbone Debugger