SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Downloaden Sie, um offline zu lesen
Dynamic Language Programming
                   for the Statically Typed Programmer




» Marco Parenzan
Marco Parenzan



» Abito a Fiume Veneto (Pordenone)
» Sono un libero professionista
  • Mi muovo sul medio piccolo
  • Mi muovo tra Friuli e Veneto
» Insegno all’Università di Trieste Programmazione
  dei Web Services
  • …e in aziende…
» Sviluppo applicazioni su commessa
» Sviluppo prototipi
  • Idee alternative…

                        www.xedotnet.org             2
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org     3
I tuls



» Sono uno statically-typed programmer
   • Intellisense-addicted
   • Pesante uso del refactoring
» Tipicamente in overloading (carico di lavoro)
   • Relativamente poco spazio per l’ingegneria
      • Tutto ciò che è ingegneristico non viene pagato
      • Il documento di specifiche…chi è costui?
      • Nessun tempo per lo Unit Testing, almeno non in questa forma
   • Sicuramente Agile, è buon senso…
   • Largo spazio alla produttività (=butta li?)
» C#, .NET, Visual Studio e i metadati aiutano pesantemente
   • Perché complicarsi la vita?


                               www.xedotnet.org                        4
Non uccidetemi…



» Spero di non fare cattiva pubblicità
  • Non è mia intenzione fare cattiva pubblicità
» Non sono un programmatore di scarsa qualità
  • Le notti sono amiche…
» I compromessi ci devono essere
» Progetti da n K€
  • n<<10




                        www.xedotnet.org                  5
Dove si sta andando a finire?



» Dynamic Languages
  • No Intellisense
     • Non tutto è jQuery…
  • No Refactoring (…)
  • No prestazioni (…, ???)
» Però…




                         www.xedotnet.org                           6
… bisogna accontentare il cliente



» Modifiche/personalizzazioni continue
» Il deployment è un problema
  • Non siamo a “velocità ingegneristiche” (tipicamente
    lente)
  • Rilasci “non controllati”
» UI=Testing sul campo
  • Stiamo inserendo ORA l’MVC o l’MVVM
  • WPF difficile da adottare
     • 3 anni persi (dall’introduzione di WPF)
     • L’MVVM è la parte più semplice (comunque se ne parla da un
       anno)
  • ASP.NET MVC
  • Fino all’anno scorso non c’erano

                           www.xedotnet.org                               7
“code is value”



» Il codice “è un valore”
  • Non solo in termini di Know-How
  • Qualcosa da assegnare ad una variabile
» Il codice è un parametro
» L’algoritmo può cambiare
  • Gestire il versioning dell’algoritmo…
  • …come gestire la coesistenza di n-versioni?
  • …ricostruire il calcolo
» Legare documenti a versioni di codice

                        www.xedotnet.org                    8
Ispirazioni



» VBScript
» Office
  • Visual Basic for Application (Alt+F11)
» La community Unix
  • Perl
  • Shell
» Powershell



                        www.xedotnet.org           9
Necessità



» Scrivere codice dopo il deployment
  • On site
  • Magari senza aprire Visual Studio
» Codice dopo il deployment=dato




                       www.xedotnet.org       10
Quando realmente serve?



»   Formule
»   Codice di calcolo
»   Report (io uso librerie PDF)
»   Import/Export
»   Altre idee (non ancora provate)
    • Maschere (stile Access)




                         www.xedotnet.org                     11
Come lo potevo fare fino ad ora?



» I due estremi
  • VBScript spero di no…
  • .NET 5.x
     • Compiler as a Service (Anders Hejlsberg, PDC 2008)
     • “eval”




                          www.xedotnet.org                              12
.NET 1.x, 2.0, 3.x




 » CodeDom + csc.exe
      • Lo stesso discorso vale anche per VB



                                                   Creazione                   IStaticScript
                Inclusione in un    Creazione
Script C#                                           dinamica      istanza
                    template       dell’assembly
                                                   dell’istanza                •Execute




      www.xedotnet.org                                                                         13
C# 3.0 Consuming IronPython




public class Calculator {               class Calculator:
    …                                       …
    public int Add(int x, int y) {          def Add(self, x, y):
        return x + y;                           return x + y
    }
}


                                   PyObject calc = GetCalculator();
Calculator calc = GetCalculator(); object res = calc.Invoke("Add", 10, 20);
int sum = calc.Add(10, 20);        int sum = Convert.ToInt32(res);

               object calc = GetCalculator();
               Type calcType = calc.GetType();
               object res = calcType.InvokeMember("Add",
                   BindingFlags.InvokeMethod, null,
                   new object[] { 10, 20 });
               int sum = Convert.ToInt32(res);
Vantaggi del CodeDOM



» C#/VB
» C# 3.0 features
  •   anonymous types
  •   Implicit typed variabiles
  •   Object/collection initializers
  •   Lambda Expression
» Magari un Editor con Color Syntax Highlighting e
  Intellisense
  • Soprattutto ora che l’editor di VS2010 è riusabile

                           www.xedotnet.org                  15
Svantaggi del CodeDOM



» Static Compiling
» “NO” REPL
  • In realtà Mono ce l’ha: http://mono-
    project.com/CsharpRepl
» “NO” CODE AS VALUE
  • No valutazione “istantanea”
» Vincoli della compilazione statica
  • Add Reference
  • Using…

                       www.xedotnet.org                    16
C# 4.0




public class Calculator {                     class Calculator:
    …                                             …
    public int Add(int x, int y) {                def Add(self, x, y):
        return x + y;                                 return x + y
    }
}


Statically typed to
   be dynamic                dynamic calc = GetCalculator();
                             int sum = calc.Add(10, 20);


                       Dynamic                Dynamic method
                      conversion                 invocation
Quando usare il CodeDOM?



» Quando scrittura codice e consumo sono due
  momenti:
  • distinti (chi usa non consuma)
  • distanti (scrivo una volta e faccio il test, poi andrà in
    esecuzione)




                          www.xedotnet.org                      18
Scripting (da Wikipedia)


» La distinzione tra un programma normale ed uno script non è
  netta, ma generalmente negli script si possono individuare le
  seguenti caratteristiche:
   • complessità relativamente bassa
   • utilizzo di un linguaggio interpretato
   • integrazione in un processo di configurazione automatica del
     sistema (ad esempio ad ogni avvio, o ad ogni login di un dato
     utente), in una pagina web (tipicamente utilizzando il linguaggio
     JavaScript), o comunque per svolgere mansioni accessorie e molto
     specifiche
   • una certa linearità (uno script può anche accettare input
     dall'utente, ma solitamente input diversi non modificano
     sostanzialmente la struttura del Diagramma a blocchi che descrive
     il comportamento dello script)
   • mancanza di una propria interfaccia grafica (…)
   • richiamo di altri programmi per svolgere operazioni più sofisticate

                              www.xedotnet.org                          19
Specifiche (1)


» complessità relativamente bassa
   • Non si vuole sostituire il C#
   • Non me ne voglia la community dei Dynamic Languages
   • Ognuno usa il linguaggio con cui si trova bene…
   • …e io sto bene con il C#
   • Sostituire solo alcuni pezzi
» utilizzo di un linguaggio interpretato
   • Non siamo in condizioni di criticità per le performances
» svolgere mansioni accessorie e molto specifiche
   • Non si vuole scrivere TUTTO Il programma, ma solo certe
     parti
   • Personalizzazioni

                          www.xedotnet.org                    20
Specifiche (2)



» una certa linearità
  • Il flusso di esecuzione viene sempre implementato
    nel core scritto in C#
» mancanza di una propria interfaccia grafica
  »   Qui si può disquisire
  »   WPF è scripting? No, però XamlReader.Load()…
  »   …e una maschera custom….
  »   …ma adesso no…di nuovo, il core è in C#
      » Release 2 di questo lavoro
» richiamo di altri programmi per svolgere operazioni
  più sofisticate
  » Richiamare il core dell’applicazione

                               www.xedotnet.org              21
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org    22
Static(ally typed) Language



» Un linguaggio in cui il controllo dei tipi avviene a
  compile time
» Il tipo è associato alle variabili, non ai valori
» Permettono di verificare e notificare (almeno in
  parte) parte degli errori sui tipi prima ancora di
  andare in esecuzione




                       www.xedotnet.org                        23
Dynamic(ally typed) Language



» Un linguaggio in cui il controllo dei tipi avviene a
  runtime
» Il tipo è associato ai valori, non alle variabili
» Non permettono di verificare e notificare gli
  errori di tipo se non quando vanno in
  esecuzione




                       www.xedotnet.org                          24
Confronto




     Static                Dynamic
   Languages              Languages

     Robusto           Semplice e stringato

                           Interpretato
   Performante
                        (no compilazione)

     Strumenti           “implicitamente
   “intelligenti”           tipizzato”

Migliore scalabilità   Meta-programming
Le peculiarità di un Dynamic Language



» Semplice e stringato
  • È una scelta tipica di chi ha sviluppato questi linguaggi
  • Sintassi leggera
  • Molte funzioni lasciate in API in linguaggi statici sono
    implementate nel linguaggio
» Interpretato
  • È la diretta conseguenza della semplicità, evitando la
    “complicazione” di un processo di compilazione
  • Il senso è generale, senza pensare ad un IDE
» Implicitamente tipizzato
Metaprogramming



» Il metaprogramming è la scrittura di un programma
  in grado di scrivere o manipolare altri programmi o
  se stesso
» Un metaprogramma effettua a tempo di esecuzioni
  operazioni che sarebbero, in condizioni normali,
  effettuate a tempo di compilazione
» L'obiettivo del metaprogramming è quello di
  produrre programmi in grado di adattarsi
  dinamicamente ad una configurazione che cambia
  nel tempo, senza intervento umano

                       www.xedotnet.org              27
Alune definizioni



» Metaprogramma: il prodotto dell'atto di
  metaprogramming
» Metalinguaggio: linguaggio utilizzato per
  scrivere il metaprogramma
» Linguaggio oggetto: il linguaggio del programma
  manipolato
» Se il metalinguaggio ed il linguaggio di
  programmazione coincidono, l'attività di
  metaprogramming prende il nome di reflection

                     www.xedotnet.org               28
Quale scegliere?



» Due “generazioni” di linguaggi
  • Nativi (con virtual machine proprietaria)
  • Su Runtime (.NET o JVM)
» Alcuni
  • Python (IronPython, Jython)
  • Ruby (IronRuby, JRuby)
» Perché portare Python o Ruby su .NET o JVM?
  • Py o Rb usano il runtime
  • Py o Rb sono accessibli dal runtime (e questo è il
    nostro caso)

                        www.xedotnet.org                   29
Dynamic Interoperability




  Different heaps                 CLR’s GC heap

                                          py1
                       Common
                       Language
 py1           c2       Runtime

                                           c2


Python       C-Based
Objects      Objects                 .NET Objects
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org    31
Cos’è Python?


» Un linguaggio di programmazione general purpose
» Sviluppato da Guido van Rossum nel 1991
» Un linguaggio dinamico usato spesso come linguaggio di
  scripting
» Supporta diversi paradigmi di programmazione:
   • Object Oriented
   • Imperative
   • Functional
» Its design philosophy emphasizes:
   •   Leggibilità del codice
   •   Sintassi minimalista
   •   Una estesa set di librerie
   •   Duck Typing
IronPython



» È l’implementazione del linguaggio Python
  • IronPython è scritto interamente in C#
» Creato da Jim Hugunin
  • sviluppatore anche di Jython (Python su JVM)
  • Voleva scrivere un paper dal titolo “Why .NET is a
    Terrible Platform for Dynamic Languages”
  • Invece nel settembre del 2004 iniziava a lavorare in
    Microsoft
     • http://conferences.oreillynet.com/presentations/os2004/
       hugunin_jim_up.ppt

                         www.xedotnet.org                    33
Performances


 Test                       Descrizione                                                                         Prestazione
 parser (b0)                heavy OO plus meta programming                                                      x1.1 faster
 stacks (b1)                handling of stack overflow                                                          x2.1 faster
 PI (b2)                    using generators to compute π                                                       same
 sorting (b3)               many different comparsions and sorting                                              x1.5 faster
 parser2 (b4)               reprise of parser with different input                                              x1.2 slower
 builtins (b5)              testing unicode, complex numbers, …                                                 x2.3 slower
 iterators (b6)             – looping and overflow from int to long                                             x1.2 faster

      Python-2.3                                                                           OSCon 2004 – IronPython 0.6
                                                                                           1.7x faster than Python-2.3 on
       IronPython                                                                          pystone

IronPython (Mono)


                    0   1    2    3    4          5    6   7   8        9   10   11   12
                                                time (seconds)
                             b0   b1       b2     b3   b4   b5     b6


                                                                        www.xedotnet.org                                34
Versioni di IronPython




IronPython         IronPython               IronPython        IronPython
1.0                1.1                      2.0               3.0
• Sept. 2006       • April 2007             • Early 2008      • Early 2009
• 2.4 language     • 2.4 language           • 2.5 language    • 3.0 language?
• 27/54            • Partial 2.5            • More modules    • More modules
  builtinmodules     support                • Internal
                   • More modules             architecture
                   • Top user issues          work




                                 www.xedotnet.org                            35
Aggiornamento IronPython al 30 ottobre 2009


» http://ironpython.codeplex.com/
» .NET 3.5sp1
   • IronPython 2.0.3
      • 22 ottobre 2009
      • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea
        seId=30416
   • IronPython 2.6 RC2
      • 27 ottobre 2009
      • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea
        seId=34451
» .NET 4.0 Beta 2
   • IronPython 2.6 CTP for .NET 4.0 Beta 2
      • 21 ottobre 2009
      • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea
        seId=28125


                              www.xedotnet.org                              36
Aggiornamento IronRuby al 30 ottobre 2009


» http://ironruby.codeplex.com/
» .NET 3.5sp1
   • IronRuby 0.9.1
      • 29 settembre 2009
      • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI
        d=30916
   • IronPython binaries for ironruby-0.9.1 interop
      • 29 settembre 2009
      • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI
        d=30916#DownloadId=85530
» .NET 4.0 Beta 2
   • IronRuby CTP for .NET 4.0 Beta 2
      • 21 ottobre 2009
      • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI
        d=33305


                              www.xedotnet.org                               37
Aggiornamento DLR al 30 ottobre 2009



» http://dlr.codeplex.com/
» .NET 3.5sp1 e .NET 4.0 Beta 2, solo src
  • 22 ottobre 2009
  • http://dlr.codeplex.com/Release/ProjectReleases.as
    px?ReleaseId=34834




                       www.xedotnet.org                                  38
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org    39
» “Why .NET is a Terrible Platform for Dynamic
  Languages”
» IronPython “risolve” l’implementazione del
  Python su .NET
  • In realtà risolve anche problematiche valide per tutti
    i Dynamic Languages implementabili
» IronPython 2.0 (specific)
  • On the top of DLR (generic)



                        www.xedotnet.org                40
Dynamic Languages on .NET




IronPython      IronRuby          C#           VB.NET        Others…


                 Dynamic Language Runtime

   Expression Trees         Dynamic Dispatch       Call Site Caching

 Object        JavaScript        Python         Ruby            COM
 binder          binder          binder        binder          binder
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org    42
Alcuni esempi



» IronPython (scripting) in applicazioni WPF
  • Customize LOB application
» IronPython e l’interrogazione DB
» Report in PDF
  • Un esempio di una libreria Python
  • Una delle tante




                       www.xedotnet.org                43
A commercial use of IronPython



» Resolver Systems, ResolverOne
  a financial analytical tool that simulates
  a spread sheet
Agenda



»   Introduzione
»   Cos’è un Dynamic Language
»   Python e IronPython
»   Dynamic Language Runtime
»   Alcuni esempi
»   Conclusioni




                     www.xedotnet.org    45
Conclusioni



» Necessità dello scripting
   • Risolvere il problema delle personalizzazioni c/o il cliente
» Risolto?
   • No, forse non si risolverà mai
   • Però è un altro passo avanti
» Credenza di fondo
   • Scelgo di usare ANCHE un altro linguaggio
      • “Polyglot programmer”
   • Accetto il “compromesso” del “dinamico”
» Attingere ad un parco di implementazioni (tutte
  open source) eccezionale in maniera nativa
   • Ruby on Rails

                           www.xedotnet.org                     46
Esempi Visti



» “Static” scripting con C#
» Esempy
» Hosting DLR in una applicazione .NET
  •   Expressions
  •   Customize the lifetime di una LOB WPF window
  •   Query con Entity Framework
  •   Reports (con ReportLab)
» Resolver One


                        www.xedotnet.org               47
Esempi Non Visti



» Altre librerie Python
» Ruby e Ruby on Rails
» Gestalt
  • Python e Ruby per lo scripting in pagine HTML
  • Usa un componente Silverlight senza UI




                       www.xedotnet.org                  48
Il team che lavora sul DLR e dintorni


» Jim Hugunin (DLR)                                       » Dave Fugate (IronPython)
    •   Blog: http://blogs.msdn.com/hugunin/                       •   Blog: http://knowbody.livejournal.com/
» Dino Viehland (IronPython)                                       •   Twitter: http://twitter.com/davefugate
    •   Blog: http://blogs.msdn.com/dinoviehland/         » Harry Pierson (Evangelist)
    •   Twitter: http://twitter.com/DinoViehland                   •   Blog: http://www.devhawk.net/
» Jimmy Schementi (Silverlight                                     •   Twitter: http://twitter.com/DevHawk
  integration)                                            » Seo Sanghyeon (IronPython)
    •   Blog: http://blog.jimmy.schementi.com/                     •   Blog: http://fepy.blogspot.com/
    •   Twitter: http://twitter.com/jschementi                     •   Twitter: http://twitter.com/sanxiyn
» John Lam (IronRuby)                                     » Jim Deville (IronRuby)
    •   Blog: http://www.iunknown.com/                             •   Blog: http://blog.jredville.com/
    •   Twitter: http://twitter.com/john_lam/                      •   Twitter: http://twitter.com/jredville
» Curt Hagenlocher (IronPython)                           » Shri Borde (IronRuby)
    •   Blog: http://blogs.msdn.com/curth/                         •   Blog: http://blogs.msdn.com/shrib/
                                                          » Tomas Matousek (IronRuby)
                                                                   •   Blog: http://blog.tomasm.net/




                                                www.xedotnet.org                                                49
Autori



» Michael Foord
  • Libro: http://www.manning.com/foord/
  • Blog: http://www.voidspace.org.uk/python/weblog/index.shtml
  • Twitter: http://twitter.com/Voidspace
» Ivar Porto Carrero
  • Libro: http://www.manning.com/carrero/
  • Blog: http://flanders.co.nz/
  • Twitter: http://twitter.com/casualjim



                               www.xedotnet.org                    50
Link


Marco Parenzan
          blog: http://blog.codeisvalue.com/
         email: marco.parenzan@libero.it
          web: http://www.codeisvalue.com/
        Skype: marco.parenzan
     Messenger marco.parenzan@live.it
       Twitter: marco_parenzan
    community: www.xedotnet.org




                         www.xedotnet.org      51
Agenda



Virtual Meetings
Venerdì 30/10
Dynamic Language Programming for the Statically Typed
Language Programmer
          Speaker: Marco Parenzan

Venerdì 20/11
Microsoft Velocity: overview, practical setup and usage
          Speaker: Andrea Colaci




Dalle 21:00 alle 22:00


                               www.xedotnet.org            52
Agenda



Community Meetings
Venerdì 25/9 - Pattern Track
          Speaker: Senatore e Servienti

Venerdì 16/10 – Team Foundation Server Track
          Speaker: Barbieri e Vernole

Venerdì 6/11 – Web Track
          Speaker: Boschin e Vernole

Venerdì 12/12 – Data Track
          Speaker: Boschin e Dottor

Dalle 19:00 alle 23:00


                                www.xedotnet.org    53
Grazie
                                         Q&A

                       blog:    http://blog.codeisvalue.com/
                      email:    marco.parenzan@libero.it
                       web:     http://www.codeisvalue.com/
                      Skype:    marco.parenzan
                   Messenger    marco.parenzan@live.it
                     Twitter:   marco_parenzan

www.xedotnet.org                                               54

Weitere ähnliche Inhalte

Andere mochten auch

.NET Development for SQL Server Developer
.NET Development for SQL Server Developer.NET Development for SQL Server Developer
.NET Development for SQL Server DeveloperMarco Parenzan
 
Objects in the Cloud - Edition 2014
Objects in the Cloud - Edition 2014Objects in the Cloud - Edition 2014
Objects in the Cloud - Edition 2014Marco Parenzan
 
Implementing CQRS with Azure
Implementing CQRS with AzureImplementing CQRS with Azure
Implementing CQRS with AzureMarco Parenzan
 
2010.04.30 summary of cloud futures 2010 marco parenzan pov
2010.04.30 summary of cloud futures 2010 marco parenzan pov2010.04.30 summary of cloud futures 2010 marco parenzan pov
2010.04.30 summary of cloud futures 2010 marco parenzan povMarco Parenzan
 
GWAB2014 Italy Keynote
GWAB2014 Italy KeynoteGWAB2014 Italy Keynote
GWAB2014 Italy KeynoteMarco Parenzan
 
2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma
2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma
2014.11.22 Azure for Sql Server Developer - SQLSAT355 ParmaMarco Parenzan
 

Andere mochten auch (6)

.NET Development for SQL Server Developer
.NET Development for SQL Server Developer.NET Development for SQL Server Developer
.NET Development for SQL Server Developer
 
Objects in the Cloud - Edition 2014
Objects in the Cloud - Edition 2014Objects in the Cloud - Edition 2014
Objects in the Cloud - Edition 2014
 
Implementing CQRS with Azure
Implementing CQRS with AzureImplementing CQRS with Azure
Implementing CQRS with Azure
 
2010.04.30 summary of cloud futures 2010 marco parenzan pov
2010.04.30 summary of cloud futures 2010 marco parenzan pov2010.04.30 summary of cloud futures 2010 marco parenzan pov
2010.04.30 summary of cloud futures 2010 marco parenzan pov
 
GWAB2014 Italy Keynote
GWAB2014 Italy KeynoteGWAB2014 Italy Keynote
GWAB2014 Italy Keynote
 
2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma
2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma
2014.11.22 Azure for Sql Server Developer - SQLSAT355 Parma
 

Ähnlich wie Dynamic Language Programming For The Statically Typed Programmer

.Net 4.0 Preview @ UGIdotNet
.Net 4.0 Preview @ UGIdotNet.Net 4.0 Preview @ UGIdotNet
.Net 4.0 Preview @ UGIdotNetMauro Servienti
 
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLDTYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLDDotNetCampus
 
Slide typescript - net campus
Slide typescript - net campusSlide typescript - net campus
Slide typescript - net campusDotNetCampus
 
Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Codemotion
 
Agileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaAgileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaXPeppers
 
Custom vision on edge device
Custom vision on edge deviceCustom vision on edge device
Custom vision on edge deviceAlessio Biasiutti
 
IoT Saturday 2019 - Custom Vision on Edge device
IoT Saturday 2019 - Custom Vision on Edge deviceIoT Saturday 2019 - Custom Vision on Edge device
IoT Saturday 2019 - Custom Vision on Edge deviceAlessio Biasiutti
 
Project modern c++ (ITA)
Project modern c++ (ITA)Project modern c++ (ITA)
Project modern c++ (ITA)Raffaele Rialdi
 
ALM Revolutions - What's new in visual studio ALM 11
ALM Revolutions - What's new in visual studio ALM 11ALM Revolutions - What's new in visual studio ALM 11
ALM Revolutions - What's new in visual studio ALM 11DomusDotNet
 
Kivy Python Framework - di Gioele Gaggio
Kivy Python Framework - di Gioele GaggioKivy Python Framework - di Gioele Gaggio
Kivy Python Framework - di Gioele GaggioGiuneco S.r.l
 
High Level Synthesis Using Esterel
High Level Synthesis Using EsterelHigh Level Synthesis Using Esterel
High Level Synthesis Using EsterelAlberto Minetti
 
2010.11.19 iniziare con F#
2010.11.19 iniziare con F#2010.11.19 iniziare con F#
2010.11.19 iniziare con F#Marco Parenzan
 
2010.11.19 iniziare con f#
2010.11.19 iniziare con f#2010.11.19 iniziare con f#
2010.11.19 iniziare con f#Marco Parenzan
 
2010.05.21 introducing sql server modeling
2010.05.21 introducing sql server modeling2010.05.21 introducing sql server modeling
2010.05.21 introducing sql server modelingMarco Parenzan
 
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013Luca Zulian
 

Ähnlich wie Dynamic Language Programming For The Statically Typed Programmer (20)

.Net 4.0 Preview @ UGIdotNet
.Net 4.0 Preview @ UGIdotNet.Net 4.0 Preview @ UGIdotNet
.Net 4.0 Preview @ UGIdotNet
 
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLDTYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
 
Slide typescript - net campus
Slide typescript - net campusSlide typescript - net campus
Slide typescript - net campus
 
Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015
 
Agileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaAgileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastruttura
 
OrientDB & Big Data
OrientDB & Big DataOrientDB & Big Data
OrientDB & Big Data
 
Web frameworks
Web frameworksWeb frameworks
Web frameworks
 
Kotlin hexagonal-architecture
Kotlin hexagonal-architectureKotlin hexagonal-architecture
Kotlin hexagonal-architecture
 
Custom vision on edge device
Custom vision on edge deviceCustom vision on edge device
Custom vision on edge device
 
IoT Saturday 2019 - Custom Vision on Edge device
IoT Saturday 2019 - Custom Vision on Edge deviceIoT Saturday 2019 - Custom Vision on Edge device
IoT Saturday 2019 - Custom Vision on Edge device
 
Project modern c++ (ITA)
Project modern c++ (ITA)Project modern c++ (ITA)
Project modern c++ (ITA)
 
ALM Revolutions - What's new in visual studio ALM 11
ALM Revolutions - What's new in visual studio ALM 11ALM Revolutions - What's new in visual studio ALM 11
ALM Revolutions - What's new in visual studio ALM 11
 
VS Package @ CD2008
VS Package @ CD2008VS Package @ CD2008
VS Package @ CD2008
 
Kivy Python Framework - di Gioele Gaggio
Kivy Python Framework - di Gioele GaggioKivy Python Framework - di Gioele Gaggio
Kivy Python Framework - di Gioele Gaggio
 
High Level Synthesis Using Esterel
High Level Synthesis Using EsterelHigh Level Synthesis Using Esterel
High Level Synthesis Using Esterel
 
Da DotNet a DotNetCore
Da DotNet a DotNetCoreDa DotNet a DotNetCore
Da DotNet a DotNetCore
 
2010.11.19 iniziare con F#
2010.11.19 iniziare con F#2010.11.19 iniziare con F#
2010.11.19 iniziare con F#
 
2010.11.19 iniziare con f#
2010.11.19 iniziare con f#2010.11.19 iniziare con f#
2010.11.19 iniziare con f#
 
2010.05.21 introducing sql server modeling
2010.05.21 introducing sql server modeling2010.05.21 introducing sql server modeling
2010.05.21 introducing sql server modeling
 
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013
Costruire applicazioni-cross-platform-con-xamarin-visual-studio-2013
 

Mehr von Marco Parenzan

Azure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerAzure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerMarco Parenzan
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxMarco Parenzan
 
Azure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsAzure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsMarco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Marco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralMarco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralMarco Parenzan
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .netMarco Parenzan
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and AzureMarco Parenzan
 
Power BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralPower BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralMarco Parenzan
 
.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogameMarco Parenzan
 
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Marco Parenzan
 
Anomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETAnomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETMarco Parenzan
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsMarco Parenzan
 
Deep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetDeep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetMarco Parenzan
 
Anomaly Detection with Azure and .net
Anomaly Detection with Azure and .netAnomaly Detection with Azure and .net
Anomaly Detection with Azure and .netMarco Parenzan
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .netMarco Parenzan
 
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicRunning Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicMarco Parenzan
 
Time Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTTime Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTMarco Parenzan
 

Mehr von Marco Parenzan (20)

Azure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerAzure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineer
 
Azure Hybrid @ Home
Azure Hybrid @ HomeAzure Hybrid @ Home
Azure Hybrid @ Home
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
 
Azure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsAzure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT Solutions
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .net
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and Azure
 
Power BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralPower BI data flow and Azure IoT Central
Power BI data flow and Azure IoT Central
 
.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame
 
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
 
Anomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETAnomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NET
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data Solutions
 
Deep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetDeep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnet
 
Azure IoT Central
Azure IoT CentralAzure IoT Central
Azure IoT Central
 
Anomaly Detection with Azure and .net
Anomaly Detection with Azure and .netAnomaly Detection with Azure and .net
Anomaly Detection with Azure and .net
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicRunning Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
 
Time Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTTime Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETT
 

Kürzlich hochgeladen

Programma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoProgramma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoQuotidiano Piemontese
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Associazione Digital Days
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Associazione Digital Days
 
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Associazione Digital Days
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Associazione Digital Days
 
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Associazione Digital Days
 
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Associazione Digital Days
 
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Associazione Digital Days
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Associazione Digital Days
 

Kürzlich hochgeladen (9)

Programma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoProgramma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 Torino
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
 
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
 
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
 
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
 
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
 

Dynamic Language Programming For The Statically Typed Programmer

  • 1. Dynamic Language Programming for the Statically Typed Programmer » Marco Parenzan
  • 2. Marco Parenzan » Abito a Fiume Veneto (Pordenone) » Sono un libero professionista • Mi muovo sul medio piccolo • Mi muovo tra Friuli e Veneto » Insegno all’Università di Trieste Programmazione dei Web Services • …e in aziende… » Sviluppo applicazioni su commessa » Sviluppo prototipi • Idee alternative… www.xedotnet.org 2
  • 3. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 3
  • 4. I tuls » Sono uno statically-typed programmer • Intellisense-addicted • Pesante uso del refactoring » Tipicamente in overloading (carico di lavoro) • Relativamente poco spazio per l’ingegneria • Tutto ciò che è ingegneristico non viene pagato • Il documento di specifiche…chi è costui? • Nessun tempo per lo Unit Testing, almeno non in questa forma • Sicuramente Agile, è buon senso… • Largo spazio alla produttività (=butta li?) » C#, .NET, Visual Studio e i metadati aiutano pesantemente • Perché complicarsi la vita? www.xedotnet.org 4
  • 5. Non uccidetemi… » Spero di non fare cattiva pubblicità • Non è mia intenzione fare cattiva pubblicità » Non sono un programmatore di scarsa qualità • Le notti sono amiche… » I compromessi ci devono essere » Progetti da n K€ • n<<10 www.xedotnet.org 5
  • 6. Dove si sta andando a finire? » Dynamic Languages • No Intellisense • Non tutto è jQuery… • No Refactoring (…) • No prestazioni (…, ???) » Però… www.xedotnet.org 6
  • 7. … bisogna accontentare il cliente » Modifiche/personalizzazioni continue » Il deployment è un problema • Non siamo a “velocità ingegneristiche” (tipicamente lente) • Rilasci “non controllati” » UI=Testing sul campo • Stiamo inserendo ORA l’MVC o l’MVVM • WPF difficile da adottare • 3 anni persi (dall’introduzione di WPF) • L’MVVM è la parte più semplice (comunque se ne parla da un anno) • ASP.NET MVC • Fino all’anno scorso non c’erano www.xedotnet.org 7
  • 8. “code is value” » Il codice “è un valore” • Non solo in termini di Know-How • Qualcosa da assegnare ad una variabile » Il codice è un parametro » L’algoritmo può cambiare • Gestire il versioning dell’algoritmo… • …come gestire la coesistenza di n-versioni? • …ricostruire il calcolo » Legare documenti a versioni di codice www.xedotnet.org 8
  • 9. Ispirazioni » VBScript » Office • Visual Basic for Application (Alt+F11) » La community Unix • Perl • Shell » Powershell www.xedotnet.org 9
  • 10. Necessità » Scrivere codice dopo il deployment • On site • Magari senza aprire Visual Studio » Codice dopo il deployment=dato www.xedotnet.org 10
  • 11. Quando realmente serve? » Formule » Codice di calcolo » Report (io uso librerie PDF) » Import/Export » Altre idee (non ancora provate) • Maschere (stile Access) www.xedotnet.org 11
  • 12. Come lo potevo fare fino ad ora? » I due estremi • VBScript spero di no… • .NET 5.x • Compiler as a Service (Anders Hejlsberg, PDC 2008) • “eval” www.xedotnet.org 12
  • 13. .NET 1.x, 2.0, 3.x » CodeDom + csc.exe • Lo stesso discorso vale anche per VB Creazione IStaticScript Inclusione in un Creazione Script C# dinamica istanza template dell’assembly dell’istanza •Execute www.xedotnet.org 13
  • 14. C# 3.0 Consuming IronPython public class Calculator { class Calculator: … … public int Add(int x, int y) { def Add(self, x, y): return x + y; return x + y } } PyObject calc = GetCalculator(); Calculator calc = GetCalculator(); object res = calc.Invoke("Add", 10, 20); int sum = calc.Add(10, 20); int sum = Convert.ToInt32(res); object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 }); int sum = Convert.ToInt32(res);
  • 15. Vantaggi del CodeDOM » C#/VB » C# 3.0 features • anonymous types • Implicit typed variabiles • Object/collection initializers • Lambda Expression » Magari un Editor con Color Syntax Highlighting e Intellisense • Soprattutto ora che l’editor di VS2010 è riusabile www.xedotnet.org 15
  • 16. Svantaggi del CodeDOM » Static Compiling » “NO” REPL • In realtà Mono ce l’ha: http://mono- project.com/CsharpRepl » “NO” CODE AS VALUE • No valutazione “istantanea” » Vincoli della compilazione statica • Add Reference • Using… www.xedotnet.org 16
  • 17. C# 4.0 public class Calculator { class Calculator: … … public int Add(int x, int y) { def Add(self, x, y): return x + y; return x + y } } Statically typed to be dynamic dynamic calc = GetCalculator(); int sum = calc.Add(10, 20); Dynamic Dynamic method conversion invocation
  • 18. Quando usare il CodeDOM? » Quando scrittura codice e consumo sono due momenti: • distinti (chi usa non consuma) • distanti (scrivo una volta e faccio il test, poi andrà in esecuzione) www.xedotnet.org 18
  • 19. Scripting (da Wikipedia) » La distinzione tra un programma normale ed uno script non è netta, ma generalmente negli script si possono individuare le seguenti caratteristiche: • complessità relativamente bassa • utilizzo di un linguaggio interpretato • integrazione in un processo di configurazione automatica del sistema (ad esempio ad ogni avvio, o ad ogni login di un dato utente), in una pagina web (tipicamente utilizzando il linguaggio JavaScript), o comunque per svolgere mansioni accessorie e molto specifiche • una certa linearità (uno script può anche accettare input dall'utente, ma solitamente input diversi non modificano sostanzialmente la struttura del Diagramma a blocchi che descrive il comportamento dello script) • mancanza di una propria interfaccia grafica (…) • richiamo di altri programmi per svolgere operazioni più sofisticate www.xedotnet.org 19
  • 20. Specifiche (1) » complessità relativamente bassa • Non si vuole sostituire il C# • Non me ne voglia la community dei Dynamic Languages • Ognuno usa il linguaggio con cui si trova bene… • …e io sto bene con il C# • Sostituire solo alcuni pezzi » utilizzo di un linguaggio interpretato • Non siamo in condizioni di criticità per le performances » svolgere mansioni accessorie e molto specifiche • Non si vuole scrivere TUTTO Il programma, ma solo certe parti • Personalizzazioni www.xedotnet.org 20
  • 21. Specifiche (2) » una certa linearità • Il flusso di esecuzione viene sempre implementato nel core scritto in C# » mancanza di una propria interfaccia grafica » Qui si può disquisire » WPF è scripting? No, però XamlReader.Load()… » …e una maschera custom…. » …ma adesso no…di nuovo, il core è in C# » Release 2 di questo lavoro » richiamo di altri programmi per svolgere operazioni più sofisticate » Richiamare il core dell’applicazione www.xedotnet.org 21
  • 22. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 22
  • 23. Static(ally typed) Language » Un linguaggio in cui il controllo dei tipi avviene a compile time » Il tipo è associato alle variabili, non ai valori » Permettono di verificare e notificare (almeno in parte) parte degli errori sui tipi prima ancora di andare in esecuzione www.xedotnet.org 23
  • 24. Dynamic(ally typed) Language » Un linguaggio in cui il controllo dei tipi avviene a runtime » Il tipo è associato ai valori, non alle variabili » Non permettono di verificare e notificare gli errori di tipo se non quando vanno in esecuzione www.xedotnet.org 24
  • 25. Confronto Static Dynamic Languages Languages Robusto Semplice e stringato Interpretato Performante (no compilazione) Strumenti “implicitamente “intelligenti” tipizzato” Migliore scalabilità Meta-programming
  • 26. Le peculiarità di un Dynamic Language » Semplice e stringato • È una scelta tipica di chi ha sviluppato questi linguaggi • Sintassi leggera • Molte funzioni lasciate in API in linguaggi statici sono implementate nel linguaggio » Interpretato • È la diretta conseguenza della semplicità, evitando la “complicazione” di un processo di compilazione • Il senso è generale, senza pensare ad un IDE » Implicitamente tipizzato
  • 27. Metaprogramming » Il metaprogramming è la scrittura di un programma in grado di scrivere o manipolare altri programmi o se stesso » Un metaprogramma effettua a tempo di esecuzioni operazioni che sarebbero, in condizioni normali, effettuate a tempo di compilazione » L'obiettivo del metaprogramming è quello di produrre programmi in grado di adattarsi dinamicamente ad una configurazione che cambia nel tempo, senza intervento umano www.xedotnet.org 27
  • 28. Alune definizioni » Metaprogramma: il prodotto dell'atto di metaprogramming » Metalinguaggio: linguaggio utilizzato per scrivere il metaprogramma » Linguaggio oggetto: il linguaggio del programma manipolato » Se il metalinguaggio ed il linguaggio di programmazione coincidono, l'attività di metaprogramming prende il nome di reflection www.xedotnet.org 28
  • 29. Quale scegliere? » Due “generazioni” di linguaggi • Nativi (con virtual machine proprietaria) • Su Runtime (.NET o JVM) » Alcuni • Python (IronPython, Jython) • Ruby (IronRuby, JRuby) » Perché portare Python o Ruby su .NET o JVM? • Py o Rb usano il runtime • Py o Rb sono accessibli dal runtime (e questo è il nostro caso) www.xedotnet.org 29
  • 30. Dynamic Interoperability Different heaps CLR’s GC heap py1 Common Language py1 c2 Runtime c2 Python C-Based Objects Objects .NET Objects
  • 31. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 31
  • 32. Cos’è Python? » Un linguaggio di programmazione general purpose » Sviluppato da Guido van Rossum nel 1991 » Un linguaggio dinamico usato spesso come linguaggio di scripting » Supporta diversi paradigmi di programmazione: • Object Oriented • Imperative • Functional » Its design philosophy emphasizes: • Leggibilità del codice • Sintassi minimalista • Una estesa set di librerie • Duck Typing
  • 33. IronPython » È l’implementazione del linguaggio Python • IronPython è scritto interamente in C# » Creato da Jim Hugunin • sviluppatore anche di Jython (Python su JVM) • Voleva scrivere un paper dal titolo “Why .NET is a Terrible Platform for Dynamic Languages” • Invece nel settembre del 2004 iniziava a lavorare in Microsoft • http://conferences.oreillynet.com/presentations/os2004/ hugunin_jim_up.ppt www.xedotnet.org 33
  • 34. Performances Test Descrizione Prestazione parser (b0) heavy OO plus meta programming x1.1 faster stacks (b1) handling of stack overflow x2.1 faster PI (b2) using generators to compute π same sorting (b3) many different comparsions and sorting x1.5 faster parser2 (b4) reprise of parser with different input x1.2 slower builtins (b5) testing unicode, complex numbers, … x2.3 slower iterators (b6) – looping and overflow from int to long x1.2 faster Python-2.3 OSCon 2004 – IronPython 0.6 1.7x faster than Python-2.3 on IronPython pystone IronPython (Mono) 0 1 2 3 4 5 6 7 8 9 10 11 12 time (seconds) b0 b1 b2 b3 b4 b5 b6 www.xedotnet.org 34
  • 35. Versioni di IronPython IronPython IronPython IronPython IronPython 1.0 1.1 2.0 3.0 • Sept. 2006 • April 2007 • Early 2008 • Early 2009 • 2.4 language • 2.4 language • 2.5 language • 3.0 language? • 27/54 • Partial 2.5 • More modules • More modules builtinmodules support • Internal • More modules architecture • Top user issues work www.xedotnet.org 35
  • 36. Aggiornamento IronPython al 30 ottobre 2009 » http://ironpython.codeplex.com/ » .NET 3.5sp1 • IronPython 2.0.3 • 22 ottobre 2009 • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea seId=30416 • IronPython 2.6 RC2 • 27 ottobre 2009 • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea seId=34451 » .NET 4.0 Beta 2 • IronPython 2.6 CTP for .NET 4.0 Beta 2 • 21 ottobre 2009 • http://ironpython.codeplex.com/Release/ProjectReleases.aspx?Relea seId=28125 www.xedotnet.org 36
  • 37. Aggiornamento IronRuby al 30 ottobre 2009 » http://ironruby.codeplex.com/ » .NET 3.5sp1 • IronRuby 0.9.1 • 29 settembre 2009 • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI d=30916 • IronPython binaries for ironruby-0.9.1 interop • 29 settembre 2009 • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI d=30916#DownloadId=85530 » .NET 4.0 Beta 2 • IronRuby CTP for .NET 4.0 Beta 2 • 21 ottobre 2009 • http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseI d=33305 www.xedotnet.org 37
  • 38. Aggiornamento DLR al 30 ottobre 2009 » http://dlr.codeplex.com/ » .NET 3.5sp1 e .NET 4.0 Beta 2, solo src • 22 ottobre 2009 • http://dlr.codeplex.com/Release/ProjectReleases.as px?ReleaseId=34834 www.xedotnet.org 38
  • 39. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 39
  • 40. » “Why .NET is a Terrible Platform for Dynamic Languages” » IronPython “risolve” l’implementazione del Python su .NET • In realtà risolve anche problematiche valide per tutti i Dynamic Languages implementabili » IronPython 2.0 (specific) • On the top of DLR (generic) www.xedotnet.org 40
  • 41. Dynamic Languages on .NET IronPython IronRuby C# VB.NET Others… Dynamic Language Runtime Expression Trees Dynamic Dispatch Call Site Caching Object JavaScript Python Ruby COM binder binder binder binder binder
  • 42. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 42
  • 43. Alcuni esempi » IronPython (scripting) in applicazioni WPF • Customize LOB application » IronPython e l’interrogazione DB » Report in PDF • Un esempio di una libreria Python • Una delle tante www.xedotnet.org 43
  • 44. A commercial use of IronPython » Resolver Systems, ResolverOne a financial analytical tool that simulates a spread sheet
  • 45. Agenda » Introduzione » Cos’è un Dynamic Language » Python e IronPython » Dynamic Language Runtime » Alcuni esempi » Conclusioni www.xedotnet.org 45
  • 46. Conclusioni » Necessità dello scripting • Risolvere il problema delle personalizzazioni c/o il cliente » Risolto? • No, forse non si risolverà mai • Però è un altro passo avanti » Credenza di fondo • Scelgo di usare ANCHE un altro linguaggio • “Polyglot programmer” • Accetto il “compromesso” del “dinamico” » Attingere ad un parco di implementazioni (tutte open source) eccezionale in maniera nativa • Ruby on Rails www.xedotnet.org 46
  • 47. Esempi Visti » “Static” scripting con C# » Esempy » Hosting DLR in una applicazione .NET • Expressions • Customize the lifetime di una LOB WPF window • Query con Entity Framework • Reports (con ReportLab) » Resolver One www.xedotnet.org 47
  • 48. Esempi Non Visti » Altre librerie Python » Ruby e Ruby on Rails » Gestalt • Python e Ruby per lo scripting in pagine HTML • Usa un componente Silverlight senza UI www.xedotnet.org 48
  • 49. Il team che lavora sul DLR e dintorni » Jim Hugunin (DLR) » Dave Fugate (IronPython) • Blog: http://blogs.msdn.com/hugunin/ • Blog: http://knowbody.livejournal.com/ » Dino Viehland (IronPython) • Twitter: http://twitter.com/davefugate • Blog: http://blogs.msdn.com/dinoviehland/ » Harry Pierson (Evangelist) • Twitter: http://twitter.com/DinoViehland • Blog: http://www.devhawk.net/ » Jimmy Schementi (Silverlight • Twitter: http://twitter.com/DevHawk integration) » Seo Sanghyeon (IronPython) • Blog: http://blog.jimmy.schementi.com/ • Blog: http://fepy.blogspot.com/ • Twitter: http://twitter.com/jschementi • Twitter: http://twitter.com/sanxiyn » John Lam (IronRuby) » Jim Deville (IronRuby) • Blog: http://www.iunknown.com/ • Blog: http://blog.jredville.com/ • Twitter: http://twitter.com/john_lam/ • Twitter: http://twitter.com/jredville » Curt Hagenlocher (IronPython) » Shri Borde (IronRuby) • Blog: http://blogs.msdn.com/curth/ • Blog: http://blogs.msdn.com/shrib/ » Tomas Matousek (IronRuby) • Blog: http://blog.tomasm.net/ www.xedotnet.org 49
  • 50. Autori » Michael Foord • Libro: http://www.manning.com/foord/ • Blog: http://www.voidspace.org.uk/python/weblog/index.shtml • Twitter: http://twitter.com/Voidspace » Ivar Porto Carrero • Libro: http://www.manning.com/carrero/ • Blog: http://flanders.co.nz/ • Twitter: http://twitter.com/casualjim www.xedotnet.org 50
  • 51. Link Marco Parenzan blog: http://blog.codeisvalue.com/ email: marco.parenzan@libero.it web: http://www.codeisvalue.com/ Skype: marco.parenzan Messenger marco.parenzan@live.it Twitter: marco_parenzan community: www.xedotnet.org www.xedotnet.org 51
  • 52. Agenda Virtual Meetings Venerdì 30/10 Dynamic Language Programming for the Statically Typed Language Programmer Speaker: Marco Parenzan Venerdì 20/11 Microsoft Velocity: overview, practical setup and usage Speaker: Andrea Colaci Dalle 21:00 alle 22:00 www.xedotnet.org 52
  • 53. Agenda Community Meetings Venerdì 25/9 - Pattern Track Speaker: Senatore e Servienti Venerdì 16/10 – Team Foundation Server Track Speaker: Barbieri e Vernole Venerdì 6/11 – Web Track Speaker: Boschin e Vernole Venerdì 12/12 – Data Track Speaker: Boschin e Dottor Dalle 19:00 alle 23:00 www.xedotnet.org 53
  • 54. Grazie Q&A blog: http://blog.codeisvalue.com/ email: marco.parenzan@libero.it web: http://www.codeisvalue.com/ Skype: marco.parenzan Messenger marco.parenzan@live.it Twitter: marco_parenzan www.xedotnet.org 54