Reddit Reddit reviews Kotlin Programming: The Big Nerd Ranch Guide

We found 3 Reddit comments about Kotlin Programming: The Big Nerd Ranch Guide. Here are the top ones, ranked by their Reddit score.

Computers & Technology
Books
Computer Programming
Functional Software Programming
Kotlin Programming: The Big Nerd Ranch Guide
Check price on Amazon

3 Reddit comments about Kotlin Programming: The Big Nerd Ranch Guide:

u/whisky_pete · 16 pointsr/programming

I don't know C#, but I just spent 2 weeks working through a Kotlin textbook cover to cover, and then started rewriting my Java Android app in it. So, I'll list off some things I've enjoyed about it.

​

  • Every file I've rewritten in Kotlin has reduced in line count from around 30%-50% compared to Java. And I'm probably not writing super idiomatic code yet (especially while reading the equivalent Java simultaneously and translating it over)
  • val & var: vals are immutable, great for thread safety. Quickly you realize that most of your variables in general don't have be reinitialized.
  • null safety: you have to opt into types being nullable with the ? operator, var person: Person vs var person: Person? - the first can't be null but the second can. Gives the compiler a lot of knowledge to enforce null safety in your app this way. The safe call (?.) and elvis (?:) operators build on this.
  • Opt-in inheritance instead of opt-out. Classes need to be marked "open" for you to be allowed to inherit from them. Makes it so you can enforce a composition over inheritance style architecture.
  • Extension functions: since you can't inherit, you still sometimes need to add functionality to a class for some purpose. Extension functions can be attached to the class definition, but private to a module (or added to a utility Extensions file that you can opt-into importing). So you can add behavior, but don't have to pollute the ecosystem outside of your module if your extensions aren't valuable in general usage.
  • Not everything has to be part of a class. You can have free-standing functions
  • The scoping functions are really nice (let, run, also, with, apply)
  • when statements are really nice
  • It's a multi-paradigm language, so you can take the best parts you enjoy from both OOP and functional development styles
u/S0phon · 9 pointsr/Kotlin

I like Kotlin Programming by Big Nerd Ranch though I cannot compare it to other books. But Big Nerd Ranch are reputable.

Effective Kotlin is probably for the more advanced but the book wasn't/isn't well received by this community so you will have to do your research on if it's for you.