Kotlin is a relatively new language that is gaining popularity rapidly, thanks to its numerous unique features that increase developer productivity. It is primarily used for mobile (Android) and server-side (backend) development but can be used anywhere Java is used. Thanks to its other compiler, which transforms it into JavaScript, it can even be used for frontend web development. This book targets newcomers to the language and tries to bring them to intermediate-advanced levels of Kotlin knowledge.
This book covers the basic features of the language and its syntax, so no prior knowledge of Kotlin is required. You should have at least basic knowledge of general programming. You should know what control-flow statements, variables, classes, and basic data structures are.
Chapter 1, Introducing Kotlin, covers general features of the language and shows the reader how to install an IDE and the Kotlin compiler.
Chapter 2, Kotlin Basics, introduces the reader to the language syntax and explores the basic building blocks of the language: functions, variables, basic types, and so on.
Chapter 3, Classes and Object-Oriented Programming, focuses on the object-oriented features of the language. The chapter explores classes and interfaces and how they are extended and implemented. The chapter also shows some features that are specific to Kotlin, such as objects, companion objects, and sealed classes.
Chapter 4, Functions and Lambdas, shows how functions are first-class citizens in Kotlin. The chapter also shows Kotlin function features that are not present in Java, such as default argument values, named parameters, and function inlining.
Chapter 5, Advanced Kotlin, deals with more advanced features of Kotlin, such as operator overloading, generics, receiver functions, and constructs for multi-threaded programming.
Chapter 6, Kotlin Standard Library, shows some really useful functions that ship with Kotlin and also explores the Collections API.
Chapter 7, Coding a Dictionary App with Kotlin, is the chapter where we put Kotlin into practice. We summarize our learning from previous chapters and build a desktop dictionary application.
Since Kotlin compiles to Java bytecode and uses Java's types and build tools (Maven and Gradle), readers with a Java background will probably find Kotlin a bit easier than those without. But a Java background is not a requirement, as this book is intended for readers who are completely new to Kotlin/Java and the JVM ecosystem.
This book doesn't teach programming, so readers that have knowledge of any modern general-purpose programming language will find content in this book more understandable than those who don't.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packtpub.com.
- Select the
SUPPORT
tab. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Kotlin-Quick-Start-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: http://www.packtpub.com/sites/default/files/downloads/KotlinQuickStartGuide_ColorImages.pdf.
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg
disk image file as another disk in your system."
A block of code is set as follows:
<plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <version>${kotlin.version}</version> <configuration> <jvmTarget>1.8</jvmTarget> </configuration> </plugin>
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info
from the Administration
panel."
Feedback from our readers is always welcome.
General feedback: Email [email protected]
and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected]
.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected]
with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.