Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Having fun with Kotlin fun()
Search
Adnan A M
September 21, 2018
Programming
0
86
Having fun with Kotlin fun()
Slides from my talk at droidcon Vienna 2018.
Adnan A M
September 21, 2018
Tweet
Share
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
34
A developer's guide to wealth
adnan321
0
240
What the Hook ?
adnan321
0
70
Scoping Your Storage
adnan321
2
140
What The Context ?
adnan321
2
200
Putting Work Manager To Work
adnan321
0
91
OOP To FP
adnan321
1
190
Putting Work Manager To Work
adnan321
1
140
A slice of Android Slices - droidcon London 2018
adnan321
0
97
Other Decks in Programming
See All in Programming
Swiftコードバトル必勝法
toshi0383
0
150
[DroidKaigi 2024] Android ViewからJetpack Composeへ 〜Jetpack Compose移行のすゝめ〜 / From Android View to Jetpack Compose: A Guide to Migration
syarihu
1
550
Go Code Generation at newmo / 2024-08-27 #newmo_layerx_go
genkey6
0
560
From Idea to IDE: Developing Plugins for Android Studio
thisaay
1
170
今インフラ技術をイチから学び直すなら
yuhta28
1
130
Why Prism?
kddnewton
4
1.7k
はじめてみよう量子プログラミング
itokoichi01
0
170
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
250
A New Era of Testing
mannodermaus
2
490
What you can do with Ruby on WebAssembly
kateinoigakukun
0
160
月間4.5億回再生を超える大規模サービス TVer iOSアプリのリアーキテクチャ戦略 - iOSDC2024
techtver
PRO
1
910
AndroidアプリのUIバリエーションをあの手この手で確認する / Check UI variations of Android apps by various means
tkmnzm
1
140
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
23
1.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
4 Signs Your Business is Dying
shpigford
179
21k
A better future with KSS
kneath
235
17k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
Design by the Numbers
sachag
277
19k
Adopting Sorbet at Scale
ufuk
73
8.9k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Transcript
Having fun with Kotlin fun()
What is a function ?
“ Quote a long definition from Wikipedia here….. OR fun
myFunction() { // pretty awesome function right here }
Kotlin, give us a function !
Kotlin, give us a function !
Local Functions Functions within functions
None
Can’t unit test inner function Caveats/Gotchas Kotlin function doesn’t see
local declarations in advance
Single Expression Functions
None
Top Level Functions Extend functionality
Extension Functions Extend functionality
Extension function
Resolved Statically Under the hood Receiver Object The static function
is passed in the receiver object as a parameter
Companion objects/Static classes Caveats/Gotchas Member Functions Win
Named Arguments Thou shall name parameters
None
None
None
None
Default Parameters
None
Java interop isn’t great, must specify all parameters when calling
Caveats/Gotchas
Lambda Expressions
None
Anonymous functions
None
Higher Order Functions
None
None
None
None
None
None
None
inline functions
None
None
Let’s inline all Higher Order Functions ! Caveats/Gotchas No access
to private variables/members
None
Non local returns
None
None
None
None
None
Standard Functions
“ let, also, apply, run & with
None
None
“ Scoping functions
let
Usage of let
None
apply
Usage of apply
None
also
Usage of also
None
run
Usage of run
None
“ Transformation vs Mutating functions
“ also, apply - Mutating Functions
“ run, let - Transformation Functions
Danke Any questions? You can find me at: ◇ @AdnanM0123
Slide Theme ◇ Presentation template by SlidesCarnival ◇ Photographs by
Unsplash