Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Kotlin vs Java Puzzlers @ Devoxx

November 14, 2013
by

Svetlana Isakova

on 4 December 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Kotlin vs Java Puzzlers @ Devoxx

The Unpuzzling Kotlin
Svetlana Isakova
Aleksei Sedunov
vs
Animal Farm
false
What's wrong?
Intuition
string comparison:
How to make this loop infinite?
What might be wrong?
Replacement
Puzzler
the code that contradicts
our intuition

Regex is denoted explicitly
Intuition
arithmetic operations
on values
What can be printed?
Pain, Gain, Main
Main
Pain, Gain
none of the above
No pain, no gain
ain
Intuition
Indecisive
unreachable code
75
Strange arithmetic
How to make this loop infinite?
Equality check
(java bytecode)
NPE!
Time for a change
If you pay $2.00 for a gasket that costs
$1.10, how much change do you get?
0.8999999999999999
A change is gonna come
0.899999999999999911182158029987476766109466552734375
0.90
User-friendly BigDecimals
woof woof
Thanks to
http://kotlin.jetbrains.org
What says your intuition?
Let's make primitive type casts
explicit...
Solution
What does this code print?
Class objects
Extension functions
Intuition?
woof woof
Modern
language
Kotlin
is...

for
Expressive
No boilerplate
Right Abstractions
I READ much more code than I WRITE
2.5 MLOC
10 years
30 colleagues
Industry
Concise
Goal
Code contains
enough
information
for the reader,
but
not more
Kotlin
Java 1.4
Kotlin
Java
Examples
Industry requirements
Java interoperability
tools support
safety
static typing
Type Inference
Functions as Values
Extensions
...
Java
Kotlin
concise
can be
easily
used
from Java
stronger
type system
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
Strained Relations
What does
it print?
true true false
x == y
y == z
x == z
Imprecise
Imprecise
Precise
Strained Relations
Inapplicable operation
Private matter
What does it print?
Private Matter
Shades of Gray
What does it print?
White
Shades of Gray
Redeclaration
Import Duty
What does it print?
"toString" can't be referenced from static context
Arrays.toString
is shadowed by
ImportDuty.toString
Import Duty
Not accessible
Cannot weaken access privilege
[1, 2, 3, 4, 5]
Full transcript