Clojure reactive programming : design and implement highly reusable reactive applications by integrating different frameworks with Clojure 9781783986675, 1783986670

If you are a Clojure developer who is interested in using Reactive Programming to build asynchronous and concurrent appl

207 17 1MB

English Pages 232 Year 2015

Report DMCA / Copyright

DOWNLOAD FILE

Clojure reactive programming : design and implement highly reusable reactive applications by integrating different frameworks with Clojure
 9781783986675, 1783986670

Table of contents :
Cover
Copyright
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: What is Reactive Programming?
A taste of Reactive Programming
Creating time
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 networkingComplex GUIs and animations
Summary
Chapter 2: 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
Chapter 3: Asynchronous Programming and Networking
Building a stock market monitoring application
Rolling averages
Identifying problems with our current approach Removing incidental complexity with RxClojureObservable rolling averages
Summary
Chapter 4: Introduction to core.async
Asynchronous programming and concurrency
core.async
Communicating sequential processes
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
Chapter 5: Creating Your own CES Framework with core.async
A minimal CES framework
Clojure or ClojureScript?
Designing the public API
Implementing tokens Implementing event streamsImplementing behaviors
Exercises
Exercise 5.1
Exercise 5.2
A respondent application
CES versus core.async
Summary
Chapter 6: 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
Chapter 7: 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 The Contacts application stateSetting up the Contacts project
Application components
Om cursors
Filling in the blanks
Intercomponent communication
Creating an agile board with Om
The board state
Components overview
Lifecycle and component local state
Remaining components
Utility functions
Exercises
Summary
Chapter 8: 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

Polecaj historie