SlideShare a Scribd company logo
Modern Programming
Languages - Overview
Ayman Mahfouz
July 2018
With Kotlin as an Example
Biography
- VP of Engineering at Webalo (webalo.com)
- Los Angeles based
- Branch in Alexandria
- UX4IIoT
- 20+ years of software development
- PhD. in software engineering
- BSc. Computer Science - Alexandria 1997
Programming Languages
Pascal C C++
Java
Python C# Objective-C ActionScript
Scala Ruby Octave
JavaScript
Go TypeScript Kotlin
BASIC
Swift Groovy
Why Many Languages Exist?
Optimized for different objectives
● Productivity
● Readability
● Portability
● Performance
○ Compile-time
○ Runtime
Some Notable Languages
Released By Notes
Groovy 2007 Pivotal Concise, easy-to learn, Java-interoperable, scripting
language for the JVM.
Go 2009 Google High-speed compilation compared to C , built-in
support for concurrency.
Swift 2014 Apple Many safety and syntax improvements to replace
Objective-C.
Kotlin 2016 JetBrains Designed to be “better than Java” - Interoperable for
incremental migration.
Kotlin Arrives!
● Paid little attention until Google I/O announcement.
● Android Studio Canary 3.
● Immediately fell in love
○ Strong Typing
○ Brevity
○ Expressiveness
○ Interoperability
○ Growing support
● Starts from where others ended (Java, Python, Go, Swift)
● One app built on github.
● Still learning.
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Features we will go through:
Brevity
In Java, one would normally write this:
With my background, I translated this into Kotlin verbatim:
Not idiomatic but still
shorter! Can you spot
the omissions?
● No ;
● No “new”
● “override” is a modifier
● “:” not “implements”
● “public” is default
● Return type
In Java one would typically write code like this:
Brevity
Using “Single Expression Function” syntax
Pass a lambda expression to a function that accepts a single-method interface
Brevity
Omit parameter type
Omit parameter name as well
Eliminate left hand side completely
Lambda expression only argument so we can eliminate the parenthesis
Omit parameter type
Brevity - From Java to Kotlin
to Kotlin ...
From Java ...
We will go through:
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Null Safety - Explicit handling
The dreaded NPE
Handle explicitly
Null Safety - Java Optionals
Handle via Java 8 Optionals - very verbose!
Handle by convention:
- Special member naming (IfAny)
- Null checks in constructor
- Hand-coded
- Annotations
- Aspects
Or let it throw! (pun intended)
Null Safety - Safe Navigation
Kotlin safe navigation operator
Compile-time language-enforced null safety
Forced init
Force null guard
Allowing late init
Conscious NPE
We will go through:
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Conditionals
I cringe when I see if statements that look like this
Use the ternary operator please!
Conditionals - Expressions
In Kotlin, if statement is an expression
Combined with single expression function shorthand
So you can write a function like this
Conditionals - when
I hate “Switch” statements!
But I love “when” expressions!
1. No annoying “break” or even “case”
2. Match against any type
3. Switch variable can be of any type
4. The “else” section is mandatory
We will go through:
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Smart Cast
In Java explicit cast is needed
In Kotlin Smart Cast takes place automatically
Smart Cast
In Java
Smart Cast
In Kotlin
Smart Cast - Nullables
Automatic cast to non-null
We will go through:
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Lambdas
Think of it as a “function literal”
The function “Array” produces an array by applying a lambda
Lambdas - Higher-order Functions
Higher-order functions: functions that take other functions as arguments
Lambdas - Closures
Closures: lambdas can access variables in their outer scope
We will go through:
Brevity
Null Safety
Conditionals
Smart Cast
Lambdas
Collections
Collections
With Lambdas
it
Collections - Streaming
Chaining lambda operations
Collections - Immutability
In Java both mutable and immutable collections implement the same interface
Kotlin uses different interfaces - Compile error
What about the others?
● Brevity
○ No semicolons
○ Optional “return”
○ Variable types
○ Omit parens in a call
○ Default imports
● Null Safety
● Closures
● Most of other Kotlin features
● And more
○ Parameterized Strings
Groovy
def list = [1, 2, 3]
list.each { println it }
person?.address.?city
def name = ‘World’
println “Hello $name!”
Swift
● Brevity
○ No semicolons
○ Implicit variable types
● Null Safety
● Closures
● Ranges
● Switch
○ Any type
○ Not just equality
○ No fallthrough
● Other
○ Parameterized Strings
○ Dynamic Extension
for i in 0..3 { println(“i”) }
extension Double {
c2f -> Double() {
return self * 9 / 5 + 32
}
}
…
let c = 100.0
print(c.c2f())
result, error := callSomeFunction()
Go
● Brevity
○ No semicolons
○ Implicit variable types
○ (But must use braces sometimes)
● Null Safety
● Switch
○ Non-constants
○ (But same type)
● Closures
● Multiple return values
● Missing some features
○ e.g. Inheritance
if i % 2 == 0 {
// even
} else {
// odd
}
Comparison Matrix
JVM GC Classes No ; Type
Inference
Safe
Null
If Expr Rich
Switch
Closure Variable
Arguments
Collection
Streaming
Dynamic
Extension
Tuples
Kotlin
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Groovy
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Swift
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Go
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Thank You!
Ayman Mahfouz
amahfouz@gmail.com
www.linkedin.com/in/amahfouz/
amahfouz.wordpress.com
github.com/amahfouz
amahfouz.com
AymanMahfouz.com

More Related Content

What's hot

Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
Rohit Shrivastava
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
sonalikharade3
 
Chapter 1 2 - some size factors
Chapter 1   2 - some size factorsChapter 1   2 - some size factors
Chapter 1 2 - some size factors
NancyBeaulah_R
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
 
Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented Design
Sharath g
 
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
Chitrank Dixit
 
Pseudo code
Pseudo codePseudo code
Pseudo code
Arindam Ghosh
 
Introduction to UML
Introduction to UMLIntroduction to UML
Software cost estimation techniques presentation
Software cost estimation techniques presentationSoftware cost estimation techniques presentation
Software cost estimation techniques presentation
Kudzai Rerayi
 
Software Engineering Unit 1
Software Engineering Unit 1Software Engineering Unit 1
Software Engineering Unit 1
Abhimanyu Mishra
 
High level languages representation
High level languages representationHigh level languages representation
High level languages representation
gaurav jain
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
ABHISHEK fulwadhwa
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
Abou Bakr Ashraf
 
TOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of ComputationTOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of Computation
Mohammad Imam Hossain
 
Software Cost Estimation
Software Cost EstimationSoftware Cost Estimation
Software Cost Estimation
Mirza Obaid
 
Unit1
Unit1Unit1
Unit1
anuragmbst
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
Shruti Dalela
 

What's hot (20)

Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Chapter 1 2 - some size factors
Chapter 1   2 - some size factorsChapter 1   2 - some size factors
Chapter 1 2 - some size factors
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented Design
 
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
 
Pseudo code
Pseudo codePseudo code
Pseudo code
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Software cost estimation techniques presentation
Software cost estimation techniques presentationSoftware cost estimation techniques presentation
Software cost estimation techniques presentation
 
Software Engineering Unit 1
Software Engineering Unit 1Software Engineering Unit 1
Software Engineering Unit 1
 
High level languages representation
High level languages representationHigh level languages representation
High level languages representation
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
TOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of ComputationTOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of Computation
 
Software Cost Estimation
Software Cost EstimationSoftware Cost Estimation
Software Cost Estimation
 
Unit1
Unit1Unit1
Unit1
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
 

Similar to Modern Programming Languages - An overview

Gdg dev fest 2107 to kotlin, with love
Gdg dev fest 2107   to kotlin, with loveGdg dev fest 2107   to kotlin, with love
Gdg dev fest 2107 to kotlin, with love
Ayman Mahfouz
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
Jayaprakash R
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
Nico Ludwig
 
What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)
Moaid Hathot
 
Intro to kotlin
Intro to kotlinIntro to kotlin
Intro to kotlin
Tomislav Homan
 
Start with swift
Start with swiftStart with swift
Kotlin what_you_need_to_know-converted event 4 with nigerians
Kotlin  what_you_need_to_know-converted event 4 with nigeriansKotlin  what_you_need_to_know-converted event 4 with nigerians
Kotlin what_you_need_to_know-converted event 4 with nigerians
junaidhasan17
 
What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
Mohsen Zainalpour
 
Kotlin & arrow: the functional way
Kotlin & arrow:  the functional wayKotlin & arrow:  the functional way
Kotlin & arrow: the functional way
nluaces
 
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Igalia
 
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Omer van Kloeten
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developers
Mohamed Wael
 
Kotlin from-scratch
Kotlin from-scratchKotlin from-scratch
Kotlin from-scratch
Franco Lombardo
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
PROIDEA
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor BuzatovićJavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
Thoughtworks
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
Martin Odersky
 
Grooming with Groovy
Grooming with GroovyGrooming with Groovy
Grooming with Groovy
Dhaval Dalal
 
New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
Nico Ludwig
 
From Java to Kotlin
From Java to KotlinFrom Java to Kotlin
From Java to Kotlin
João Ferrão
 

Similar to Modern Programming Languages - An overview (20)

Gdg dev fest 2107 to kotlin, with love
Gdg dev fest 2107   to kotlin, with loveGdg dev fest 2107   to kotlin, with love
Gdg dev fest 2107 to kotlin, with love
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
 
What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)
 
Intro to kotlin
Intro to kotlinIntro to kotlin
Intro to kotlin
 
Start with swift
Start with swiftStart with swift
Start with swift
 
Kotlin what_you_need_to_know-converted event 4 with nigerians
Kotlin  what_you_need_to_know-converted event 4 with nigeriansKotlin  what_you_need_to_know-converted event 4 with nigerians
Kotlin what_you_need_to_know-converted event 4 with nigerians
 
What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
 
Kotlin & arrow: the functional way
Kotlin & arrow:  the functional wayKotlin & arrow:  the functional way
Kotlin & arrow: the functional way
 
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
 
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developers
 
Kotlin from-scratch
Kotlin from-scratchKotlin from-scratch
Kotlin from-scratch
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor BuzatovićJavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Grooming with Groovy
Grooming with GroovyGrooming with Groovy
Grooming with Groovy
 
New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
 
From Java to Kotlin
From Java to KotlinFrom Java to Kotlin
From Java to Kotlin
 

More from Ayman Mahfouz

Integrating Gmail with issue tracking 2018
Integrating Gmail with issue tracking 2018Integrating Gmail with issue tracking 2018
Integrating Gmail with issue tracking 2018
Ayman Mahfouz
 
Career Day - Software Engineer
Career Day - Software EngineerCareer Day - Software Engineer
Career Day - Software Engineer
Ayman Mahfouz
 
Gdg dev fest hybrid apps your own mini-cordova
Gdg dev fest hybrid apps  your own mini-cordovaGdg dev fest hybrid apps  your own mini-cordova
Gdg dev fest hybrid apps your own mini-cordova
Ayman Mahfouz
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini Cordova
Ayman Mahfouz
 
Hybrid apps: Java conversing with JavaScript
Hybrid apps: Java  conversing with  JavaScriptHybrid apps: Java  conversing with  JavaScript
Hybrid apps: Java conversing with JavaScript
Ayman Mahfouz
 
Bazillion New Technologies
Bazillion New TechnologiesBazillion New Technologies
Bazillion New Technologies
Ayman Mahfouz
 
Self-service Enterprise Mobility
Self-service Enterprise MobilitySelf-service Enterprise Mobility
Self-service Enterprise Mobility
Ayman Mahfouz
 
Working Abroad: Bridging the Culture Gap
Working Abroad: Bridging the Culture GapWorking Abroad: Bridging the Culture Gap
Working Abroad: Bridging the Culture Gap
Ayman Mahfouz
 

More from Ayman Mahfouz (8)

Integrating Gmail with issue tracking 2018
Integrating Gmail with issue tracking 2018Integrating Gmail with issue tracking 2018
Integrating Gmail with issue tracking 2018
 
Career Day - Software Engineer
Career Day - Software EngineerCareer Day - Software Engineer
Career Day - Software Engineer
 
Gdg dev fest hybrid apps your own mini-cordova
Gdg dev fest hybrid apps  your own mini-cordovaGdg dev fest hybrid apps  your own mini-cordova
Gdg dev fest hybrid apps your own mini-cordova
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini Cordova
 
Hybrid apps: Java conversing with JavaScript
Hybrid apps: Java  conversing with  JavaScriptHybrid apps: Java  conversing with  JavaScript
Hybrid apps: Java conversing with JavaScript
 
Bazillion New Technologies
Bazillion New TechnologiesBazillion New Technologies
Bazillion New Technologies
 
Self-service Enterprise Mobility
Self-service Enterprise MobilitySelf-service Enterprise Mobility
Self-service Enterprise Mobility
 
Working Abroad: Bridging the Culture Gap
Working Abroad: Bridging the Culture GapWorking Abroad: Bridging the Culture Gap
Working Abroad: Bridging the Culture Gap
 

Recently uploaded

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

Modern Programming Languages - An overview

  • 1. Modern Programming Languages - Overview Ayman Mahfouz July 2018 With Kotlin as an Example
  • 2. Biography - VP of Engineering at Webalo (webalo.com) - Los Angeles based - Branch in Alexandria - UX4IIoT - 20+ years of software development - PhD. in software engineering - BSc. Computer Science - Alexandria 1997
  • 3. Programming Languages Pascal C C++ Java Python C# Objective-C ActionScript Scala Ruby Octave JavaScript Go TypeScript Kotlin BASIC Swift Groovy
  • 4. Why Many Languages Exist? Optimized for different objectives ● Productivity ● Readability ● Portability ● Performance ○ Compile-time ○ Runtime
  • 5. Some Notable Languages Released By Notes Groovy 2007 Pivotal Concise, easy-to learn, Java-interoperable, scripting language for the JVM. Go 2009 Google High-speed compilation compared to C , built-in support for concurrency. Swift 2014 Apple Many safety and syntax improvements to replace Objective-C. Kotlin 2016 JetBrains Designed to be “better than Java” - Interoperable for incremental migration.
  • 6. Kotlin Arrives! ● Paid little attention until Google I/O announcement. ● Android Studio Canary 3. ● Immediately fell in love ○ Strong Typing ○ Brevity ○ Expressiveness ○ Interoperability ○ Growing support ● Starts from where others ended (Java, Python, Go, Swift) ● One app built on github. ● Still learning.
  • 8. Brevity In Java, one would normally write this: With my background, I translated this into Kotlin verbatim: Not idiomatic but still shorter! Can you spot the omissions? ● No ; ● No “new” ● “override” is a modifier ● “:” not “implements” ● “public” is default ● Return type In Java one would typically write code like this:
  • 9. Brevity Using “Single Expression Function” syntax Pass a lambda expression to a function that accepts a single-method interface
  • 10. Brevity Omit parameter type Omit parameter name as well Eliminate left hand side completely Lambda expression only argument so we can eliminate the parenthesis Omit parameter type
  • 11. Brevity - From Java to Kotlin to Kotlin ... From Java ...
  • 12. We will go through: Brevity Null Safety Conditionals Smart Cast Lambdas Collections
  • 13. Null Safety - Explicit handling The dreaded NPE Handle explicitly
  • 14. Null Safety - Java Optionals Handle via Java 8 Optionals - very verbose! Handle by convention: - Special member naming (IfAny) - Null checks in constructor - Hand-coded - Annotations - Aspects Or let it throw! (pun intended)
  • 15. Null Safety - Safe Navigation Kotlin safe navigation operator Compile-time language-enforced null safety Forced init Force null guard Allowing late init Conscious NPE
  • 16. We will go through: Brevity Null Safety Conditionals Smart Cast Lambdas Collections
  • 17. Conditionals I cringe when I see if statements that look like this Use the ternary operator please!
  • 18. Conditionals - Expressions In Kotlin, if statement is an expression Combined with single expression function shorthand So you can write a function like this
  • 19. Conditionals - when I hate “Switch” statements! But I love “when” expressions! 1. No annoying “break” or even “case” 2. Match against any type 3. Switch variable can be of any type 4. The “else” section is mandatory
  • 20. We will go through: Brevity Null Safety Conditionals Smart Cast Lambdas Collections
  • 21. Smart Cast In Java explicit cast is needed In Kotlin Smart Cast takes place automatically
  • 24. Smart Cast - Nullables Automatic cast to non-null
  • 25. We will go through: Brevity Null Safety Conditionals Smart Cast Lambdas Collections
  • 26. Lambdas Think of it as a “function literal” The function “Array” produces an array by applying a lambda
  • 27. Lambdas - Higher-order Functions Higher-order functions: functions that take other functions as arguments
  • 28. Lambdas - Closures Closures: lambdas can access variables in their outer scope
  • 29. We will go through: Brevity Null Safety Conditionals Smart Cast Lambdas Collections
  • 31. Collections - Streaming Chaining lambda operations
  • 32. Collections - Immutability In Java both mutable and immutable collections implement the same interface Kotlin uses different interfaces - Compile error
  • 33. What about the others?
  • 34. ● Brevity ○ No semicolons ○ Optional “return” ○ Variable types ○ Omit parens in a call ○ Default imports ● Null Safety ● Closures ● Most of other Kotlin features ● And more ○ Parameterized Strings Groovy def list = [1, 2, 3] list.each { println it } person?.address.?city def name = ‘World’ println “Hello $name!”
  • 35. Swift ● Brevity ○ No semicolons ○ Implicit variable types ● Null Safety ● Closures ● Ranges ● Switch ○ Any type ○ Not just equality ○ No fallthrough ● Other ○ Parameterized Strings ○ Dynamic Extension for i in 0..3 { println(“i”) } extension Double { c2f -> Double() { return self * 9 / 5 + 32 } } … let c = 100.0 print(c.c2f())
  • 36. result, error := callSomeFunction() Go ● Brevity ○ No semicolons ○ Implicit variable types ○ (But must use braces sometimes) ● Null Safety ● Switch ○ Non-constants ○ (But same type) ● Closures ● Multiple return values ● Missing some features ○ e.g. Inheritance if i % 2 == 0 { // even } else { // odd }
  • 37. Comparison Matrix JVM GC Classes No ; Type Inference Safe Null If Expr Rich Switch Closure Variable Arguments Collection Streaming Dynamic Extension Tuples Kotlin ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Groovy ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Swift ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Go ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓