Skip to content
0:00 / 0:00

#kotlin#typesystem#primitiveobsession

KotlinConf 2019: The Power of Types by Danny Preussler

JetBrains

236K subscribers • 27 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Danny Preussler
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

22K views6 years ago1 recommendation

Programming languagesSoftware designKotlinDesign patternsSoftware architecture

Danny Preussler explains how to leverage Kotlin's type system to avoid primitive obsession, improve code readability, and catch errors at compile time.

Recording brought to you by American Express. americanexpress.io/kotlin-jobs From Assembler, over Fortran and C to modern Kotlin, we came a long way and improved the way we can express our thoughts in code. One thing that happened during this journey is that languages allow us to use types for our problem domain, independent of the underlying computer architecture. Types became a powerful tool. Types improve readability which probably is the most important aspect of programming! But types also prevent you from making mistakes at compile time. This is why Kotlin translated the null problem into the type system. We can use these powers in our daily lives. We can write better code by avoiding “primitive obsession”. Il'l show you how! Resources: KotlinConf website: jb.gg/fyaze5 KotlinConf on Twitter: twitter.com/kotlinconf Kotlin website: jb.gg/pxrsn6 Kotlin blog: jb.gg/7uc7ow Kotlin on Twitter: twitter.com/kotlin #KotlinConf19 #Kotlin #JetBrains About the Presenter: Danny built mobile applications for companies like Viacom, Groupon, eBay and Alcatel. He is a Google Developer Expert for Android Kotlin. Before there was Android he was already active in the Blackberry development community.

Why it's here

1 person recommends this

What people say. Engineers discuss this talk when debating whether to wrap primitives in domain-specific classes.

u/nfrankelin r/Kotlin • Recommends

The Power of Types

u/Educational_Senseiin r/Kotlin • Mentions

Primitive obsession Is it good to stick to primitives in kotlin ? Or will it cost me too much to wrap some of my code in a class and play with types ? I watched this video but again the discussion on this says that it’s always not the best thing to do. link to this video Confused. Any clear suggestion

u/rossdrewin r/Kotlin • Mentions

On “Kotlin First Impressions”

>Are you saying, \...\ that it having primitive types that are not objects \...\ bleed up into not designing our classes as good domain "objects"? It's a simplification of an example but yes. Being able to step outside the paradigm for things easily dealt with inside the paradigm is breaking OO before you start doing OO. Java is object aware in that it can deal with object but it is not **pure** object oriented because it's atomic unit of thinking isn't an object, it's (in some cases) the primitive data type which doesn't play by object rules and needs to be cast to objects in certain situations. Effectively you can avoid using objects altogether. I mean it would be ugly as all hell…