SlideShare une entreprise Scribd logo
1  sur  12
Static typing vs Dynamic Typing
languages
A paradigm of computer language, based on compiler’s and interpreter’s behavior
Do you know why these applications work so swiftly without giving errors for
the things that may happen but they don’t happen
Compiled vs. Interpreted
“When source code is translated”
 Source Code: Original code (usually typed by a human into a computer)
 Translation: Converting source code into something a computer can read (i.e. machine
code)
 Run-Time: Period when program is executing commands (after compilation, if
compiled)
 Compiled: Code translated before run-time
 Interpreted: Code translated on the fly, during execution
Typing
“When types are checked”
"3" + 5 will raise a type error in strongly typed languages, such as Python and Go, because they
don't allow for "type coercion": the ability for a value to change type implicitly in certain contexts
(e.g. merging two types using +). Weakly typed languages, such as JavaScript, won't throw a type
error (result: '35').
•Static: Types checked before run-time
•Dynamic: Types checked on the fly, during execution
Type-checking has nothing to do with the language being
compiled or interpreted! You need to separate these
terms conceptually.
Python Example (Dynamic, Interpreted)
def foo(a):
if a > 0:
print 'Hi'
else:
print "3" + 5
foo(2)
Because Python is both
interpreted and dynamically
typed, it only translates and
type-checks code it’s
executing on. The else block
never executes, so "3" + 5 is
never even looked at!
What if it was statically typed?
 A type error would be thrown before the code is even run. It still performs type-checking
before run-time even though it is interpreted.
What if it was compiled?
 A type error would be thrown before the code is even run. It still performs type-checking
before run-time even though it is interpreted.
Go Example (Static, Compiled)
package main
import ("fmt")
func foo(a int) {
if (a > 0) {
fmt.Println("Hi")
}
else {
fmt.Println("3" + 5)
}
}
func main() {
foo(2)
}
The types are checked before
running (static) and the type
error is immediately caught!
The types would still be checked before run-time
if it was interpreted, having the same result. If it
was dynamic, it wouldn’t throw any errors even
though the code would be looked at during
compilation.
Performance
 A compiled language will have better performance at run-time if it’s statically typed because the
knowledge of types allows for machine code optimization.
 Statically typed languages have better performance at run-time intrinsically due to not needing
to check types dynamically while executing (it checks before running).
 Similarly, compiled languages are faster at run time as the code has already been translated
instead of needing to “interpret”/translate it on the fly.
 Note that both compiled and statically typed languages will have a delay before running for
translation and type-checking, respectively.
Catching up Error
 Static typing catches errors early, instead of finding them during execution (especially useful for
long programs). It’s more “strict” in that it won’t allow for type errors anywhere in your program
and often prevents variables from changing types, which further defends against unintended
errors.
num = 2
num = '3' // ERROR
 Dynamic typing is more flexible (which some appreciate) but allows for variables to change types
(sometimes creating unexpected errors).
Dynamically Interpreted Languages
 AppleScript
 Erlang (compiled into Erlang bytecode and
interpreted by the BEAM VM)
 Elixir (runs on the Erlang VM)
 Java (is compiled into Java bytecode to be
interpreted by JVM)
 Clojure
 Groovy
 Kotlin
 ColdFusion
 Scala
 Lisp
 Lua
 Pike
 .NET Framework languages (translated to bytecode,
called CIL).
 C++/CLI
 C#
 Visual Basic .NET
 F#
 Python (compiled into Python bytecode and
interpreted by CPython)
 Squeak Smalltalk
 Visual FoxPro
https://hackernoon.com/i-finally-understand-static-vs-dynamic-typing-and-you-will-too-ad0c2bd0acc7
End Note
It all depends upon the compiler that compiles the script.

Contenu connexe

Tendances

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAndres Baravalle
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#Hawkman Academy
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/jsKnoldus Inc.
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overviewOleksii Prohonnyi
 
Android application structure
Android application structureAndroid application structure
Android application structureAlexey Ustenko
 
Code Optimization
Code OptimizationCode Optimization
Code Optimizationguest9f8315
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaAtul Sehdev
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.netDeep Patel
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging TechniquesWebStackAcademy
 

Tendances (20)

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#
 
4. features of .net
4. features of .net4. features of .net
4. features of .net
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overview
 
Ide description
Ide descriptionIde description
Ide description
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Javascript
JavascriptJavascript
Javascript
 
C# basics
 C# basics C# basics
C# basics
 
Android application structure
Android application structureAndroid application structure
Android application structure
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Visual Studio IDE
Visual Studio IDEVisual Studio IDE
Visual Studio IDE
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in java
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.net
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
 

Similaire à Static typing vs dynamic typing languages

Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processorsRebaz Najeeb
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptxVishwas459764
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfDrIsikoIsaac
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfDrIsikoIsaac
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilersAftab Ahmad
 
Go language presentation
Go language presentationGo language presentation
Go language presentationparamisoft
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution pptKeerty Smile
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxdawod yimer
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl TranslatorCma Mohd
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overviewamudha arul
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxRossy719186
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptxssuser3b4934
 

Similaire à Static typing vs dynamic typing languages (20)

Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
3.2
3.23.2
3.2
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptx
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
Language translators
Language translatorsLanguage translators
Language translators
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilers
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptx
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 

Plus de Jawad Khan

2.1 input and output in c
2.1 input and output in c2.1 input and output in c
2.1 input and output in cJawad Khan
 
2.2 variable arithmetics and logics
2.2 variable arithmetics and logics2.2 variable arithmetics and logics
2.2 variable arithmetics and logicsJawad Khan
 
1.2 programming fundamentals
1.2 programming fundamentals1.2 programming fundamentals
1.2 programming fundamentalsJawad Khan
 
1.1 programming fundamentals
1.1 programming fundamentals1.1 programming fundamentals
1.1 programming fundamentalsJawad Khan
 
7 8. emi - analog instruments and digital instruments
7 8. emi - analog instruments and digital instruments7 8. emi - analog instruments and digital instruments
7 8. emi - analog instruments and digital instrumentsJawad Khan
 
6. emi instrument transformers (with marking)
6. emi   instrument transformers (with marking)6. emi   instrument transformers (with marking)
6. emi instrument transformers (with marking)Jawad Khan
 
5 emi ac bridges (with marking)
5 emi  ac bridges (with marking)5 emi  ac bridges (with marking)
5 emi ac bridges (with marking)Jawad Khan
 
4. emi potentiometer and ac bridges
4. emi  potentiometer and ac bridges4. emi  potentiometer and ac bridges
4. emi potentiometer and ac bridgesJawad Khan
 
3 .emi wattmeter and energy meter
3 .emi   wattmeter and energy meter3 .emi   wattmeter and energy meter
3 .emi wattmeter and energy meterJawad Khan
 
2. emi analog electromechanical instruments
2. emi  analog electromechanical instruments2. emi  analog electromechanical instruments
2. emi analog electromechanical instrumentsJawad Khan
 
1. emi concept of measurement system
1. emi   concept of measurement system1. emi   concept of measurement system
1. emi concept of measurement systemJawad Khan
 
Varibale frequency response lecturer 2 - audio+
Varibale frequency response   lecturer 2 - audio+Varibale frequency response   lecturer 2 - audio+
Varibale frequency response lecturer 2 - audio+Jawad Khan
 
Variable frequency response lecture 3 - audio
Variable frequency response   lecture 3 - audioVariable frequency response   lecture 3 - audio
Variable frequency response lecture 3 - audioJawad Khan
 
Varibale frequency response lecturer 1 - audio
Varibale frequency response   lecturer 1 - audioVaribale frequency response   lecturer 1 - audio
Varibale frequency response lecturer 1 - audioJawad Khan
 
Two port network - part 3
Two port network - part 3Two port network - part 3
Two port network - part 3Jawad Khan
 
Two port network - part 2
Two port network - part 2Two port network - part 2
Two port network - part 2Jawad Khan
 
Two port network - part 1
Two port network - part 1Two port network - part 1
Two port network - part 1Jawad Khan
 
4. ideal transformer and load conversion
4. ideal transformer and load conversion4. ideal transformer and load conversion
4. ideal transformer and load conversionJawad Khan
 
3. magnetic coupled circuits examples
3. magnetic coupled circuits examples3. magnetic coupled circuits examples
3. magnetic coupled circuits examplesJawad Khan
 
2. magnetic coupled circuits
2. magnetic coupled circuits2. magnetic coupled circuits
2. magnetic coupled circuitsJawad Khan
 

Plus de Jawad Khan (20)

2.1 input and output in c
2.1 input and output in c2.1 input and output in c
2.1 input and output in c
 
2.2 variable arithmetics and logics
2.2 variable arithmetics and logics2.2 variable arithmetics and logics
2.2 variable arithmetics and logics
 
1.2 programming fundamentals
1.2 programming fundamentals1.2 programming fundamentals
1.2 programming fundamentals
 
1.1 programming fundamentals
1.1 programming fundamentals1.1 programming fundamentals
1.1 programming fundamentals
 
7 8. emi - analog instruments and digital instruments
7 8. emi - analog instruments and digital instruments7 8. emi - analog instruments and digital instruments
7 8. emi - analog instruments and digital instruments
 
6. emi instrument transformers (with marking)
6. emi   instrument transformers (with marking)6. emi   instrument transformers (with marking)
6. emi instrument transformers (with marking)
 
5 emi ac bridges (with marking)
5 emi  ac bridges (with marking)5 emi  ac bridges (with marking)
5 emi ac bridges (with marking)
 
4. emi potentiometer and ac bridges
4. emi  potentiometer and ac bridges4. emi  potentiometer and ac bridges
4. emi potentiometer and ac bridges
 
3 .emi wattmeter and energy meter
3 .emi   wattmeter and energy meter3 .emi   wattmeter and energy meter
3 .emi wattmeter and energy meter
 
2. emi analog electromechanical instruments
2. emi  analog electromechanical instruments2. emi  analog electromechanical instruments
2. emi analog electromechanical instruments
 
1. emi concept of measurement system
1. emi   concept of measurement system1. emi   concept of measurement system
1. emi concept of measurement system
 
Varibale frequency response lecturer 2 - audio+
Varibale frequency response   lecturer 2 - audio+Varibale frequency response   lecturer 2 - audio+
Varibale frequency response lecturer 2 - audio+
 
Variable frequency response lecture 3 - audio
Variable frequency response   lecture 3 - audioVariable frequency response   lecture 3 - audio
Variable frequency response lecture 3 - audio
 
Varibale frequency response lecturer 1 - audio
Varibale frequency response   lecturer 1 - audioVaribale frequency response   lecturer 1 - audio
Varibale frequency response lecturer 1 - audio
 
Two port network - part 3
Two port network - part 3Two port network - part 3
Two port network - part 3
 
Two port network - part 2
Two port network - part 2Two port network - part 2
Two port network - part 2
 
Two port network - part 1
Two port network - part 1Two port network - part 1
Two port network - part 1
 
4. ideal transformer and load conversion
4. ideal transformer and load conversion4. ideal transformer and load conversion
4. ideal transformer and load conversion
 
3. magnetic coupled circuits examples
3. magnetic coupled circuits examples3. magnetic coupled circuits examples
3. magnetic coupled circuits examples
 
2. magnetic coupled circuits
2. magnetic coupled circuits2. magnetic coupled circuits
2. magnetic coupled circuits
 

Dernier

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 

Dernier (20)

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 

Static typing vs dynamic typing languages

  • 1. Static typing vs Dynamic Typing languages A paradigm of computer language, based on compiler’s and interpreter’s behavior
  • 2. Do you know why these applications work so swiftly without giving errors for the things that may happen but they don’t happen
  • 3. Compiled vs. Interpreted “When source code is translated”  Source Code: Original code (usually typed by a human into a computer)  Translation: Converting source code into something a computer can read (i.e. machine code)  Run-Time: Period when program is executing commands (after compilation, if compiled)  Compiled: Code translated before run-time  Interpreted: Code translated on the fly, during execution
  • 4. Typing “When types are checked” "3" + 5 will raise a type error in strongly typed languages, such as Python and Go, because they don't allow for "type coercion": the ability for a value to change type implicitly in certain contexts (e.g. merging two types using +). Weakly typed languages, such as JavaScript, won't throw a type error (result: '35'). •Static: Types checked before run-time •Dynamic: Types checked on the fly, during execution
  • 5. Type-checking has nothing to do with the language being compiled or interpreted! You need to separate these terms conceptually.
  • 6. Python Example (Dynamic, Interpreted) def foo(a): if a > 0: print 'Hi' else: print "3" + 5 foo(2) Because Python is both interpreted and dynamically typed, it only translates and type-checks code it’s executing on. The else block never executes, so "3" + 5 is never even looked at!
  • 7. What if it was statically typed?  A type error would be thrown before the code is even run. It still performs type-checking before run-time even though it is interpreted. What if it was compiled?  A type error would be thrown before the code is even run. It still performs type-checking before run-time even though it is interpreted.
  • 8. Go Example (Static, Compiled) package main import ("fmt") func foo(a int) { if (a > 0) { fmt.Println("Hi") } else { fmt.Println("3" + 5) } } func main() { foo(2) } The types are checked before running (static) and the type error is immediately caught! The types would still be checked before run-time if it was interpreted, having the same result. If it was dynamic, it wouldn’t throw any errors even though the code would be looked at during compilation.
  • 9. Performance  A compiled language will have better performance at run-time if it’s statically typed because the knowledge of types allows for machine code optimization.  Statically typed languages have better performance at run-time intrinsically due to not needing to check types dynamically while executing (it checks before running).  Similarly, compiled languages are faster at run time as the code has already been translated instead of needing to “interpret”/translate it on the fly.  Note that both compiled and statically typed languages will have a delay before running for translation and type-checking, respectively.
  • 10. Catching up Error  Static typing catches errors early, instead of finding them during execution (especially useful for long programs). It’s more “strict” in that it won’t allow for type errors anywhere in your program and often prevents variables from changing types, which further defends against unintended errors. num = 2 num = '3' // ERROR  Dynamic typing is more flexible (which some appreciate) but allows for variables to change types (sometimes creating unexpected errors).
  • 11. Dynamically Interpreted Languages  AppleScript  Erlang (compiled into Erlang bytecode and interpreted by the BEAM VM)  Elixir (runs on the Erlang VM)  Java (is compiled into Java bytecode to be interpreted by JVM)  Clojure  Groovy  Kotlin  ColdFusion  Scala  Lisp  Lua  Pike  .NET Framework languages (translated to bytecode, called CIL).  C++/CLI  C#  Visual Basic .NET  F#  Python (compiled into Python bytecode and interpreted by CPython)  Squeak Smalltalk  Visual FoxPro https://hackernoon.com/i-finally-understand-static-vs-dynamic-typing-and-you-will-too-ad0c2bd0acc7
  • 12. End Note It all depends upon the compiler that compiles the script.