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.
Hands-on Design Patterns with Kotlin: GoF, Reactive patterns, Concurrent patterns and more
β Scribed by Alexey Soshin
- Publisher
- Packt Publishing
- Year
- 2018
- Tongue
- English
- Leaves
- 299
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Table of Contents
Cover
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Table of Contents
Preface
Chapter 1: Getting Started with Kotlin
Basic language syntax and features
Multi-paradigm
Code structure
No semicolons
Naming conventions
Packages
Types
Type inference
val versus var
Comparison
Null safety
Declaring functions
Control flow
Using the if expression
Using the when expression
String interpolation
Classes and inheritance
Classes
Inheritance
Constructors
Properties
Data classes
More control flow β loops
The for loop
For-each loop
While loop
Extension functions
Introduction to design patterns
What are design patterns?
Design patterns in real life
Design process
Why use design patterns in Kotlin?
Summary
Chapter 2: Working with Creational Patterns
Singleton
Factory Method
Factory
Static Factory Method
Advantages of the Static Factory Method
Caching
Subclassing
Static Factory Method in Kotlin
Companion object
Abstract Factory
Abstract Factory in action
Introduction to generics in Kotlin
Back to our bases
Making improvements
Builder
Composing an email
Collection types in Kotlin
Creating an emailΒ β first attempt
Creating an emailΒ β second attempt
Creating an emailΒ β the Kotlin way
Creating an emailΒ β theΒ Kotlin wayΒ β second attempt
Prototype
Building your own PC
Starting from a prototype
Summary
Chapter 3: Understanding Structural Patterns
Decorator
Enhancing a class
Operator overloading
Dude, where's my map?
The great combinator
Caveats
Adapter
Different adapters
Adapters in the real world
Caveats of using adapters
Bridge
Bridging changes
Type aliases
You're in the army now
Constants
A lethal weapon
Composite
Get together
The Squad
Varargs and secondary constructors
Counting bullets
Facade
Keep it simple
Flyweight
Being conservative
Saving memory
Proxy
A short detour into the RMI world
A replacement
Lazy delegation
Summary
Chapter 4: Getting Familiar with Behavioral Patterns
Strategy
Fruit arsenal
Citizen function
Switching sides
Iterator
One, two... many
Running through the values
State
Fifty shades of State
State of the Nation
Command
Undoing commands
Chain of responsibility
Interpreter
We need to go deeper
A language of your own
Taking a break
Call suffix
Mediator
Trouble in the Jungle
The middleman
Flavors
Caveats
Memento
Remembrance
Visitor
Writing a crawler
Template method
ObserverΒ
Animal Choir
Summary
Chapter 5: Functional Programming
Why functional programming?
Immutability
Tuples
Value mutation
Immutable collections
Functions as values
Higher-order functions
Pure functions
Currying
Memoization
Expressions, not statements
Pattern matching
Recursion
Summary
Chapter 6: Streaming Your Data
The it notation
The map() function
Filter family
Find family
Drop family
Sort family
ForEach
Join family
Fold/Reduce
Flat family
Slice
Chunked
Zip/Unzip
Streams are lazy, collections are not
Sequences
Summary
Chapter 7: Staying Reactive
Reactive principles
Responsiveness
Resiliency
Elasticity
Message-driven
Reactive extension
Hot Observable
Multicast
Subject
ReplaySubject
BehaviorSubject
AsyncSubject
SerializedSubject
Flowables
Holding state
FlowableProcessor
Batching
Throttling
Summary
Chapter 8: Threads and Coroutines
Threads
Thread safety
Threads are expensive
Coroutines
Starting coroutines
Jobs
Coroutine starvation
Coroutines under the hood
Fixing starvation
Waiting for a coroutine
Canceling a coroutine
Returning results
Setting timeouts
Parent jobs
Channels
Producers
Actors
Summary
Chapter 9: Designed for Concurrency
Active Object
Testing
Deferred value
Barrier
CountDownLatch
Data class as Barrier
Scheduler
Understanding contexts
Pipelines
Establishing a pipeline
TheΒ fan-out design pattern
TheΒ fan-in design pattern
Managing workers
Buffered channels
Unbiased select
Mutexes
Selecting on close
Sidekick channel
Deferred channel
Summary
Chapter 10: Idioms and Anti-Patterns
Let
Apply
Also
Run
With
Instance checks
Try-with-resources
Inline functions
Reified
Constants
Constructor overload
Dealing with nulls
Explicit async
Validation
Sealed, not enumerated
More companions
Scala functions
Summary
Chapter 11: Reactive Microservices with Kotlin
Getting started with Vert.x
Routing
Handling requests
Verticles
Subrouting
Testing
Helper methods
Working with databases
Managing configuration
Managing the database
EventBus
Consumer
Producer
More testing
Summary
Other Books You May Enjoy
Index
π SIMILAR VOLUMES
<p><b>Make the most of Kotlin by leveraging design patterns and best practices to build scalable and high performing apps</b><p><b>About This Book</b><p><li>Understand traditional GOF design patterns to apply generic solutions<li>Shift from OOP to FP; covering reactive and concurrent patterns in a s
<span><p><b>Improve the scalability and maintainability of your applications by implementing a variety of design patterns using Kotlin</b></p><h4>Key Features</h4><ul><li>Understand traditional and modern design patterns to improve the design of your application</li><li>Combine the benefits of objec
<span><p><b>Improve the scalability and maintainability of your applications by implementing a variety of design patterns using Kotlin</b></p><h4>Key Features</h4><ul><li>Understand traditional and modern design patterns to improve the design of your application</li><li>Combine the benefits of objec
<p><b>Enhance your skills in building scalable infrastructure for your cloud-based applications</b><p><b>Key Features</b><li>Learn to design a scalable architecture by building continuous integration (CI) pipelines with Kubernetes<li>Get an in-depth understanding of role-based access control (RBAC),