Clojure Reactive Programming
eBook - ePub

Clojure Reactive Programming

Leonardo Borges

Share book
  1. 232 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Clojure Reactive Programming

Leonardo Borges

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Clojure Reactive Programming an online PDF/ePUB?
Yes, you can access Clojure Reactive Programming by Leonardo Borges in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Lenguajes de programación. We have over one million books available in our catalogue for you to explore.

Information

Clojure Reactive Programming


Table of Contents

Clojure Reactive Programming
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
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 networking
Complex GUIs and animations
Summary
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
3. 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
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
5. 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
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
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 state
Setting 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
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
9. A Reactive API to Amazon Web Services
The problem
Infrastructure automation
AWS resources dashboard
CloudFormation
The describeStacks endpoint
The describeStackResources endpoint
EC2
The describeInstances endpoint
RDS
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
A. 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
B. Bibliography
Index

Clojure Reactive Programming

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2015
Production reference: 1160315
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-666-8
www.packtpub.com

Credits

Author
Leonardo Borges
Reviewers
Eduard Bondarenko
Colin Jones
Michael Kohl
Falko Riemenschneider
Acquisition Editor
Harsha Bharwani
Content Development Editor
Arun Nadar
Technical Editor
Tanvi Bhatt
Copy Editors
Vikrant Phadke
Sameen Siddiqui
Project Coordinator
Neha Bhatnagar
Proofreaders
Simran Bhogal
Maria Gould
Indexer
Mariammal Chettiyar
Graphics
Abhinash Sahu
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph

About the Author

Leonardo Borges is a programming languages enthusiast who loves writing code, contributing to open source software, and speaking on subjects he feels strongly about. After nearly 5 years of consulting at ThoughtWorks, where he worked in two commercial Clojure projects, among many others, he is now a software engineer at Atlassian. He uses Clojure and ClojureScript to help build real-time collaborative editing technology. This is his first full-length book, but he contributed a couple of chapters to Clojure Cookbook, O'Reilly.
Leonardo has founded and runs the Sydney Clojure User Group in Australia. He also writes posts about software, focusing on functional programming, on his website (http://www.leonardoborges.com). When he isn't writing code, he enjoys riding motorcycles, weightlifting, and playing the guitar.

Acknowledgments

I would like to take this opportunity and start by thanking my family: my grandparents, Altamir and Alba, for their tireless support; my mother, Sônia, for her unconditional love and motivation; and my uncle, Altamir Filho, for supporting me when I decided to go to school at night so that I could start working as a programmer. Without them, I would have never pursued software engineering.
I would also like to thank my fiancee, Enif, who answered with a resounding "yes" when asked whether I should take up the challenge of writing a...

Table of contents