Cover by Amit Rathore

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 6. State and the concurrent world

 

This chapter covers

  • The problems with mutable state
  • Clojure’s approach to state
  • Refs, agents, atoms, and vars
  • Futures and promises

 

State—you’re doing it wrong.

Rich Hickey

The above quote is from a presentation by Rich Hickey in which he mentions Clojure’s approach to concurrency and state. He means that most languages use an approach to modeling state that doesn’t work. To be precise, it used to work when computers were less powerful and ran programs in a single-threaded fashion. In today’s world of increasingly multicore and multi-CPU computers, the model has broken down.

This is evidenced by the difficulty of writing bug-free multithreaded code in typical object-oriented languages like Java ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required