SlideShare a Scribd company logo
Computer Language Design and
Implementation meetup March 6, 2014

Cat people vs dog people
The great static vs dynamic typing debate
Terence Parr
University of San Francisco
(You’re all wrong, I’m right)
Definitions

(strong vs weak vs untyped)

● Static typing: compiler knows the type of
every expression (using type inference here)
var i = 3; var j = [“parrt”,”ollie”,”kay”];

● Explicit static typing: coder gives type
int i;
List<String> a = new ArrayList<String>();
Explicit doesn’t
mean “dirty”
var dog : shit
yes, a puppy dies every time you type this
Definitions Cont’d
● Dynamic typing: compiler ignores types,
values’ types known only at runtime
● “Duck typing”: structural dynamic typing; i.e.,
the name (nominative) doesn’t matter, only
the member list (Java uses interfaces)
class A: {var name}
class B: {var name}
def f(x): {print x.name}

f(new A())
f(new B())
Eric Lippert from stackoverflow
● “it is hard to maintain a large codebase, period”
● “there is a strong correlation between a language
being dynamically typed and a language also lacking
all the other facilities that make lowering the cost of
maintaining a large codebase easier”

● So, to focus on static versus dynamic
argument, let’s assume...
Assumptions
● Comparing two identical languages, one with
and one w/o static typing
● Language has modern facilities to support
large projects: modules, perhaps objects,
encapsulation, data hiding, etc…
○ E.g., javascript missing lots of that

● Large projects not small scripts
Can we agree...
● Coder must know (partial) types statically or
(s)he can’t access appropriate fields, funcs:
o.name, o.save()
● With perfect human memory of your own
code, no explicit types needed...
● ...but what if we call foreign library function
or work on a team (i.e., all of us)?
● Must read lib code or doc to learn types
Reality
● Can’t remember type of all vars/funcs in
large project (even solo project)
● We have to read lots of code every day
○ We work in teams
○ We use lots of libraries
○ Either we compute type or we read annotation

● Code always morphs over time
○ Explicit type info identifies key variable constraints
○ Code changes but do we update doc always?
Static typing burdens
1. Much faster to physically enter code w/o annotating
variables with type info (don’t overestimate this cost)
2. Type annotations can clutter code
3. Harder for newbies to get rolling?
4. Type systems can add a lot of complexity to the
language: Java’s generics, Scala, ...
5. Python (others) has structural type equivalence (duck
typing) vs nominative (naming) for most static
languages
○ Convenient if we care just that obj answers size()
○ Java requires creation of an interface
Dynamic typing burdens
● We exchange type annotation in code with
unit/functional testing just to catch typos o.
feild, o.methud(). More tests in general
● Should informally add type info in doc, a 2nd
spec we must keep in sync
● Lippert: Need “good discipline about naming
conventions, about division of responsibilities, about
what the public surface of a given object is, and so on.”
Dynamic typing collateral damage
● Often less efficient
● Re-factoring challenging, dangerous, or
impossible; can’t even rename safely
● Can’t do auto-completion, find
usages/implementations, …
● Changes to type assumptions (in libs, code)
introduce hidden landmines
● Can be more effort to read (computing
A compromise
● Annotate: fields (unless initialized), args,
return values
● Generics only on built-in types?
● At the very least, use runtime generic type
parameters to allow covariance
List<? extends Animal> d=...;
d.add(new Dog());

● Type inference inside method bodies
● Allow plausible downcasting
Jesus cries every time javac disallows this
Sample compromise class
class Person { … }
class User : Person {
val BADID = 0
var id : string
def permissions(name : string) : int {
val m = Services.getFileManager()
val f = m.getFile(name)
return f.permissions(this.id)
}
}
var p : Person = new User()
var mask = p.permissions(new file(“...”)) // downcast
Speculation
● Static typing is seen as old-school. Younger
programmers are always excited by the latest
languages and these languages happen to be
dynamically typed: JavaScript, Python, Ruby. Scala
is the counterexample (others?)
● With experience, comes the pain of maintenance
which motivates static typing
● I.e., there is a strong correlation between dynamic
typing and youth
Summary
● Static + inferred typing is good, umkay?
● Dynamic typing is great for scripts but not
large programs, umkay?
● Yes, we old farts rely more and more on
static typing as our brains disintegrate
● People study this empirically
see e.g., Andreas Stefik
Ad

More Related Content

What's hot (15)

Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Andy Juan Sarango Veliz
 
Practica 1 Expresiones lógicas de PLC
Practica 1 Expresiones lógicas de PLC Practica 1 Expresiones lógicas de PLC
Practica 1 Expresiones lógicas de PLC
SANTIAGO PABLO ALBERTO
 
Industrial Training Report on PLC & SCADA
Industrial Training Report on PLC & SCADAIndustrial Training Report on PLC & SCADA
Industrial Training Report on PLC & SCADA
Aman Jaiswal
 
Tipos de controles controles automaticos
Tipos de controles   controles automaticosTipos de controles   controles automaticos
Tipos de controles controles automaticos
Deivis Montilla
 
Lecture 7 modelling-of__real_world_systems
Lecture 7 modelling-of__real_world_systemsLecture 7 modelling-of__real_world_systems
Lecture 7 modelling-of__real_world_systems
Saifullah Memon
 
Multistage transistor
Multistage transistorMultistage transistor
Multistage transistor
Mohammad Shakirul islam
 
State space analysis shortcut rules
State space analysis shortcut rulesState space analysis shortcut rules
State space analysis shortcut rules
Prajakta Pardeshi
 
Training report of PLC
Training report of PLCTraining report of PLC
Training report of PLC
Sumit Patidar
 
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
SANTIAGO PABLO ALBERTO
 
electrio
electrioelectrio
electrio
Samuel Malpica Villazana
 
PLC Troubleshooting & Maintenance.pdf
PLC Troubleshooting & Maintenance.pdfPLC Troubleshooting & Maintenance.pdf
PLC Troubleshooting & Maintenance.pdf
UmutERGENE
 
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
SANTIAGO PABLO ALBERTO
 
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdfejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
Nercy Karen Limachi Quispe
 
Industrial Automation
Industrial AutomationIndustrial Automation
Industrial Automation
Syed Atif Naseem
 
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
SANTIAGO PABLO ALBERTO
 
Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Matemática V - Facultad de Ingeniería Eléctrica y Electrónica de la Universid...
Andy Juan Sarango Veliz
 
Practica 1 Expresiones lógicas de PLC
Practica 1 Expresiones lógicas de PLC Practica 1 Expresiones lógicas de PLC
Practica 1 Expresiones lógicas de PLC
SANTIAGO PABLO ALBERTO
 
Industrial Training Report on PLC & SCADA
Industrial Training Report on PLC & SCADAIndustrial Training Report on PLC & SCADA
Industrial Training Report on PLC & SCADA
Aman Jaiswal
 
Tipos de controles controles automaticos
Tipos de controles   controles automaticosTipos de controles   controles automaticos
Tipos de controles controles automaticos
Deivis Montilla
 
Lecture 7 modelling-of__real_world_systems
Lecture 7 modelling-of__real_world_systemsLecture 7 modelling-of__real_world_systems
Lecture 7 modelling-of__real_world_systems
Saifullah Memon
 
State space analysis shortcut rules
State space analysis shortcut rulesState space analysis shortcut rules
State space analysis shortcut rules
Prajakta Pardeshi
 
Training report of PLC
Training report of PLCTraining report of PLC
Training report of PLC
Sumit Patidar
 
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
PLC: Sistemas programables avanzados PLC paraninfo por José Antonio Mercado F...
SANTIAGO PABLO ALBERTO
 
PLC Troubleshooting & Maintenance.pdf
PLC Troubleshooting & Maintenance.pdfPLC Troubleshooting & Maintenance.pdf
PLC Troubleshooting & Maintenance.pdf
UmutERGENE
 
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
PLC y Electroneumática: Automatismos eléctricos e industriales por José Luis ...
SANTIAGO PABLO ALBERTO
 
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdfejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
ejercicios_3 ERROR EN ESTADO ESTACIONARIO (1).pdf
Nercy Karen Limachi Quispe
 
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
Electrónica: Electrónica Industrial y Automatización de CEKIT Parte 1
SANTIAGO PABLO ALBERTO
 

Viewers also liked (17)

How to build a virtual machine
How to build a virtual machineHow to build a virtual machine
How to build a virtual machine
Terence Parr
 
Dc machines electrical machines – i
Dc machines   electrical machines – iDc machines   electrical machines – i
Dc machines electrical machines – i
Soumyadeep Nag
 
Dynamic analysis of dc machine
Dynamic analysis of dc machineDynamic analysis of dc machine
Dynamic analysis of dc machine
Ramesh Babu
 
Gas turbine-power-plant[1]
Gas turbine-power-plant[1]Gas turbine-power-plant[1]
Gas turbine-power-plant[1]
Manish Sadhu
 
Ai Slides
Ai SlidesAi Slides
Ai Slides
guestefaab0
 
Basics of Electrical Machines
Basics of Electrical MachinesBasics of Electrical Machines
Basics of Electrical Machines
maneesh001
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
Saurabh Kumar
 
Distributed Generation
Distributed Generation Distributed Generation
Distributed Generation
Anshul Shrivastava
 
Electrical Machines Notes
Electrical Machines NotesElectrical Machines Notes
Electrical Machines Notes
Akshansh Chaudhary
 
Electric machine
Electric machineElectric machine
Electric machine
ashok261084
 
power plant engineering
power plant engineeringpower plant engineering
power plant engineering
Gulfaraz alam
 
Electric power transmission system engineering 2nd edition by turan gonen
Electric power transmission system engineering  2nd edition by turan gonenElectric power transmission system engineering  2nd edition by turan gonen
Electric power transmission system engineering 2nd edition by turan gonen
Ummi Robbania Mushthofa
 
Lecture 25 induction. faradays law. lenz law
Lecture 25   induction. faradays law. lenz lawLecture 25   induction. faradays law. lenz law
Lecture 25 induction. faradays law. lenz law
Albania Energy Association
 
Power plant engineering complete five unit vtu notes pdf download
Power plant engineering complete five unit vtu notes pdf downloadPower plant engineering complete five unit vtu notes pdf download
Power plant engineering complete five unit vtu notes pdf download
kiran555555
 
12.1 - Lenz's law
12.1  - Lenz's law12.1  - Lenz's law
12.1 - Lenz's law
simonandisa
 
Powerpoint presentation about lenz's law
Powerpoint presentation about lenz's lawPowerpoint presentation about lenz's law
Powerpoint presentation about lenz's law
rdelizoneyou
 
Data acquisition system (DAS)
Data acquisition system (DAS)Data acquisition system (DAS)
Data acquisition system (DAS)
Sumeet Patel
 
How to build a virtual machine
How to build a virtual machineHow to build a virtual machine
How to build a virtual machine
Terence Parr
 
Dc machines electrical machines – i
Dc machines   electrical machines – iDc machines   electrical machines – i
Dc machines electrical machines – i
Soumyadeep Nag
 
Dynamic analysis of dc machine
Dynamic analysis of dc machineDynamic analysis of dc machine
Dynamic analysis of dc machine
Ramesh Babu
 
Gas turbine-power-plant[1]
Gas turbine-power-plant[1]Gas turbine-power-plant[1]
Gas turbine-power-plant[1]
Manish Sadhu
 
Basics of Electrical Machines
Basics of Electrical MachinesBasics of Electrical Machines
Basics of Electrical Machines
maneesh001
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
Saurabh Kumar
 
Electric machine
Electric machineElectric machine
Electric machine
ashok261084
 
power plant engineering
power plant engineeringpower plant engineering
power plant engineering
Gulfaraz alam
 
Electric power transmission system engineering 2nd edition by turan gonen
Electric power transmission system engineering  2nd edition by turan gonenElectric power transmission system engineering  2nd edition by turan gonen
Electric power transmission system engineering 2nd edition by turan gonen
Ummi Robbania Mushthofa
 
Power plant engineering complete five unit vtu notes pdf download
Power plant engineering complete five unit vtu notes pdf downloadPower plant engineering complete five unit vtu notes pdf download
Power plant engineering complete five unit vtu notes pdf download
kiran555555
 
12.1 - Lenz's law
12.1  - Lenz's law12.1  - Lenz's law
12.1 - Lenz's law
simonandisa
 
Powerpoint presentation about lenz's law
Powerpoint presentation about lenz's lawPowerpoint presentation about lenz's law
Powerpoint presentation about lenz's law
rdelizoneyou
 
Data acquisition system (DAS)
Data acquisition system (DAS)Data acquisition system (DAS)
Data acquisition system (DAS)
Sumeet Patel
 
Ad

Similar to Static vs dynamic types (20)

Flow or Type - how to React to that?
Flow or Type - how to React to that?Flow or Type - how to React to that?
Flow or Type - how to React to that?
Krešimir Antolić
 
DTS s03e04 Typing
DTS s03e04 TypingDTS s03e04 Typing
DTS s03e04 Typing
Tuenti
 
Modern_2.pptx for java
Modern_2.pptx for java Modern_2.pptx for java
Modern_2.pptx for java
MayaTofik
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
Basuk
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
Javier Arias Losada
 
Tools for the Toolmakers
Tools for the ToolmakersTools for the Toolmakers
Tools for the Toolmakers
Caleb Callaway
 
A Brief Introduction to Scala for Java Developers
A Brief Introduction to Scala for Java DevelopersA Brief Introduction to Scala for Java Developers
A Brief Introduction to Scala for Java Developers
Miles Sabin
 
Miles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java DevelopersMiles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java Developers
Skills Matter
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
PranavSB
 
UNIT 1 .pptx
UNIT 1                                                .pptxUNIT 1                                                .pptx
UNIT 1 .pptx
Prachi Gawande
 
Unsafe to typesafe
Unsafe to typesafeUnsafe to typesafe
Unsafe to typesafe
regisleray
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
Talentica Software
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
Chui-Wen Chiu
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
ASIT Education
 
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016
Milano JS Meetup -  Gabriele Petronella - Codemotion Milan 2016Milano JS Meetup -  Gabriele Petronella - Codemotion Milan 2016
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016
Codemotion
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java Developers
Miles Sabin
 
An Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersAn Introduction to Scala for Java Developers
An Introduction to Scala for Java Developers
Miles Sabin
 
Full CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java languageFull CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java language
ssuser2963071
 
Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
Flow or Type - how to React to that?
Flow or Type - how to React to that?Flow or Type - how to React to that?
Flow or Type - how to React to that?
Krešimir Antolić
 
DTS s03e04 Typing
DTS s03e04 TypingDTS s03e04 Typing
DTS s03e04 Typing
Tuenti
 
Modern_2.pptx for java
Modern_2.pptx for java Modern_2.pptx for java
Modern_2.pptx for java
MayaTofik
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
Basuk
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
Javier Arias Losada
 
Tools for the Toolmakers
Tools for the ToolmakersTools for the Toolmakers
Tools for the Toolmakers
Caleb Callaway
 
A Brief Introduction to Scala for Java Developers
A Brief Introduction to Scala for Java DevelopersA Brief Introduction to Scala for Java Developers
A Brief Introduction to Scala for Java Developers
Miles Sabin
 
Miles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java DevelopersMiles Sabin Introduction To Scala For Java Developers
Miles Sabin Introduction To Scala For Java Developers
Skills Matter
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
PranavSB
 
Unsafe to typesafe
Unsafe to typesafeUnsafe to typesafe
Unsafe to typesafe
regisleray
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
Talentica Software
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
ASIT Education
 
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016
Milano JS Meetup -  Gabriele Petronella - Codemotion Milan 2016Milano JS Meetup -  Gabriele Petronella - Codemotion Milan 2016
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016
Codemotion
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java Developers
Miles Sabin
 
An Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersAn Introduction to Scala for Java Developers
An Introduction to Scala for Java Developers
Miles Sabin
 
Full CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java languageFull CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java language
ssuser2963071
 
Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
Ad

Recently uploaded (20)

Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 

Static vs dynamic types

  • 1. Computer Language Design and Implementation meetup March 6, 2014 Cat people vs dog people The great static vs dynamic typing debate Terence Parr University of San Francisco (You’re all wrong, I’m right)
  • 2. Definitions (strong vs weak vs untyped) ● Static typing: compiler knows the type of every expression (using type inference here) var i = 3; var j = [“parrt”,”ollie”,”kay”]; ● Explicit static typing: coder gives type int i; List<String> a = new ArrayList<String>(); Explicit doesn’t mean “dirty” var dog : shit yes, a puppy dies every time you type this
  • 3. Definitions Cont’d ● Dynamic typing: compiler ignores types, values’ types known only at runtime ● “Duck typing”: structural dynamic typing; i.e., the name (nominative) doesn’t matter, only the member list (Java uses interfaces) class A: {var name} class B: {var name} def f(x): {print x.name} f(new A()) f(new B())
  • 4. Eric Lippert from stackoverflow ● “it is hard to maintain a large codebase, period” ● “there is a strong correlation between a language being dynamically typed and a language also lacking all the other facilities that make lowering the cost of maintaining a large codebase easier” ● So, to focus on static versus dynamic argument, let’s assume...
  • 5. Assumptions ● Comparing two identical languages, one with and one w/o static typing ● Language has modern facilities to support large projects: modules, perhaps objects, encapsulation, data hiding, etc… ○ E.g., javascript missing lots of that ● Large projects not small scripts
  • 6. Can we agree... ● Coder must know (partial) types statically or (s)he can’t access appropriate fields, funcs: o.name, o.save() ● With perfect human memory of your own code, no explicit types needed... ● ...but what if we call foreign library function or work on a team (i.e., all of us)? ● Must read lib code or doc to learn types
  • 7. Reality ● Can’t remember type of all vars/funcs in large project (even solo project) ● We have to read lots of code every day ○ We work in teams ○ We use lots of libraries ○ Either we compute type or we read annotation ● Code always morphs over time ○ Explicit type info identifies key variable constraints ○ Code changes but do we update doc always?
  • 8. Static typing burdens 1. Much faster to physically enter code w/o annotating variables with type info (don’t overestimate this cost) 2. Type annotations can clutter code 3. Harder for newbies to get rolling? 4. Type systems can add a lot of complexity to the language: Java’s generics, Scala, ... 5. Python (others) has structural type equivalence (duck typing) vs nominative (naming) for most static languages ○ Convenient if we care just that obj answers size() ○ Java requires creation of an interface
  • 9. Dynamic typing burdens ● We exchange type annotation in code with unit/functional testing just to catch typos o. feild, o.methud(). More tests in general ● Should informally add type info in doc, a 2nd spec we must keep in sync ● Lippert: Need “good discipline about naming conventions, about division of responsibilities, about what the public surface of a given object is, and so on.”
  • 10. Dynamic typing collateral damage ● Often less efficient ● Re-factoring challenging, dangerous, or impossible; can’t even rename safely ● Can’t do auto-completion, find usages/implementations, … ● Changes to type assumptions (in libs, code) introduce hidden landmines ● Can be more effort to read (computing
  • 11. A compromise ● Annotate: fields (unless initialized), args, return values ● Generics only on built-in types? ● At the very least, use runtime generic type parameters to allow covariance List<? extends Animal> d=...; d.add(new Dog()); ● Type inference inside method bodies ● Allow plausible downcasting Jesus cries every time javac disallows this
  • 12. Sample compromise class class Person { … } class User : Person { val BADID = 0 var id : string def permissions(name : string) : int { val m = Services.getFileManager() val f = m.getFile(name) return f.permissions(this.id) } } var p : Person = new User() var mask = p.permissions(new file(“...”)) // downcast
  • 13. Speculation ● Static typing is seen as old-school. Younger programmers are always excited by the latest languages and these languages happen to be dynamically typed: JavaScript, Python, Ruby. Scala is the counterexample (others?) ● With experience, comes the pain of maintenance which motivates static typing ● I.e., there is a strong correlation between dynamic typing and youth
  • 14. Summary ● Static + inferred typing is good, umkay? ● Dynamic typing is great for scripts but not large programs, umkay? ● Yes, we old farts rely more and more on static typing as our brains disintegrate ● People study this empirically see e.g., Andreas Stefik
  翻译: