SlideShare uma empresa Scribd logo
1 de 25
Dynamic C# - A New World of Possibilities Aaron Erickson Lead Consultant, ThoughtWorks Author, The Nomadic Developer Co-Author, Professional F# (coming soon!) Microsoft MVP – C#
The initial name of the talk before it was rejected… Crazy Shit We Can Do With the Dynamic Keyword* *Not all of this is a good idea (remember, use and abuse)
C# - What it resembles now…
C# - A little of everything… Curly Braces (1.0) Generics (2.0) Functional “Lite” with Linq (3.0) And Now, Dynamic (4.0)
Duck Typing
Expando Objects
Treat Method Calls Like Messages
Send Message Receive Message
And More… Metaprogramming - take the expression tree called by the caller and do something with it. Interop– call other people’s libraries written using real dynamic languages (Ruby, JS, Python).
Interesting Applications of Dynamic C#
ActiveRecord
“ActiveRecord” for XML
Interop
Abuses… oh yes… You shuddering yet?  If not, you should be!
Is dynamic programming the answer to anything and everything?
Case For Case Against Performance – dynamic lookup just can’t be as fast as static lookup. A lot fewer things are CPU bound than we tend to think.  DB lookups?  Really? You were confused with var?  dynamic will make your head spin. Sorry – if you are confused with var, you really need to put down the keyboard and take up something for dummies, like investment banking. What is so bad about using strings in a lookup (i.e. table[“field”] vstable.field) table.field looks cleaner, survives a rename refactoring, and can just take the shape of a static object later if introduced (introduce class refactoring for R# someday?) If you want dynamic, just use a language designed for it, like Ruby!  Or JavaScript! Sometimes language choice is political. But need for dynamic remains.
Demo – Stupid Dynamic C# Tricks
Dynamic Everywhere?  My Thoughts Performance argument has merit.  Sometimes.  No pretending Twitter didn’t happen.   Dynamic readers for things like Json, XML, Text, Excel, etc – will be really wicked cool! End-user definition of objects.  I can finally envision systems, based on C#, where you can have user defined fields on CRUD objects from databases, where an end user adds a field, names it, and binding just “works”. This does not belong in your math or stats library.  That is what Clojure, Scala, Erlang, F# - or where C# is your given language, LINQ, are for. Linq + Dynamic in C# is mostly unexplored territory.  Some amazing things could come out of that intersection.
So you wanna do dynamic… You will do TDD.  Without it, you are a mess of runtime errors and maintenance nightmares You will respect that with great power comes great responsibility.  Programs using dynamic programs tend to be smaller, but metaprogramming to extremes can end up becoming “write-only” code. You will need to consider that vast parts of .NET-land have never seen this stuff before.  You will be ready to explain and justify why and how this stuff improves things. In 2020, you will curse, and maybe throw a chair or two, because of some abuse of dynamic some schmuck did in 2010 in that 10 year old code base. There is a good chance that schmuck will be me 
Questions?
Thank You! aaron.c.erickson@gmail.com twitter.com/aaronerickson http://nomadic-developer.com/

Mais conteúdo relacionado

Mais procurados

Clean Code and Common Engineering Practices
Clean Code and Common Engineering PracticesClean Code and Common Engineering Practices
Clean Code and Common Engineering PracticesRuth Sperer
 
Python Programming Course
Python Programming CoursePython Programming Course
Python Programming Courseiseestech
 
Fine tuning large LMs
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMsSylvainGugger
 
Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Jorge Barroso
 
Presistiendo que es gerundio (My storing story)
Presistiendo que es gerundio (My storing story)Presistiendo que es gerundio (My storing story)
Presistiendo que es gerundio (My storing story)Jorge Barroso
 
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016MLconf
 

Mais procurados (7)

Clean Code and Common Engineering Practices
Clean Code and Common Engineering PracticesClean Code and Common Engineering Practices
Clean Code and Common Engineering Practices
 
Python Programming Course
Python Programming CoursePython Programming Course
Python Programming Course
 
Fine tuning large LMs
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMs
 
Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)
 
Presistiendo que es gerundio (My storing story)
Presistiendo que es gerundio (My storing story)Presistiendo que es gerundio (My storing story)
Presistiendo que es gerundio (My storing story)
 
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016
 
How to code
How to codeHow to code
How to code
 

Destaque (12)

Trabajo 1
Trabajo 1Trabajo 1
Trabajo 1
 
Portada 2 pdf
Portada 2 pdfPortada 2 pdf
Portada 2 pdf
 
Profile
ProfileProfile
Profile
 
RWANDA
RWANDARWANDA
RWANDA
 
عمليات الحرث
عمليات الحرثعمليات الحرث
عمليات الحرث
 
Meja / Table
Meja / TableMeja / Table
Meja / Table
 
Harris_Matthew_UpdatedResume
Harris_Matthew_UpdatedResumeHarris_Matthew_UpdatedResume
Harris_Matthew_UpdatedResume
 
CouchDB + .NET - Relax in Style
CouchDB + .NET - Relax in StyleCouchDB + .NET - Relax in Style
CouchDB + .NET - Relax in Style
 
Sheela cao cv
Sheela cao cvSheela cao cv
Sheela cao cv
 
Lecturenotes on weed sc matched with the syllabus of 2nd sem,1st yr in tsrdam
Lecturenotes on weed sc matched with the syllabus of 2nd sem,1st yr in tsrdamLecturenotes on weed sc matched with the syllabus of 2nd sem,1st yr in tsrdam
Lecturenotes on weed sc matched with the syllabus of 2nd sem,1st yr in tsrdam
 
Microbiology Q & A for exam (short note)
Microbiology Q & A  for exam (short note)Microbiology Q & A  for exam (short note)
Microbiology Q & A for exam (short note)
 
Guía de mru
Guía de mruGuía de mru
Guía de mru
 

Semelhante a Dynamic C# and a New World of Possibilities

Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven DesignNicolò Pignatelli
 
The State of ML for iOS: On the Advent of WWDC 2018 🕯
The State of ML for iOS: On the Advent of WWDC 2018 🕯The State of ML for iOS: On the Advent of WWDC 2018 🕯
The State of ML for iOS: On the Advent of WWDC 2018 🕯Meghan Kane
 
Domain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsDomain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsHakka Labs
 
Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"Christian Heilmann
 
Key Features Of The Pseudo Code
Key Features Of The Pseudo CodeKey Features Of The Pseudo Code
Key Features Of The Pseudo CodeAngilina Jones
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...InfinIT - Innovationsnetværket for it
 
C# classes
C#   classesC#   classes
C# classesTiago
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java ProgrammingKaty Allen
 
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Codemotion
 
Rrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentRrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentSheri Elliott
 
Evolving as a professional software developer
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developerAnton Kirillov
 
Антон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLabАнтон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLabDiana Dymolazova
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...Sławomir Zborowski
 
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRTITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRTITCamp
 
The Guide to becoming a full stack developer in 2018
The Guide to becoming a full stack developer in 2018The Guide to becoming a full stack developer in 2018
The Guide to becoming a full stack developer in 2018Amit Ashwini
 
Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Grigory Sapunov
 

Semelhante a Dynamic C# and a New World of Possibilities (20)

Web Development with Smalltalk
Web Development with SmalltalkWeb Development with Smalltalk
Web Development with Smalltalk
 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
The State of ML for iOS: On the Advent of WWDC 2018 🕯
The State of ML for iOS: On the Advent of WWDC 2018 🕯The State of ML for iOS: On the Advent of WWDC 2018 🕯
The State of ML for iOS: On the Advent of WWDC 2018 🕯
 
Domain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsDomain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron Edwards
 
Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"
 
Key Features Of The Pseudo Code
Key Features Of The Pseudo CodeKey Features Of The Pseudo Code
Key Features Of The Pseudo Code
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
 
C# classes
C#   classesC#   classes
C# classes
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
 
Rrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentRrw02 Week 1 Assignment
Rrw02 Week 1 Assignment
 
Evolving as a professional software developer
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developer
 
Антон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLabАнтон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLab
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
 
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRTITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
 
The Guide to becoming a full stack developer in 2018
The Guide to becoming a full stack developer in 2018The Guide to becoming a full stack developer in 2018
The Guide to becoming a full stack developer in 2018
 
Enterprise TypeScript
Enterprise TypeScriptEnterprise TypeScript
Enterprise TypeScript
 
Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016
 

Último

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Dynamic C# and a New World of Possibilities

  • 1. Dynamic C# - A New World of Possibilities Aaron Erickson Lead Consultant, ThoughtWorks Author, The Nomadic Developer Co-Author, Professional F# (coming soon!) Microsoft MVP – C#
  • 2. The initial name of the talk before it was rejected… Crazy Shit We Can Do With the Dynamic Keyword* *Not all of this is a good idea (remember, use and abuse)
  • 3. C# - What it resembles now…
  • 4.
  • 5.
  • 6. C# - A little of everything… Curly Braces (1.0) Generics (2.0) Functional “Lite” with Linq (3.0) And Now, Dynamic (4.0)
  • 8.
  • 10.
  • 11. Treat Method Calls Like Messages
  • 13. And More… Metaprogramming - take the expression tree called by the caller and do something with it. Interop– call other people’s libraries written using real dynamic languages (Ruby, JS, Python).
  • 18. Abuses… oh yes… You shuddering yet? If not, you should be!
  • 19. Is dynamic programming the answer to anything and everything?
  • 20. Case For Case Against Performance – dynamic lookup just can’t be as fast as static lookup. A lot fewer things are CPU bound than we tend to think. DB lookups? Really? You were confused with var? dynamic will make your head spin. Sorry – if you are confused with var, you really need to put down the keyboard and take up something for dummies, like investment banking. What is so bad about using strings in a lookup (i.e. table[“field”] vstable.field) table.field looks cleaner, survives a rename refactoring, and can just take the shape of a static object later if introduced (introduce class refactoring for R# someday?) If you want dynamic, just use a language designed for it, like Ruby! Or JavaScript! Sometimes language choice is political. But need for dynamic remains.
  • 21. Demo – Stupid Dynamic C# Tricks
  • 22. Dynamic Everywhere? My Thoughts Performance argument has merit. Sometimes. No pretending Twitter didn’t happen. Dynamic readers for things like Json, XML, Text, Excel, etc – will be really wicked cool! End-user definition of objects. I can finally envision systems, based on C#, where you can have user defined fields on CRUD objects from databases, where an end user adds a field, names it, and binding just “works”. This does not belong in your math or stats library. That is what Clojure, Scala, Erlang, F# - or where C# is your given language, LINQ, are for. Linq + Dynamic in C# is mostly unexplored territory. Some amazing things could come out of that intersection.
  • 23. So you wanna do dynamic… You will do TDD. Without it, you are a mess of runtime errors and maintenance nightmares You will respect that with great power comes great responsibility. Programs using dynamic programs tend to be smaller, but metaprogramming to extremes can end up becoming “write-only” code. You will need to consider that vast parts of .NET-land have never seen this stuff before. You will be ready to explain and justify why and how this stuff improves things. In 2020, you will curse, and maybe throw a chair or two, because of some abuse of dynamic some schmuck did in 2010 in that 10 year old code base. There is a good chance that schmuck will be me 
  • 25. Thank You! aaron.c.erickson@gmail.com twitter.com/aaronerickson http://nomadic-developer.com/

Notas do Editor

  1. You may not eliminate state in your more traditional OO system, nor will you in an FP/OO hybrid – but you will likely make sure that things that manipulate state are seperated from things that ask questions. Question for audience – what are some common exceptions?
  2. You may not eliminate state in your more traditional OO system, nor will you in an FP/OO hybrid – but you will likely make sure that things that manipulate state are seperated from things that ask questions. Question for audience – what are some common exceptions?
  3. You may not eliminate state in your more traditional OO system, nor will you in an FP/OO hybrid – but you will likely make sure that things that manipulate state are seperated from things that ask questions. Question for audience – what are some common exceptions?
  4. You may not eliminate state in your more traditional OO system, nor will you in an FP/OO hybrid – but you will likely make sure that things that manipulate state are seperated from things that ask questions. Question for audience – what are some common exceptions?