SlideShare a Scribd company logo
Xamarin Workbooks
Xamarin Interactive Workbooks
Nicolò Carandini
n.carandini@outlook.com
@TPCWare
A new kid in town
Interactive Workbook è una novità (ancora in beta) presentata da Xamarin
durante l’ultima //Build e Xamarin Evolve 2016
REPL (Read – Eval – Print Loop)
READ
EVALPRINT
Code
Compile
Execute
Programmi REPL per i Sistemi Operativi
Il più semplice esempio di REPL è il command.com come pure lo sono tutte le
shell (PowerShell, Bash, …)
Visual Studio – REPL tools
Mathematica
Un noto esempio di successo di programma REPL è senz’altro Mathematica:
A cosa serve?
Ogni piattaforma ha le sue librerie, e con i Workbook è possibile studiarle e
sperimentare in modo interattivo.
Phone
Device
Xbox
Device
Desktop
Device
Windows Core
Universal Windows Platform
Windows App
Phone
extension
Xbox
extension
Desktop
extension
Cocoa Touch
UIKitFramework
Core OS Layer
BT | External |Accelerator
Core Service Layer
iCloud | SQLite | Core Data
Media Layer
Graphic | Audio | Video
Installazione
Installazione
Vi sono due versioni, una per Mac e una per Windows
Creare un Workbook
A seconda della versione (per Windows o per Mac) sono disponibili diversi tipi
di Workbook:
Struttura di un Workbook
Un Workbook è formato da una successione di celle, le quali possono
contenere o del testo (internamente registrato con la codifica Markdown) o del
codice.
Cella 1
Markdown
Cella 2
Code
Cella 3
Code
Workbook Cell
Una singola unità di contenuto, che può essere di tipo testo (Markdown) o
codice eseguibile.
Una cella è formata da quattro parti:
• Editor e relativo Buffer
• Compiler Diagnostics
• Console Output
• Execution Results
Cell Editor e Buffer
Text Editor
E’ un rich-text content editor con una
toolbar di editing e formattazione che
si adatta al contesto (testo selezionato)
Code Editor
• E’ l’effettivo code editor con le
funzionalità di syntax highlighting,
etc.
Buffer
• E’ l’attuale contenuto testuale
dell’editor.
Cell Compiler Diagnostics
Ogni messaggio di diagnostica prodotta durante la compilazione del codice
viene mostrata direttamente sotto il Cell Editor quando viene effettuata la
richiesta di esecuzione del codice.
Cell Console Output
Ogni scrittura che viene effettuata in standard out durante l’esecuzione del
codice di una cella viene mostrato in nero sotto la cella stessa, mentre quello
diretto verso error out verrà mostrato in rosso.
Cell Execution Results
A seguito di una compilazione andata a buon fine, viene mostrata una ricca e
spesso interattiva vista del risultato.
Le eccezioni (non gli errori di compilazione!) sono considerate comunque come
risultato, poiché sono il risultato dell’esecuzione del codice compilato.
Code Cell Editor Keyboard Shortcuts
Ci sono quattro shortcut disponibili per le celle che contengono codice:
• Return
• Command-Return (Mac) / Control-Return (Win)
• Command-Shift-Return (Mac) / Control-Shift-Return (Win)
• Shift-Return
Code Cell Editor Keyboard Shortcuts
Return
Se il cursore è alla fine del buffer e la cella può essere compilata senza errori, il codice in essa
contenuto verrà eseguito e il risultato mostrato sotto il buffer, e una nuova cella di codice
verrà inserita dopo la cella corrente.
If parsing is not successful, a new line will be inserted into the buffer. Compiler diagnostics
will not be produced if parsing is not successful.
Command-Return (Mac) / Control-Return (Win)
Cerca di compilare ed eseguire la cella. Se la compilazione è valida, I risultati (incluse le
eventuali eccezioni sollevate) verranno mostrati sotto il buffer, e se non vi sono celle
seguenti, una nuova cella viene create.
Se ci sono errori di compilazione, la diagnostica verrà mostrata e il buffer rimarrà attivo con
la posizione del cursore invariata.
Code Cell Editor Keyboard Shortcuts
Command-Shift-Return (Mac) / Control-Shift-Return (Win)
Inserisce una nuova cella di testo (Markdown) dopo la cella corrente.
Shift-Return
Inserisce sempre una nuova linea, indipendentemente dalla posizione del
cursore.
Markdown Cell Editor Keyboard Shortcuts
Ci sono tre shortcut disponibili per le celle che contengono codice:
• Return
• Command-Return (Mac) / Control-Return (Win)
• Shift-Return
Code Cell Editor Keyboard Shortcuts
Return
Il Return produce differenti risultati sulla base del contenuto di testo
(Markdown) in cui si trova il cursore:
• Se il cursore si trova in un blocco di codice Markdown, una “new line” viene
inserita.
• Se il cursore si trova in una blocco Markdown di tipo lista, viene creato un
nuovo “list item” viene diviso il corrente “list item”.
• Se il cursore si trova in qualsiasi altro tipo di blocco Markdown, viene creato
un nuovo “paragraph block ” o viene diviso il blocco corrente.
Code Cell Editor Keyboard Shortcuts
Command-Return (Mac) / Control-Return (Win)
Inserisce una nuova cella di codice dopo la cella corrente.
Shift-Return
Inserisce un “hard line break” all’interno del corrente blocco Markdown.
Demo
Take away
• Xamarin Interactive Workbook è facile da usare.
• Consente di studiare le librerie delle diverse piattaforme sperimentando in
modo interattivo.
• Offre un ottimo strumento di documentazione.
• Consente la creazione di documenti molto utili anche per insegnare o
dimostrare l’uso di una o più librerie.
WARNING: E’ ancora in beta, brutte cose possono accadere… 
Question time

More Related Content

PDF
Wasm and Blazor CDays keynote
Nicolò Carandini
 
PPTX
The absolute need of Secure Http
Nicolò Carandini
 
PPTX
Christmas greetings cards with blazor
Nicolò Carandini
 
PPTX
Xamarin DevOps
Nicolò Carandini
 
PDF
Code review e pair programming con Visual Studio Live Share
Nicolò Carandini
 
PPTX
Azure dev ops meetup one
Nicolò Carandini
 
PDF
Spa with Blazor
Nicolò Carandini
 
PDF
The Hitchhiker's Guide to the Azure Galaxy
Nicolò Carandini
 
Wasm and Blazor CDays keynote
Nicolò Carandini
 
The absolute need of Secure Http
Nicolò Carandini
 
Christmas greetings cards with blazor
Nicolò Carandini
 
Xamarin DevOps
Nicolò Carandini
 
Code review e pair programming con Visual Studio Live Share
Nicolò Carandini
 
Azure dev ops meetup one
Nicolò Carandini
 
Spa with Blazor
Nicolò Carandini
 
The Hitchhiker's Guide to the Azure Galaxy
Nicolò Carandini
 

More from Nicolò Carandini (20)

PPTX
Game matching with SignalR
Nicolò Carandini
 
PPTX
Swagger loves WebAPI
Nicolò Carandini
 
PPTX
Swagger per tutti
Nicolò Carandini
 
PDF
Web app slots and webapi versioning
Nicolò Carandini
 
PPTX
Intro xamarin forms
Nicolò Carandini
 
PPTX
Swagger pertutti
Nicolò Carandini
 
PPTX
Windows 10 design
Nicolò Carandini
 
PPTX
Windows 10 IoT
Nicolò Carandini
 
PPTX
Mobile services multi-piattaforma con Xamarin
Nicolò Carandini
 
PPTX
Universal Apps localization and globalization
Nicolò Carandini
 
PPTX
Applicazioni web con ASP.NET Owin e Katana
Nicolò Carandini
 
PPTX
Azure Mobile Services con il .NET Framework
Nicolò Carandini
 
PPTX
Sviluppare app per iOS e Android con Xamarin e Visual Studio
Nicolò Carandini
 
PPTX
Web in real time con signalR
Nicolò Carandini
 
PPTX
Xaml introduction
Nicolò Carandini
 
PPTX
Self hosted Services with .NET OWin
Nicolò Carandini
 
PPTX
Web api 2.0
Nicolò Carandini
 
PDF
Web app slots and WebAPI versioning
Nicolò Carandini
 
PDF
Game matching with SignalR
Nicolò Carandini
 
PDF
Swagger loves webapi
Nicolò Carandini
 
Game matching with SignalR
Nicolò Carandini
 
Swagger loves WebAPI
Nicolò Carandini
 
Swagger per tutti
Nicolò Carandini
 
Web app slots and webapi versioning
Nicolò Carandini
 
Intro xamarin forms
Nicolò Carandini
 
Swagger pertutti
Nicolò Carandini
 
Windows 10 design
Nicolò Carandini
 
Windows 10 IoT
Nicolò Carandini
 
Mobile services multi-piattaforma con Xamarin
Nicolò Carandini
 
Universal Apps localization and globalization
Nicolò Carandini
 
Applicazioni web con ASP.NET Owin e Katana
Nicolò Carandini
 
Azure Mobile Services con il .NET Framework
Nicolò Carandini
 
Sviluppare app per iOS e Android con Xamarin e Visual Studio
Nicolò Carandini
 
Web in real time con signalR
Nicolò Carandini
 
Xaml introduction
Nicolò Carandini
 
Self hosted Services with .NET OWin
Nicolò Carandini
 
Web api 2.0
Nicolò Carandini
 
Web app slots and WebAPI versioning
Nicolò Carandini
 
Game matching with SignalR
Nicolò Carandini
 
Swagger loves webapi
Nicolò Carandini
 
Ad

Xamarin Workbooks

  • 3. A new kid in town Interactive Workbook è una novità (ancora in beta) presentata da Xamarin durante l’ultima //Build e Xamarin Evolve 2016
  • 4. REPL (Read – Eval – Print Loop) READ EVALPRINT Code Compile Execute
  • 5. Programmi REPL per i Sistemi Operativi Il più semplice esempio di REPL è il command.com come pure lo sono tutte le shell (PowerShell, Bash, …)
  • 6. Visual Studio – REPL tools
  • 7. Mathematica Un noto esempio di successo di programma REPL è senz’altro Mathematica:
  • 8. A cosa serve? Ogni piattaforma ha le sue librerie, e con i Workbook è possibile studiarle e sperimentare in modo interattivo. Phone Device Xbox Device Desktop Device Windows Core Universal Windows Platform Windows App Phone extension Xbox extension Desktop extension Cocoa Touch UIKitFramework Core OS Layer BT | External |Accelerator Core Service Layer iCloud | SQLite | Core Data Media Layer Graphic | Audio | Video
  • 10. Installazione Vi sono due versioni, una per Mac e una per Windows
  • 11. Creare un Workbook A seconda della versione (per Windows o per Mac) sono disponibili diversi tipi di Workbook:
  • 12. Struttura di un Workbook Un Workbook è formato da una successione di celle, le quali possono contenere o del testo (internamente registrato con la codifica Markdown) o del codice. Cella 1 Markdown Cella 2 Code Cella 3 Code
  • 13. Workbook Cell Una singola unità di contenuto, che può essere di tipo testo (Markdown) o codice eseguibile. Una cella è formata da quattro parti: • Editor e relativo Buffer • Compiler Diagnostics • Console Output • Execution Results
  • 14. Cell Editor e Buffer Text Editor E’ un rich-text content editor con una toolbar di editing e formattazione che si adatta al contesto (testo selezionato) Code Editor • E’ l’effettivo code editor con le funzionalità di syntax highlighting, etc. Buffer • E’ l’attuale contenuto testuale dell’editor.
  • 15. Cell Compiler Diagnostics Ogni messaggio di diagnostica prodotta durante la compilazione del codice viene mostrata direttamente sotto il Cell Editor quando viene effettuata la richiesta di esecuzione del codice.
  • 16. Cell Console Output Ogni scrittura che viene effettuata in standard out durante l’esecuzione del codice di una cella viene mostrato in nero sotto la cella stessa, mentre quello diretto verso error out verrà mostrato in rosso.
  • 17. Cell Execution Results A seguito di una compilazione andata a buon fine, viene mostrata una ricca e spesso interattiva vista del risultato. Le eccezioni (non gli errori di compilazione!) sono considerate comunque come risultato, poiché sono il risultato dell’esecuzione del codice compilato.
  • 18. Code Cell Editor Keyboard Shortcuts Ci sono quattro shortcut disponibili per le celle che contengono codice: • Return • Command-Return (Mac) / Control-Return (Win) • Command-Shift-Return (Mac) / Control-Shift-Return (Win) • Shift-Return
  • 19. Code Cell Editor Keyboard Shortcuts Return Se il cursore è alla fine del buffer e la cella può essere compilata senza errori, il codice in essa contenuto verrà eseguito e il risultato mostrato sotto il buffer, e una nuova cella di codice verrà inserita dopo la cella corrente. If parsing is not successful, a new line will be inserted into the buffer. Compiler diagnostics will not be produced if parsing is not successful. Command-Return (Mac) / Control-Return (Win) Cerca di compilare ed eseguire la cella. Se la compilazione è valida, I risultati (incluse le eventuali eccezioni sollevate) verranno mostrati sotto il buffer, e se non vi sono celle seguenti, una nuova cella viene create. Se ci sono errori di compilazione, la diagnostica verrà mostrata e il buffer rimarrà attivo con la posizione del cursore invariata.
  • 20. Code Cell Editor Keyboard Shortcuts Command-Shift-Return (Mac) / Control-Shift-Return (Win) Inserisce una nuova cella di testo (Markdown) dopo la cella corrente. Shift-Return Inserisce sempre una nuova linea, indipendentemente dalla posizione del cursore.
  • 21. Markdown Cell Editor Keyboard Shortcuts Ci sono tre shortcut disponibili per le celle che contengono codice: • Return • Command-Return (Mac) / Control-Return (Win) • Shift-Return
  • 22. Code Cell Editor Keyboard Shortcuts Return Il Return produce differenti risultati sulla base del contenuto di testo (Markdown) in cui si trova il cursore: • Se il cursore si trova in un blocco di codice Markdown, una “new line” viene inserita. • Se il cursore si trova in una blocco Markdown di tipo lista, viene creato un nuovo “list item” viene diviso il corrente “list item”. • Se il cursore si trova in qualsiasi altro tipo di blocco Markdown, viene creato un nuovo “paragraph block ” o viene diviso il blocco corrente.
  • 23. Code Cell Editor Keyboard Shortcuts Command-Return (Mac) / Control-Return (Win) Inserisce una nuova cella di codice dopo la cella corrente. Shift-Return Inserisce un “hard line break” all’interno del corrente blocco Markdown.
  • 24. Demo
  • 25. Take away • Xamarin Interactive Workbook è facile da usare. • Consente di studiare le librerie delle diverse piattaforme sperimentando in modo interattivo. • Offre un ottimo strumento di documentazione. • Consente la creazione di documenti molto utili anche per insegnare o dimostrare l’uso di una o più librerie. WARNING: E’ ancora in beta, brutte cose possono accadere… 

Editor's Notes

  • #4: Si tratta di un’applicazione autonoma e separata da Xamarin Studio che consente di creare dei documenti interattivi. Ma prima di vedere nel dettaglio come funzionano gli Xamarin Workbook, facciamo un po’ di storia…
  • #5: Xamarin Interactive Workbook fa parte della famiglia dei programmi REPL A differenza del classico ciclo Write – Compile – Execute, nei programmi REPL l’esecuzione avviene riga per riga
  • #6: Scriviamo una riga, premiamo invio e leggiamo subito sotto il risultato dell’esecuzione.
  • #7: Oltre alle shell di sistema, nel corso degli anni sono stati sviluppati diversi programmi REPL dedicati ai vari linguaggi, e ultimamente anche Visual Studio offre degli ambienti REPL per C#, F# e Node.js
  • #9: Gli Interactive Workbook sono molto utili per lo studio, la documentazione e l’insegnamento di funzionalità specifiche delle diverse librerie presenti nelle varie piattaforme.
  • #12: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #13: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #14: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #15: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #16: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #17: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #18: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #19: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #20: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #21: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #22: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #23: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #24: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.
  • #26: To start creating a new workbook, run the Workbooks app. If you haven't installed this already, visit the Installation page. You will be prompted to create a workbook in your platform of choice, which will automatically connect to an agent app allowing you to visualise your document in real time. If the Workbooks app is already running, you can create a new document by browsing to File > New . Workbooks can be saved and opened again later within the application. You can then share them with others to demonstrate ideas, explore new APIs, or teach new concepts.