Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mastering Kotlin
Mastering Kotlin

Mastering Kotlin: Learn advanced Kotlin programming techniques to build apps for Android, iOS, and the web

eBook
€8.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Kotlin

A New Challenger Approaches

In this chapter, you'll gain an understanding of what Kotlin is, how it came about, and why it's quickly gaining popularity. You'll find a high-level overview of key language features, as well as the design principles behind the language itself. Finally, this chapter will lay the foundations for the following chapters' focus on features, patterns, platforms, and best practices for improving your understanding of the Kotlin programming language.

This chapter covers the following topics:

  • Creating a modern language for the Java Virtual Machine (JVM)
  • Moving beyond the JVM
  • Designing Kotlin with best practices in mind
  • Checking in on the current state of Kotlin

Technical requirements

In order to download, compile, and execute the samples found in this chapter, you must have the following:

  • IntelliJ IDEA 2018.3 Community or Ultimate editions, or newer
  • An internet connection
  • Git and GitHub (optional)

To download all of the code in this chapter, including the examples and code snippets, please refer to the following GitHub link: https://github.com/PacktPublishing/Mastering-Kotlin/tree/master/Chapter01.

Creating a modern language for the JVM

Kotlin was born out of a desire for a modern programming language that could be run on the JVM while still being fully compatible with Java and existing Java tooling. With these goals in mind, Kotlin has evolved into one of the fastest growing programming languages in the world and continues to carve out space for itself across multiple domains.

GitHub's 2018 State of the Octoverse report listed Kotlin as the fastest growing language on GitHub: https://github.blog/2018-11-15-state-of-the-octoverse-top-programming-languages/.

In this section, we're going to dive into what Kotlin is, how it came to be, and why it's great for developers.

What is Kotlin?

So, what exactly is...

Moving beyond the JVM

Kotlin may owe its origin to JVM interoperability, but it has quickly moved beyond pure JVM applications. One of the early wins for Kotlin was acceptance in the Android development community where most developers were required to use Java 6 or Java 7. Kotlin enabled Android developers to use language features, such as lambdas, which were not available on older versions of Java.

Outside of Android, Kotlin can now be transpiled to JavaScript, used in multiplatform mobile applications, or compiled to run natively on macOS, Windows, and Linux.

Kotlin for Android

To date, Kotlin has received the most popularity in the Android development community. Kotlin starting gaining traction for Android development in...

Designing Kotlin with best practices in mind

Kotlin has been designed based on decades of experience from working with Java and other programming languages. By building on this experience, JetBrains has worked to improve the developer experience with Kotlin by focusing on things such as first-class tooling support from day one, fast build times, and bringing modern features and best practices to the language design.

Learning from Java

Kotlin is 100% compatible with Java through the bytecode that allows both to target the JVM. Kotlin's origin stems from wanting modern language features and compile speeds that other JVM languages couldn't provide. Because of these, Kotlin is heavily influenced by Java, but can improve...

Checking in on the current state of Kotlin

Today, Kotlin is one of the fastest growing languages in the world. It has already proven itself for Android development and is now starting to find a home in other domains as well.

Developing Kotlin in the open

Since its public announcement, JetBrains has been very open with the development of Kotlin. This includes a public issue tracker, regular blog posts, conference talks, a yearly Kotlin census, and they even have their own conference now, KotlinConf.

You can submit your feedback, or leave your own issues and feature requests in the Kotlin issue tracker: https://youtrack.jetbrains.net/issues/KT.

Kotlin has seen four major stable releases to date, which are as follows:

  • v1.0:...

Summary

Kotlin is a modern programming language that can be used to build applications across mobile, the web, and native platforms. Since its inception, JetBrains has developed Kotlin to provide an excellent developer and integration experience so Kotlin can be learned gradually and slowly integrated into existing projects. The design and development of the language has been done very much in the open, and you can view the Kotlin issue tracker and submit your own ideas, issues, and feedback to help contribute to the language. Kotlin's popularity continues to increase rapidly, and its ability to target a variety of platforms makes it likely that the popularity trend will continue.

In this book, you'll learn firsthand why Kotlin is growing so rapidly. We'll start by exploring different application architectures, and how to model data and manage state using Kotlin...

Questions

  1. Which company started the development of the Kotlin programming language?
  2. When was Kotlin announced to the world?
  3. Who is the lead designer of Kotlin?
  4. What platforms did Kotlin initially target?
  5. Which platforms are currently supported by Kotlin?
  6. For which platform has Kotlin gained the most popularity?
  7. List two factors that have contributed to the rapid growth of Kotlin.

Further reading

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand and leverage the syntax, tools, and patterns by writing code in Kotlin
  • Explore practical topics such as Java interop, concurrency with coroutines, and functional programming
  • Discover how to use Kotlin for build targets like Android, iOS, JavaScript, and backend service

Description

Using Kotlin without taking advantage of its power and interoperability is like owning a sports car and never taking it out of the garage. While documentation and introductory resources can help you learn the basics of Kotlin, the fact that it’s a new language means that there are limited learning resources and code bases available in comparison to Java and other established languages. This Kotlin book will show you how to leverage software designs and concepts that have made Java the most dominant enterprise programming language. You’ll understand how Kotlin is a modern approach to object-oriented programming (OOP). This book will take you through the vast array of features that Kotlin provides over other languages. These features include seamless interoperability with Java, efficient syntax, built-in functional programming constructs, and support for creating your own DSL. Finally, you will gain an understanding of implementing practical design patterns and best practices to help you master the Kotlin language. By the end of the book, you'll have obtained an advanced understanding of Kotlin in order to be able to build production-grade applications.

Who is this book for?

If you’re a Kotlin developer looking to further their skills or a professional Java developer looking for better or professional resources in order to make a switch to Kotlin, this book is for you. Familiarity with Kotlin programming will assist with understanding key concepts covered in the book.

What you will learn

  • Model data using interfaces, classes, and data classes
  • Grapple with practical interoperability challenges and solutions with Java
  • Build parallel apps using concurrency solutions such as coroutines
  • Explore functional, reactive, and imperative programming to build flexible apps
  • Discover how to build your own domain-specific language
  • Embrace functional programming using the standard library and Arrow
  • Delve into the use of Kotlin for frontend JavaScript development
  • Build server-side services using Kotlin and Ktor

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 11, 2019
Length: 434 pages
Edition : 1st
Language : English
ISBN-13 : 9781838552367
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 11, 2019
Length: 434 pages
Edition : 1st
Language : English
ISBN-13 : 9781838552367
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 92.97
Learn Kotlin Programming
€29.99
Android Programming with Kotlin for Beginners
€29.99
Mastering Kotlin
€32.99
Total 92.97 Stars icon
Banner background image

Table of Contents

24 Chapters
Section 1: Kotlin – A Modern Solution to Application Development Chevron down icon Chevron up icon
A New Challenger Approaches Chevron down icon Chevron up icon
Programmers' Multi-Tool – Flexible, Expressive, and Concise Chevron down icon Chevron up icon
Section 2: Putting the Pieces Together – Modeling Data, Managing State, and Application Architecture Chevron down icon Chevron up icon
Understanding Programming Paradigms in Kotlin Chevron down icon Chevron up icon
First-Class Functions Chevron down icon Chevron up icon
Modeling Real-World Data Chevron down icon Chevron up icon
Section 3: Play Nice – Integrating Kotlin With Existing Code Chevron down icon Chevron up icon
Interoperability as a Design Goal Chevron down icon Chevron up icon
Crossing Over – Working across Java and Kotlin Chevron down icon Chevron up icon
Controlling the Story Chevron down icon Chevron up icon
Baby Steps – Integration through Testing Chevron down icon Chevron up icon
Section 4: Go Beyond – Exploring Advanced and Experimental Language Features Chevron down icon Chevron up icon
Practical Concurrency Chevron down icon Chevron up icon
Building Your Own Tools – Domain-Specific Languages (DSLs) Chevron down icon Chevron up icon
Fully Functional – Embracing Functional Programming Chevron down icon Chevron up icon
Section 5: The Wide World of Kotlin – Using Kotlin across the Entire Development Stack Chevron down icon Chevron up icon
Kotlin on Android Chevron down icon Chevron up icon
Kotlin and Web Development Chevron down icon Chevron up icon
Introducing Multiplatform Kotlin Chevron down icon Chevron up icon
Taming the Monolith with Microservices Chevron down icon Chevron up icon
Practical Design Patterns Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 33.3%
1 star 33.3%
Clive Jefferies Sep 05, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book. Covered all aspects of Kotlin in a very easy to enjoyable approach. One of my favourite software development books.
Amazon Verified review Amazon
Kindle Customer Jan 15, 2021
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Book is very superficial, contains only simple examples and a lot of boilerplates like technical requirements for each chapter. I don't recommend this book.
Amazon Verified review Amazon
Tukkie Nov 17, 2023
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book is hopelessly out of date. Not one of the projects you can download works!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.