售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Hands-On Reactive Programming with Clojure Second Edition
About Packt
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewer
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
Download the color images
Conventions used
Get in touch
Reviews
What is Reactive Programming?
A taste of Reactive Programming
The concept of time in RxJS
More colors
Making it reactive
Exercise 1.1
A bit of history
Dataflow programming
Object-oriented Reactive Programming
The most widely used reactive program
The Observer design pattern
Functional Reactive Programming
Higher-order FRP
Signals and events
Implementation challenges
First-order FRP
Asynchronous data flow
Arrowized FRP
Applications of FRP
Asynchronous programming and networking
Complex GUIs and animations
Summary
Further reading
A Look at Reactive Extensions
The observer pattern revisited
Observer – an iterator's dual
Creating observables
Custom observables
Manipulating observables
flatmap and friends
One more flatmap for the road
Error handling
OnError
Catch
Retry
Backpressure
Sample
Backpressure strategies
Summary
Further reading
Asynchronous Programming and Networking
Building a stock market monitoring application
Rolling averages
Identifying problems with our current approach
Removing incidental complexity with RxClojure
Observable rolling averages
Summary
Introduction to core.async
Asynchronous programming and concurrency
The core.async library
The Communicating Sequential Processes paper
Rewriting the stock market application with core.async
Implementing the application code
Error handling
Backpressure
Fixed buffer
Dropping buffer
Sliding buffer
Transducers
Transducers and core.async
Summary
Further reading
Creating Your Own CES Framework with core.async
A minimal CES framework
Clojure or ClojureScript?
Designing the public API
Implementing tokens
Implementing event streams
Implementing behaviors
Exercises
Exercise 5.1
Exercise 5.2
A respondent application
CES versus core.async
Summary
Further reading
Building a Simple ClojureScript Game with Reagi
Setting up the project
Game entities
Putting it all together
Modeling user input as event streams
Working with the active keys stream
Reagi and other CES frameworks
Summary
Further reading
The UI as a Function
The problem with complex web UIs
Enter React.js
Lessons from functional programming
ClojureScript and Om
Building a simple Contacts application with Om
Setting up the Contacts project
Application components
Managing application state
Om components
Query expressions
Filling in the blanks
Identity
Intercomponent communication
Creating an agile board with Om
The board state
Components overview
Life cycle and component local state
Remaining components
Utility functions
Application's parser
Exercises
Summary
Further reading
A New Approach to Futures
Clojure futures
Fetching data in parallel
Imminent – a composable futures library for Clojure
Creating futures
Combinators and event handlers
The movies example revisited
Futures and blocking IO
Summary
Further reading
A Reactive API to Amazon Web Services
Amazon Services use case
Infrastructure automation
AWS resources dashboard
CloudFormation
The describeStacks endpoint
The describeStackResources endpoint
Elastic Compute Cloud Service
The describeInstances endpoint
Relational Database Service
The describeDBInstances endpoint
Designing the solution
Running the AWS stub server
Setting up the dashboard project
Creating AWS Observables
Combining the AWS Observables
Putting it all together
Exercises
Summary
Further reading
Reactive Microservices
An introduction to microservices
Advantages of microservices
Scalability
Disadvantages of microservices
When to use microservices
Microservices best practices
Domain Driven Design
Separate data storage
Team building and structure
Deployment
Failure isolation
Cross-cutting concerns
Communication between services
Event-driven communication
The CQRS communication pattern
Common pitfalls
Attitudes towards microservices
Service boundaries
Service granularity
Service separation
Build dependencies
Services contracts
Services communication
DevOps
RESTful microservices in action
Application overview
Services messaging
A Clojure RESTful service
Setting up the project structure
Database operations with Toucan
Coercion with the schema
The Card API
Compojure HTTP API
The GET Card API
The GET Cards API
The UPDATE Card API
The DELETE Card API
The Swagger UI
Summary
Further reading
Testing Reactive Apps
Why testing is important
Testing approaches
Functional testing
Non-functional testing
Clojure unit testing frameworks
The clojure.test framework
The is macro
The are macro
The expectations framework
The Midje framework
The fact macro
The facts macro
Top-down testing
Checking for exceptions
Checking collections
The contains macro
The just macro
The Speclj framework
The should-contain macro
The should= and should== macros
The should-throw macro
The should-be-a macro
Summary
Further reading
Concurrency Utilities in Clojure
Introduction to concurrency
Concurrency or parallelism
State, identity, and value
Common problems with states
Lost updates
Unrepeatable reads
Phantom reads
The traditional solution to the problem with states
Deadlock
Starvation
Livelock
Race conditions
Other problems with locks
The Clojure approach to concurrency
Classifying constructs
Synchronization
Coordination
Atoms
Dereferencing atoms
Mutating atoms
reset!
swap!
compare-and-set!
Agents
Dereferencing agents
Mutating agents
send
send-off
Refs
Dereferencing refs
Mutating refs
Software Transactional Memory
ref-set
alter
commute
Vars
Var bindings
Private vars
Constant vars
Futures and promises in Clojure
Futures
Promises
Summary
Further reading
Appendix - The Algebra of Library Design
The semantics of map
Functors
The option functor
Finding the average of ages
Applicative functors
Gathering stats about ages
Monads
Summary
Further reading
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜