Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications
Programmers don't just use Kotlin, they love it. Even Google has adopted it as a first-class language for Android development. With Kotlin, you can intermix imperative, functional, and object-oriented styles of programming and benefit from the approach that's most suitable for the problem at hand. Learn to use the many features of this highly concise, fluent, elegant, and expressive statically typed language with easy-to-understand examples. Learn to write easy-to-maintain, high-performing JVM and Android applications, create DSLs, program asynchrony, and much more.

Kotlin is a highly concise, elegant, fluent, and expressive statically typed multi-paradigm language. It is one of the few languages that compiles down to both Java bytecode and JavaScript. You can use it to build server-side, front-end, and Android applications. With Kotlin, you need less code to accomplish your tasks, while keeping the code type-safe and less prone to error. If you want to learn the essentials of Kotlin, from the fundamentals to more advanced concepts, you've picked the right book.

Fire up your favorite IDE and practice hundreds of examples and exercises to sharpen your Kotlin skills. Learn to build standalone small programs to run as scripts, create type safe code, and then carry that knowledge forward to create fully object-oriented and functional style code that's easier to extend. Learn how to program with elegance but without compromising efficiency or performance, and how to use metaprogramming to build highly expressive code and create internal DSLs that exploit the fluency of the language. Explore coroutines, program asynchrony, run automated tests, and intermix Kotlin with Java in your enterprise applications.

This book will help you master one of the few languages that you can use for the entire full stack - from the server to mobile devices - to create performant, concise, and easy to maintain applications.

What You Need:

To try out the examples in the book you'll need a computer with Kotlin SDK, JDK, and a text editor or a Kotlin IDE installed in it.

1129799967
Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications
Programmers don't just use Kotlin, they love it. Even Google has adopted it as a first-class language for Android development. With Kotlin, you can intermix imperative, functional, and object-oriented styles of programming and benefit from the approach that's most suitable for the problem at hand. Learn to use the many features of this highly concise, fluent, elegant, and expressive statically typed language with easy-to-understand examples. Learn to write easy-to-maintain, high-performing JVM and Android applications, create DSLs, program asynchrony, and much more.

Kotlin is a highly concise, elegant, fluent, and expressive statically typed multi-paradigm language. It is one of the few languages that compiles down to both Java bytecode and JavaScript. You can use it to build server-side, front-end, and Android applications. With Kotlin, you need less code to accomplish your tasks, while keeping the code type-safe and less prone to error. If you want to learn the essentials of Kotlin, from the fundamentals to more advanced concepts, you've picked the right book.

Fire up your favorite IDE and practice hundreds of examples and exercises to sharpen your Kotlin skills. Learn to build standalone small programs to run as scripts, create type safe code, and then carry that knowledge forward to create fully object-oriented and functional style code that's easier to extend. Learn how to program with elegance but without compromising efficiency or performance, and how to use metaprogramming to build highly expressive code and create internal DSLs that exploit the fluency of the language. Explore coroutines, program asynchrony, run automated tests, and intermix Kotlin with Java in your enterprise applications.

This book will help you master one of the few languages that you can use for the entire full stack - from the server to mobile devices - to create performant, concise, and easy to maintain applications.

What You Need:

To try out the examples in the book you'll need a computer with Kotlin SDK, JDK, and a text editor or a Kotlin IDE installed in it.

51.95 In Stock
Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications

Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications

by Venkat Subramaniam
Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications

Programming Kotlin: Create Elegant, Expressive, and Performant JVM and Android Applications

by Venkat Subramaniam

Paperback

$51.95 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Programmers don't just use Kotlin, they love it. Even Google has adopted it as a first-class language for Android development. With Kotlin, you can intermix imperative, functional, and object-oriented styles of programming and benefit from the approach that's most suitable for the problem at hand. Learn to use the many features of this highly concise, fluent, elegant, and expressive statically typed language with easy-to-understand examples. Learn to write easy-to-maintain, high-performing JVM and Android applications, create DSLs, program asynchrony, and much more.

Kotlin is a highly concise, elegant, fluent, and expressive statically typed multi-paradigm language. It is one of the few languages that compiles down to both Java bytecode and JavaScript. You can use it to build server-side, front-end, and Android applications. With Kotlin, you need less code to accomplish your tasks, while keeping the code type-safe and less prone to error. If you want to learn the essentials of Kotlin, from the fundamentals to more advanced concepts, you've picked the right book.

Fire up your favorite IDE and practice hundreds of examples and exercises to sharpen your Kotlin skills. Learn to build standalone small programs to run as scripts, create type safe code, and then carry that knowledge forward to create fully object-oriented and functional style code that's easier to extend. Learn how to program with elegance but without compromising efficiency or performance, and how to use metaprogramming to build highly expressive code and create internal DSLs that exploit the fluency of the language. Explore coroutines, program asynchrony, run automated tests, and intermix Kotlin with Java in your enterprise applications.

This book will help you master one of the few languages that you can use for the entire full stack - from the server to mobile devices - to create performant, concise, and easy to maintain applications.

What You Need:

To try out the examples in the book you'll need a computer with Kotlin SDK, JDK, and a text editor or a Kotlin IDE installed in it.


Product Details

ISBN-13: 9781680506358
Publisher: Pragmatic Bookshelf
Publication date: 10/08/2019
Pages: 462
Product dimensions: 7.40(w) x 9.10(h) x 1.00(d)

About the Author

Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly invited speaker at several international conferences. He's the (co)author of multiple books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer.

Table of Contents

Foreword xi

Acknowledgments xiii

Introduction xv

1 Hello Kotlin 1

Reasons to Love Kotlin 3

Why Should You Choose Kotlin? 6

Taking Kotlin for a Ride 7

Compile to Bytecode and Run 8

Compiling to Other Targets 13

Which Option to Choose? 14

Wrapping Up 14

Part I Scripting with Kotlin

2 Kotlin Essentials for the Java Eyes 19

Less Typing 20

Sensible Warnings 24

Prefer val over var 26

Improved Equality Check 28

String Templates 29

Raw Strings 30

More Expressions, Fewer Statements 33

Wrapping Up 35

3 Working with Functions 37

Creating Functions 38

Default and Named Arguments 43

Vararg and Spread 46

Destructuring 49

Wrapping Up 51

4 External Iteration and Argument Matching 53

Range and Iteration 54

Iterating over Arrays and Lists 57

When It's Time to Use when 58

Wrapping Up 62

5 Using Collections 63

Flavors of Collections 63

Using Pair and Triple 66

Arrays of Objects and Primitives 68

Using List 70

Using Set 72

Using Map 73

Wrapping Up 75

6 Type Safety to Save the Day 77

Any and Nothing Classes 78

Nullable References 80

Type Checking and Casting 87

Explicit Type Casting 91

Generics: Variance and Constraints of Parametric Types 93

Reified Type Parameters 101

Wrapping Up 104

Part II Object-Oriented Kotlin

7 Objects and Classes 107

Objects and Singletons 107

Creating Classes 113

Companion Objects and Class Members 124

Creating Generics Classes 127

Data Classes 129

Wrapping Up 132

8 Class Hierarchies and Inheritance 133

Creating Interfaces and Abstract Classes 134

Nested and Inner Classes 138

Inheritance 140

Sealed Classes 144

Creating and Using Enums 145

Wrapping Up 148

9 Extension Through Delegation 149

When to Choose Delegation over Inheritance? 150

Designing with Delegates 151

Delegating to a Parameter 156

Dealing with Method Collisions 157

Caveats of Kotlin Delegation 160

Delegating Variables and Properties 162

Built-in Standard Delegates 166

Wrapping Up 170

Part III Functional Kotlin

10 Functional Programming with Lambdas 175

The Functional Style 176

Lambda Expressions 179

Lambdas and Anonymous Functions 186

Closures and Lexical Scoping 188

Non-Local and Labeled return 190

Inlining Functions with Lambdas 194

Wrapping Up 201

11 Internal Iteration and Lazy Evaluation 203

External vs. Internal Iterators 204

Internal Iterators 206

Sequences for Lazy Evaluation 213

Wrapping Up 218

Part IV Elegant and Efficient Kotlin

12 Fluency in Kotlin 221

Overloading Operators 222

Injecting Using Extension Functions and Properties 226

Extending Functions 234

Function Fluency with infix 235

Fluency with Any Object 236

Implicit Receivers 243

Wrapping Up 247

13 Creating Internal DSLs 249

Types and Characteristics of DSLs 250

Kotlin for Internal DSLs 251

Challenges in Building for Fluency 254

Type-Safe Builders 260

Narrowing Access with Scope Control 265

Wrapping Up 268

14 Programming Recursion and Memoization 269

The Power and Perils of Recursion 269

Tail Call Optimization 271

Memoization 274

Applying Memoization to Dynamic Programming 279

Wrapping Up 281

Part V Programming Asynchronous Applications

15 Exploring Coroutines 285

Coroutines and Concurrency 285

Running Concurrently Using Coroutines 287

Coroutine Context and Threads 293

Debugging Coroutines 298

Async and await 300

A Peek at Continuations 301

Creating Infinite Sequences 303

Wrapping Up 307

16 Asynchronous Programming 309

Programming Asynchronously 309

Exception Handling 314

Cancellations and Timeouts 318

Wrapping Up 326

Part VI Interop and Testing

17 Intermixing Java and Kotlin 329

Joint Compilation 330

Calling Java from Kotlin 333

Calling Kotlin from Java 336

Wrapping Up 346

18 Unit Testing with Kotlin 347

The Code Under Test 348

Getting the Project Files 349

Starting with a Canary Test 352

Writing Empirical Tests 353

Writing Data-Driven Tests 356

Mocking Out Dependencies 357

Testing Top-Level Functions 363

Testing Coroutines and Asynchronous Calls 366

Integrating with the Service 370

Viewing the Code Coverage 371

Taking the App for a Drive 372

Wrapping Up 373

19 Programming Spring Applications with Kotlin 375

Creating a Starter Project 376

Creating a Controller 378

Creating an Entity Class 380

Creating a Repository Interface 381

Creating a Service 381

Integrating the Service with Controller 383

Taking It for a Ride 385

Wrapping Up 386

20 Writing Android Applications with Kotlin 387

Creating a Project 388

Defining Domain Objects 390

Creating Layouts 391

Implementing the Activity 395

Updating the RecyclerView 399

Seeing the App in Action 401

Wrapping Up 402

Al Transpiling to JavaScript 405

A2 Kotlin/Native 409

A3 Kotlin to WebAssembly 413

Bibliography 417

Index 419

From the B&N Reads Blog

Customer Reviews