万本电子书0元读

万本电子书0元读

顶部广告

Hands-On Design Patterns with Kotlin电子书

售       价:¥

5人正在读 | 0人评论 6.2

作       者:Alexey Soshin

出  版  社:Packt Publishing

出版时间:2018-06-15

字       数:30.5万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Make the most of Kotlin by leveraging design patterns and best practices to build scalable and high performing apps About This Book ? Understand traditional GOF design patterns to apply generic solutions ? Shift from OOP to FP; covering reactive and concurrent patterns in a step-by-step manner ? Choose the best microservices architecture and MVC for your development environment Who This Book Is For This book is for developers who would like to master design patterns with Kotlin to build efficient and scalable applications. Basic Java or Kotlin programming knowledge is assumed What You Will Learn ? Get to grips with Kotlin principles, including its strengths and weaknesses ? Understand classical design patterns in Kotlin ? Explore functional programming using built-in features of Kotlin ? Solve real-world problems using reactive and concurrent design patterns ? Use threads and coroutines to simplify concurrent code flow ? Understand antipatterns to write clean Kotlin code, avoiding common pitfalls ? Learn about the design considerations necessary while choosing between architectures In Detail 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. Style and approach This book explains design patterns in a step-by-step manner with clear and concise code examples
目录展开

Title Page

Copyright and Credits

Hands-On Design Patterns with Kotlin

Dedication

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewers

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

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

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

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

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

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

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

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

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

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

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

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

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部