Hands-On Reactive Programming with Clojure
Second Edition
Create asynchronous, event-based, and concurrent applications
Konrad Szydlo
Leonardo Borges
BIRMINGHAM - MUMBAI
Hands-On Reactive Programming with ClojureSecond Edition
Copyright 2019 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 authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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.
Commissioning Editor: Richa Tripathi
Acquisition Editor: Denim Pinto
Content Development Editor: Rohit Kumar Singh
Technical Editor: Gaurav Gala
Copy Editor: Safis Editing
Project Coordinator: Vaidehi Sawant
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Alishon Mendonsa
Production Coordinator: Jyoti Chauhan
First published: March 2015
Second edition: January 2019
Production reference: 1240119
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78934-613-8
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the authors
Konrad Szydlo has worked with Clojure for the last 7 years. Since January 2016, he has worked as a software engineer and team leader at Retailic, responsible for building a website for the biggest royalty program in Poland. Prior to this, he worked as a developer with Sky, developing e-commerce and sports applications, where he used Ruby, Java, and PHP. He is also listed in the Top 75 Datomic developers on GitHub.
Konrad is a part of the Clojurian Slack community, is very interested in functional programming, and gave a Datomic Database talk at the ClojureD conference in Berlin in 2015. He also gave a talk on Creating reactive components using ClojureScript React wrappers during Lambda Days in Krakw in 2016.
I would like to thank my family, especially my parents, Dorota and Roman, for their love and support. I would also like to thank my university friends, Joanna, Adam, and Wojtek, for all that we have done together. I am grateful to my colleagues from Sky, who showed me the wonderful world of programming. I also thank my friends from Retailic for the opportunity to work with Clojure. Finally, I thank fellow swimmers from KP Masters Krosno for a world besides programming.
Leonardo Borges is a programming languages enthusiast who loves writing code, contributing to open source software, and speaking on subjects he feels strongly about. He has used Clojure professionally, both as a lead consultant at ThoughtWorks and as a development team lead at Atlassian, where he helped build real-time collaborative editing technology.
Leonardo is currently the CTO for MODRON. Apart from this book, he contributed a couple of chapters to Clojure Cookbook, O'Reilly.
Leonardo founded and currently runs the Sydney Clojure User Group in Australia. He also writes posts about software, with a focus on functional programming, on his website. When he isn't writing code, he enjoys riding motorcycles, weightlifting, and playing the guitar.
About the reviewer
Eduard Bondarenko is a software developer living in Kyiv, Ukraine. He started programming using Basic on a ZX Spectrum a long time ago. Later, he worked in the web development domain. He has used Ruby on Rails for over 8 years. Having used Ruby for a long time, he discovered Clojure in early 2009 and liked the simplicity of the language. Besides Ruby and Clojure, he is interested in Go and ReasonML development.
I want to thank my wonderful wife, kids, and parents, for all the love, support, and help they give me.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Highly concurrent applications, such as user interfaces, have traditionally managed state through the mutation of global variables. Various actions are coordinated via event handlers, which are procedural in nature.
Over time, the complexity of a system increases. New feature requests come in, and it becomes harder and harder to reason about the application.
Functional programming presents itself as an extremely powerful ally in building reliable systems by eliminating mutable states and allowing applications to be written in a declarative and composable way.
Such principles gave rise to functional Reactive Programming and Compositional Event Systems, programming paradigms that are exceptionally useful in building asynchronous and concurrent applications. They allow you to model mutable states in a functional style.
This book is devoted to these ideas and presents a number of different tools and techniques to help manage the increasing complexity of modern systems.
Next page