Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Clojure for Java Developers

You're reading from  Clojure for Java Developers

Product type Book
Published in Feb 2016
Publisher
ISBN-13 9781785281501
Pages 156 pages
Edition 1st Edition
Languages

The Clojure model of state and identity


Clojure has very strong opinions about concurrency, in order to take it in a simpler way it redefines what state and identity mean. Let's explore the meaning of this concepts in Clojure.

When talking about state in Java, you probably think about the values of the attributes of your Java classes. The state in Clojure is similar to Java, it refers to the values of objects but there are very important differences that allow simpler concurrency.

In Clojure, identity is an entity that might have different values over time. Consider the following examples:

  • I have an identity; I will be and continue being this particular individual, my opinions, ideas, and appearance might change over time but I am the same individual with the same identity.

  • You have a bank account; it has a particular number and is run by a particular bank. The amount of money you have in it changes over time, but it is the same bank account.

  • Consider a ticker symbol (such as GOOG), it identifies...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}