In this document, you’ve learned how to write a Tic-Tac-Toe application using ZLayers. I hope you’ve been able to appreciate the great power that ZLayer gives for building modular and composable applications in a more accessible and understandable way. At the same time, we have written some tests and seen how easy it is to use test implementations of standard ZIO services (such as Console) or to define mock environments as ZLayers that can be provided for tests to make them executable.
You have also learned how ZIO 2.0 helps us to reduce lots of boilerplate when preparing the environment for your applications. Thanks to that, you won’t have to worry about horizontal and vertical composition of ZLayers anymore: you have automatic wiring of your application’s dependency graph by default!
I hope the concepts related to the ZEnvironment and ZLayer data types are more clear to you now (if they weren’t before), and that you will start using this knowledge in your own applications to make them extremely modular and composable!