Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Hands-On Design Patterns with Kotlin
  • Table Of Contents Toc
Hands-On Design Patterns with Kotlin

Hands-On Design Patterns with Kotlin

By : Alexey Soshin
4.1 (9)
close
close
Hands-On Design Patterns with Kotlin

Hands-On Design Patterns with Kotlin

4.1 (9)
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 (19 chapters)
close
close
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
chevron up
2
Index

Preface

Design patterns enable you as a developer to speed up the development process by providing tested, proven development paradigms. Reusing design patterns helps prevent complex issues that can cause major problems and improves your code base, promotes code reuse, and makes the 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. Furthermore, the book provides an in-depth explanation of the classic design patterns, such as Creational, Structural, and Behavioral, before heading into functional programming. It then takes you through Reactive and Concurrent patterns, teaching you about Streams, Threads, and Coroutines to write better code. Toward the end, you will learn about the latest trends in architecture, exploring the design patterns for microservices, and discuss the considerations when choosing between different architectures, such as microservices and MVC.

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.

Who this book is for

This book is for developers who would like to master design patterns with Kotlin in order to build efficient and scalable applications. Basic Java or Kotlin programming knowledge is assumed.

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.

To get the most out of this book

In this book, we assume that the reader has basic knowledge of Java programming language and what JVM is.

It is also assumed that the reader is comfortable working with the command line.

A few command-line examples we use in this book are based on OSX, but could be easily adapted for Windows or Linux.

Download the example code files

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:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. 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/Hands-on-Design-Patterns-with-Kotlin. 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!

Conventions used

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: "Kotlin's extension is usually .kt."

A block of code is set as follows:

var s = "I'm a string"
s = 1 // s is a String

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

var s = "I'm a string"
s = 1 // s is a String

Any command-line input or output is written as follows:

I would suggest: a guitar

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: "One of the most common tasks for Java developers is to create another Plain Old Java Object (POJO)."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

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.

Reviews

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.

 

 

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Hands-On Design Patterns with Kotlin
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon