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
89
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
40
A developer's guide to wealth
adnan321
0
250
What the Hook ?
adnan321
0
77
Scoping Your Storage
adnan321
2
150
What The Context ?
adnan321
2
200
Putting Work Manager To Work
adnan321
0
94
OOP To FP
adnan321
1
190
Putting Work Manager To Work
adnan321
1
150
A slice of Android Slices - droidcon London 2018
adnan321
0
100
Other Decks in Programming
See All in Programming
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
270
バッチを作らなきゃとなったときに考えること
irof
2
550
未経験でSRE、はじめました! 組織を支える役割と軌跡
curekoshimizu
1
200
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
170
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
240
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
1
650
Jakarta EE meets AI
ivargrimstad
0
650
推しメソッドsource_locationのしくみを探る - はじめてRubyのコードを読んでみた
nobu09
2
350
Better Code Design in PHP
afilina
0
180
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
160
お前もAI鬼にならないか?👹Bolt & Cursor & Supabase & Vercelで人間をやめるぞ、ジョジョー!👺
taishiyade
7
4.2k
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
250
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
10
540
Designing Experiences People Love
moore
140
23k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
GraphQLの誤解/rethinking-graphql
sonatard
69
10k
Site-Speed That Sticks
csswizardry
4
420
Visualization
eitanlees
146
15k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Building Your Own Lightsaber
phodgson
104
6.2k
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