Book Image

Hands-On Design Patterns with Kotlin

By : Alexey Soshin
Book Image

Hands-On Design Patterns with Kotlin

By: Alexey Soshin

Overview of this book

Design patterns enable you as a developer to speed up the development process by providing you with proven development paradigms. Reusing design patterns helps prevent complex issues that can cause major problems, improves your code base, promotes code reuse, and makes an architecture more robust. The mission of this book is to ease the adoption of design patterns in Kotlin and provide good practices for programmers. The book begins by showing you the practical aspects of smarter coding in Kotlin, explaining the basic Kotlin syntax and the impact of design patterns. From there, the book provides an in-depth explanation of the classical design patterns of creational, structural, and behavioral families, before heading into functional programming. It then takes you through reactive and concurrent patterns, teaching you about using streams, threads, and coroutines to write better code along the way By the end of the book, you will be able to efficiently address common problems faced while developing applications and be comfortable working on scalable and maintainable projects of any size.
Table of Contents (13 chapters)

What this book covers

Chapter 1, Getting Started with Kotlin, covers basic language concepts and syntax, such as types, functions, classes, and flow control structures.

Chapter 2, Working with Creational Patterns, explains what classical creational patterns are embedded into the language and how to implement those that aren't. It discusses Singleton and Factory, among others.

Chapter 3, Understanding Structural Patterns, focuses on how to extend the functionality of our objects and adapt to changes.

Chapter 4, Getting Familiar with Behavioral Patterns, explains how can we alter object behavior at runtime, iteration over complex data structures, and communication between objects using the Observable design pattern.

Chapter 5, Functional Programming, dives into the principles of functional programming and how they fit into Kotlin. Topics such as data immutability and functions as a first-class value will be discussed in depth.

Chapter 6, Streaming Your Data, shows how applying the principles of functional programming help us process potentially infinite streams of incoming data.

Chapter 7, Staying Reactive, explains what reactive principles are and gives extensive examples based on the Reactive Extensions framework, better known as simply Rx.

Chapter 8, Threads and Coroutines, shows how easy it to work with concurrent code in Kotlin, making use of its lightweight thread model.

Chapter 9, Designed for Concurrency, covers design patterns that help us process many tasks at the same time, using coroutines.

Chapter 10, Idioms and Anti-Patterns, provides guidelines on some best practices and pitfalls that you may encounter while developing in Kotlin.

Chapter 11, Reactive Microservices with Kotlin, goes over a detailed example of writing a microservice using Kotlin, Vert.x, and PostgreSQL.