Effective Kotlin
Effective Kotlin
$15.00
Minimum price
$25.00
Suggested price
Effective Kotlin

This book is 100% complete

Completed on 2019-10-11

About the Book

Kotlin is a powerful and pragmatic language, but it's not enough to know about its features. We also need to know when they should be used and in what way. This book is a guide for Kotlin developers on how to become excellent Kotlin developers. It presents and explains in-depth the best practices for Kotlin development. Each item is presented as a clear rule of thumb, supported by detailed explanations and practical examples.

  • Share this book

  • Feedback

    You must own a copy of this Book to access the forums

    Email the Author(s)

About the Author

Marcin Moskala
Marcin Moskala

Marcin Moskala is an experienced developer and Kotlin trainer. He is the founder of the Kt. Academy, an official JetBrains partner for teaching Kotlin, author of the book "Android Development with Kotlin", speaker at many international conferences, and programming library creator and contributor.

Reader Testimonials

Rafał Kuźmiński
Rafał Kuźmiński

Well done! I've read a few items and I have to admit that I learned some interesting stuff. Great book :)

Hanno Günther
Hanno Günther

Really love this book! 😍

Table of Contents

  •  
    • Beta status
  • Introduction: Be pragmatic
  • Part 1: Good code
  • Chapter 1: Safety
    • Item 1: Limit mutability
    • Item 2: Minimize the scope of variables
    • Item 3: Eliminate platform types as soon as possible
    • Item 4: Do not expose inferred types
    • Item 5: Specify your expectations on arguments and state
    • Item 6: Prefer standard errors to custom ones
    • Item 7: Prefer null or Failure result when the lack of result is possible
    • Item 8: Handle nulls properly
    • Item 9: Close resources with use
    • Item 10: Write unit tests
  • Chapter 2: Readability
    • Item 11: Design for readability
    • Item 12: Operator meaning should be consistent with its function name
    • Item 13: Avoid returning or operating on Unit?
    • Item 14: Specify the variable type when it is not clear
    • Item 15: Consider referencing receivers explicitly
    • Item 16: Properties should represent state, not behavior
    • Item 17: Consider naming arguments
    • Item 18: Respect coding conventions
  • Part 2: Code design
  • Chapter 3: Reusability
    • Item 19: Do not repeat knowledge
    • Item 20: Do not repeat common algorithms
    • Item 21: Use property delegation to extract common property patterns
    • Item 22: Use generics when implementing common algorithms
    • Item 23: Avoid shadowing type parameters
    • Item 24: Consider variance for generic types
    • Item 25: Reuse between different platforms by extracting common modules
  • Chapter 4: Abstraction design
    • Item 26: Each function should be written in terms of a single level of abstraction
    • Item 27: Use abstraction to protect code against changes
    • Item 28: Specify API stability
    • Item 29: Consider wrapping external API
    • Item 30: Minimize elements visibility
    • Item 31: Define contract with documentation
    • Item 32: Respect abstraction contracts
  • Chapter 5: Object creation
    • Item 33: Consider factory functions instead of constructors
    • Item 34: Consider a primary constructor with named optional arguments
    • Item 35: Consider defining a DSL for complex object creation
  • Chapter 6: Class design
    • Item 36: Prefer composition over inheritance
    • Item 37: Use the data modifier to represent a bundle of data
    • Item 38: Use function types instead of interfaces to pass operations and actions
    • Item 39: Prefer class hierarchies to tagged classes
    • Item 40: Respect the contract of equals
    • Item 41: Respect the contract of hashCode
    • Item 42: Respect the contract of compareTo
    • Item 43: Consider extracting non-essential parts of your API into extensions
    • Item 44: Avoid member extensions
  • Part 3: Efficiency
  • Chapter 7: Make it cheap
    • Item 45: Avoid unnecessary object creation
    • Item 46: Use inline modifier for functions with parameters of functional types
    • Item 47: Consider using inline classes
    • Item 48: Eliminate obsolete object references
  • Chapter 8: Efficient collection processing
    • Item 49: Prefer Sequence for big collections with more than one processing step
    • Item 50: Limit the number of operations
    • Item 51: Consider Arrays with primitives for performance-critical processing
    • Item 52: Consider using mutable collections
  • Dictionary
  • Notes

Authors have earned$8,088,579writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub