Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Irina Galata, Joe Howard, Ellen Shapiro

Rating No ratings yet

Learn how to program with Kotlin! Kotlin is the exciting modern language from JetBrains, creators of IntelliJ IDEA, the basis of many popular IDEs such as Android Studio and PyCharm. Since the adoption of Kotlin by Google as an official language for Android, the momentum behind Kotlin has gone off the charts. Kotlin supports many platforms, including Android, the web, the back-end, and even iOS. By reading this book, you'll be ready to use Kotlin on any and all of these platforms. Who This Book Is For This book is for complete beginners to Kotlin. No prior programming experience is necessary! Topics Covered in Kotlin Apprentice Kotlin Development Environment: See how to setup a development environment for Kotlin using IntelliJ IDEA. Numbers and Strings: These are the basic kinds of data in any app-learn how to use them in Kotlin. Making Decisions: Your code doesn't always run straight through-learn how to use conditions and loops to control program flow. Functions and Lambdas: Group your code together into reusable chunks to run and pass around. Collection Types: Discover the many ways Kotlin offers to store and organize data into collections. Building Your Own Types: Learn how to model elements in your app using classes, objects, interfaces, and enumerations. Functional Programming: Learn how to use Kotlin in a functional style and how this can make your code clearer and more efficient. Coroutines: Asynchronous programming can be a complex topic on any platform, but Kotlin gives you a clear and consise approach with coroutines. Kotlin Platforms and Scripting: Learn about how Kotlin can be used on multiple platforms and see its use as a scripting language. Kotlin/Native and Multiplatform: See how to use Kotlin/Native to bring your apps to more than one platform. One thing you can count on: after reading this book, you’ll be prepared to take advantage of Kotlin wherever you choose to use it!

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A beginner-friendly, hands-on introduction to Kotlin that takes you from your first "Hello, World" through coroutines and multiplatform development, ideal for anyone with zero programming experience who wants to learn a modern, versatile language. 【Book Arc】 - **Opening (~0%–9%)**: Sets up the development environment with IntelliJ IDEA, explains how to create and run your first Kotlin project, and outlines the book's structure—covering everything from basic syntax to advanced multiplatform topics. - **Early (~9%–25%)**: Introduces core language fundamentals: expressions, variables, constants, naming conventions, increment/decrement operations, and type inference. Explains how the Kotlin compiler works, including bytecode and the JVM. - **Early (~25%–34%)**: Delves into types and operations, including type conversion, strings, Pairs, and Booleans. Begins control flow with comparison operators, if expressions, and while loops, using practical examples like calculating overtime pay. - **Middle (~34%–47%)**: Covers advanced control flow with for loops and when expressions, then moves into functions with parameters, default values, and return values. Introduces nullability with the Elvis operator and smart casts, plus arrays and lists with iteration and element updates. - **Late (~47%–end)**: Progresses to lambdas, collection types, building custom types (classes, objects, interfaces, enumerations), functional programming, coroutines for asynchronous work, and finally Kotlin/Native and Multiplatform for sharing code across Android, iOS, and other platforms. 【Key Takeaways】 - **Kotlin runs anywhere** (Early): From JVM bytecode to native compilation, Kotlin's flexibility means you learn one language for Android, web, backend, and iOS—making it a high-value skill. - **Type inference reduces verbosity** (Early): Kotlin often infers types automatically, so you write less boilerplate than in Java; use Control+Shift+P in IntelliJ to see what's inferred. - **Expressions return values** (Middle): Both `if` and `when` can return values, letting you write concise, expressive code like `val numberName = when (number) { 2 -> "two" ... }`. - **Null safety is built-in** (Middle): The Elvis operator (`?:`) and safe calls (`?.let`) handle nulls gracefully, preventing the dreaded null pointer exceptions common in other languages. - **Collections are flexible** (Middle): Arrays are fixed-size and efficient, while lists are dynamically-sized; use indexing to update elements and `forEach` or `for` loops for iteration. - **Functions are first-class** (Middle): Default parameter values simplify calls, and functions can return values for data manipulation—foundational for writing reusable code. - **Coroutines simplify async** (Late): Kotlin's approach to asynchronous programming is clear and concise, avoiding the complexity found on other platforms. - **Multiplatform shares code** (Late): With Kotlin/Native and Multiplatform, you can write shared logic once and use it from both Android and iOS apps, using `expect`/`actual` for platform-specific code. 【Reading Tips】 - **Skim the setup chapter** (~0%–9%): If you've used any IDE before, you can move quickly through the IntelliJ installation and project creation; just ensure you can run a basic program. - **Deep-read Chapters 2–3** (~9%–25%): These fundamentals—variables, types, and operations—are the foundation for everything else; do the mini-exercises to build muscle memory. - **Practice control flow and functions** (~25%–44%): The `when` expression and function defaults are Kotlin superpowers; write your own examples beyond the book's to internalize them. - **Pay attention to null safety** (~44%–47%): The Elvis operator and smart casts are Kotlin's killer features; if you're coming from Java, this section will save you countless bugs. - **Skim the final chapters** (~47%–end): Coroutines and Multiplatform are advanced; read them for awareness, but don't stress if they don't fully click on first pass—they're for future reference. 【Coverage Limits】 This guide synthesizes the book's progression from fundamentals to advanced topics, but excerpts do not cover detailed code listings for every chapter or the full content of the coroutines and multiplatform sections.
Excerpt 1
Kotlin/Native to bring your apps to more than one platform. One thing you can count on: after reading this book, you’ll be prepared to take advantage of Kotl...
View in text
Excerpt 2
r case will be Kotlin. This code is put through a computer program called a compiler, which converts the code into instructions the CPU knows how to execute....
View in text
Excerpt 3
tlin has a data type just for this! It’s called a Boolean, after a rather clever man named George Boole who invented an entire field of mathematics around th...
View in text
Excerpt 4
syntax used in the call to forEach, called trailing lambda syntax, in Chapter 10, “Lambdas”. Lists A type that is very similar conceptually to an array is a...
View in text
Excerpt 5
urly braces is a member of the class. raywenderlich.com 178 Kotlin Apprentice Chapter 11: Classes To illustrate this, consider the credits property of the St...
View in text
Excerpt 6
ntice Chapter 15: Advanced Classes When and why to subclass This chapter has introduced you to class inheritance, along with the numerous programming techniq...
View in text
Excerpt 7
bicycles, trucks, or cars. In addition, bicycles could be enumerations and trucks could be classes! But every Vehicle has a particular set of properties and...
View in text
Excerpt 8
. You can use Java classes in Kotlin and still retain that "Kotlin-y" style, and you can use Kotlin classes and other code in Java code with the styles you a...
View in text
Tags
AI categories
Programming LanguagekotlinBackend
ISBN: 1950325008
Publisher: Razeware LLC
Publish Year: 2019
Language: English
Pages: 475
File Format: PDF
File Size: 20.9 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…