What are the advantages of immutable data structures outside functional programming? We explore the benefits of immutability when designing a search query API in Ruby.
A data structure is immutable if it cannot be changed after it is created. In a recent Ruby application we decided to use immutability to our advantage. This article explains how. We will look at an interesting property of the API of Active Record and see how we can easily implement a similar API with an immutable tree structure.
A data structure is immutable if it cannot be changed after it is created. In a recent Ruby application we decided to use immutability to our advantage. This article explains how. We will look at an interesting property of the API of Active Record and see how we can easily implement a similar API with an immutable tree structure.
view source