توضیحاتی در مورد کتاب Kotlin Design Patterns and Best Practices: Elevate your Kotlin skills with classical and modern design patterns, coroutines, and microservices
نام کتاب : Kotlin Design Patterns and Best Practices: Elevate your Kotlin skills with classical and modern design patterns, coroutines, and microservices
عنوان ترجمه شده به فارسی : الگوهای طراحی کاتلین و بهترین روشها: مهارتهای کاتلین خود را با الگوهای طراحی کلاسیک و مدرن، برنامههای آموزشی و میکروسرویسها ارتقا دهید.
سری :
نویسندگان : Alexey Soshin
ناشر : Packt Publishing
سال نشر : 2024
تعداد صفحات : 475
ISBN (شابک) : 9781805127765
زبان کتاب : English
فرمت کتاب : pdf
حجم کتاب : 8 مگابایت
بعد از تکمیل فرایند پرداخت لینک دانلود کتاب ارائه خواهد شد. درصورت ثبت نام و ورود به حساب کاربری خود قادر خواهید بود لیست کتاب های خریداری شده را مشاهده فرمایید.
فهرست مطالب :
Cover
Copyright
Contributors
Table of Contents
Preface
Section 1: Classical Patterns
Chapter 1: Getting Started with Kotlin
Technical requirements
Basic language syntax and features
Multi-paradigm language
Understanding Kotlin code structure
Naming conventions
Packages
Comments
Hello Kotlin
No wrapping class
No arguments
No static modifier
A less verbose print function
No semicolons
Understanding types
Basic types
Type inference
Values
Comparison and equality
Declaring functions
Null safety
Reviewing Kotlin data structures
Lists
Sets
Maps
Mutability
Alternative implementations for collections
Arrays
Control flow
The if expression
The when expression
Working with text
String interpolation
Loops
The for-each loop
The for loop
The while loop
Classes and inheritance
Classes
Properties
Custom setters and getters
Interfaces
Abstract classes
Visibility modifiers
Inheritance
Data classes
Kotlin data classes versus Java records
Extension functions
Introduction to design patterns
What are design patterns?
Design patterns in real life
Design process
Using design patterns in Kotlin
Bringing it all together
Exercise
Example
Challenge
Summary
Questions
Chapter 2: Working with Creational Patterns
Technical requirements
Singleton
Factory Method
Static Factory Method
Abstract Factory
Casts
Subclassing
Smart casts
Variable shadowing
Collection of Factory Methods
Builder
Fluent setters
Default arguments
Prototype
Starting from a prototype
Summary
Questions
Chapter 3: Understanding Structural Patterns
Technical requirements
Decorator
Enhancing a class
The Elvis operator
The inheritance problem
Operator overloading
Caveats of the Decorator design pattern
Adapter
Adapting existing code
Adapters in the real world
Caveats of using adapters
Bridge
Bridging changes
Type aliasing
Constants
Composite
Secondary constructors
The varargs keyword
Nesting composites
Facade
Flyweight
Saving memory
Caveats of the Flyweight design pattern
Proxy
Lazy delegation
Summary
Questions
Chapter 4: Getting Familiar with Behavioral Patterns
Technical requirements
Strategy
Functions as first-class citizens
Iterator
State
Fifty shades of state
State of the nation
Command
Undoing commands
Chain of Responsibility
Interpreter
A language of your own
Call suffix
DSL Marker
Mediator
The middleman
Mediator caveats
Memento
Visitor
Writing a crawler
Template Method
Observer
Animal choir example
Summary
Questions
Section 2: Reactive and Concurrent Patterns
Chapter 5: Introducing Functional Programming
Technical requirements
Reasoning behind the functional approach
Immutability
Immutable collections
The pitfalls of a shared mutable state
Tuples
Functions as values
Higher-order functions in the standard library
The “it” notation
Closures
Pure functions
Currying
Memoization
Using expressions instead of statements
Pattern matching
Recursion
Summary
Questions
Chapter 6: Threads and Coroutines
Technical requirements
Looking deeper into threads
Thread safety
Thread synchronization mechanisms in Kotlin
Why are threads expensive?
Introducing coroutines
Starting coroutines
Jobs
Coroutines under the hood
Dispatchers
Switching dispatchers
Structured concurrency
The coroutineScope builder
Canceling a coroutine
Setting timeouts
Summary
Questions
Chapter 7: Controlling the Data Flow
Technical requirements
Reactive principles
The responsive principle
The resilient principle
The elastic principle
The message-driven principle
Higher-order functions on collections
Mapping elements
Filtering elements
Finding elements
Executing code for each element
Summing up elements
Getting rid of nesting
Exploring concurrent data structures
Sequences
Channels
Producers
Actors
Buffered channels
Flows
Buffering flows
Flow exceptions and error handling
Catching exceptions
Handling completion
Retrying
Optional retrying
Flow sharing
shareIn
stateIn
Cancellation
Flow builders
Conflating flows
Rate-limiting
Combining flows
Summary
Questions
Chapter 8: Designing for Concurrency
Technical requirements
Deferred Value
Barrier
Scheduler
Pipeline
Fan-Out
Fan-In
Racing
Unbiased Select
Mutex
Deadlocks
Sidekick
Summary
Questions
Section 3: Practical Application of Design Patterns
Chapter 9: Idioms and Anti-Patterns
Technical requirements
Scope functions
let function
apply function
also function
run function
with function
Type checks and casts
An alternative to the try-with-resources statement
Inline functions
Algebraic data types
Recursive functions
Reified generics
Using constants efficiently
Constructor overload
Dealing with nulls
Making asynchronicity explicit
Validating input
Sealed hierarchies versus enums
Context receivers
Summary
Questions
Chapter 10: Practical Functional Programming with Arrow
Technical requirements
Getting started with Arrow
Typed errors
Raise
Collecting failures
Smart constructors
Alternatives to Either and Raise
Result
Optional
Ior
Advantages of typed errors
High-level concurrency
Parallel operations
CyclicBarrier
Racing
Resource
Software transactional memory
Resilience
Retry and repeat
Circuit Breaker
Saga
Immutable data
Summary
Questions
Chapter 11: Concurrent Microservices with Ktor
Technical requirements
Getting started with Ktor
Routing requests
Testing the service
Connecting to other HTTP services
Connecting to a database
Configuration management in Ktor
Defining tables with Exposed
Creating new entities
Making the tests consistent
Fetching all entities
Fetching a single entity
Organizing routes in Ktor
Deleting an entity
Updating an entity
Achieving concurrency in Ktor
Summary
Questions
Chapter 12: Reactive Microservices with Vert.x
Technical requirements
Getting started with Vert.x
Routing requests
Verticles
Handling requests
Subrouting the requests
Testing Vert.x applications
Working with databases
Understanding Event Loop
Communicating with Event Bus
Sending JSON over Event Bus
Summary
Questions
Assessments
Other Book You May Enjoy
Index