Skip to Main Content
Clojure Polymorphism
book

Clojure Polymorphism

by Paul Stadig
November 2019
Intermediate to advanced content levelIntermediate to advanced
56 pages
37m
English
Packt Publishing
Content preview from Clojure Polymorphism

Service Abstraction

Polymorphism is primarily used to create an abstraction that can be implemented in several ways. An abstraction that I have created many times is a service abstraction. For instance, you may want to define a storage service abstraction modeled as a key-value store for binary objects. You could then implement it for S3, CloudFiles, and Azure. For use in tests, you could even implement a local filesystem backend.

My abstraction will consist of five functions: connect, get, put, delete, and close. You call connect to construct a service object. The service object will be used with get to fetch an object from the store, put to store an object in the store, delete to delete an object from the store, and close to clean up ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clojure Applied

Clojure Applied

Ben Vandgrift, Alex Miller
Clojure: High Performance JVM Programming

Clojure: High Performance JVM Programming

Eduardo Díaz, Shantanu Kumar, Akhil Wali
Clojure Cookbook

Clojure Cookbook

Ryan Neufeld, Luke VanderHart
Clojure Programming

Clojure Programming

Chas Emerick, Brian Carper, Christophe Grand

Publisher Resources

ISBN: 9781838982362