Build flexible software with protocols
There's a big problem in software. You've got all these different types, and all of these different roles they play in your software. But sometimes you can't modify the code for the type. Maybe it's in a Java class in a library. Clojure's protocols let you solve this. You can extend existing classes or build protocols into new types.
When you have different types filling the same roles, we call that polymorphism. Clojure uses protocols for polymorphism. They are totally extensible on "both ends". You can extend existing types with new roles. And you can fill existing roles by new types. They let you create very flexible software with little effort.
In this course, you will learn:
- What problem protocols solve (it's called "The Expression Problem")
- How to define new protocols
- How to extend types with protocols
- Three cool uses for protocols
Want this course?
Love it or leave it guarantee
If you don't learn as much from this course as you thought, just ask for a refund within 30 days and I'll give you your money back.
What Problems do Clojure Protocols Solve?
This lesson explains what problem protocols are meant to solve using visual aids. This video lesson is 8 minutes long.
How to define protocols
This lesson deals mainly with the mechanics of protocols. How does one define a protocol, extend it, and finally use it. The video is 11 minutes long and the exercises should take 20 minutes.
Protocols for Easy Type Conversion
This lesson teaches powerful pattern for converting types that uses protocols. The lesson is 14 minutes long and the exercise will take 20 minutes.
Defining a DSL with Protocols
This lesson teaches how to define a DSL using literal data structures and protocols. It includes a video lesson with screen capture, code in a git repo, and exercises. The video will take 20 minutes to watch, and the exercises will take 20-40 minutes to do.