Wrapping Up

In this chapter we’ve looked at how to specify the structure of both our data and our functions. You learned how to validate your data using a spec with s/valid?, as well as how to discover how it conformed with s/conform or how it failed with s/explain.

Additionally, you learned how to check for invalid calls with stest/instrument when working at the REPL or in tests, and how to automatically test a properly spec’d function using stest/check.

The spec library requires a fair amount of extra effort in the code you write, particularly if you take the extra step to ensure that the :args spec of any function generates high-quality inputs for testing. However, you also gain lots of leverage by doing so, and it’s entirely up to you how much of your code to spec.

Next, we change our focus to consider the management of state and how to write concurrent programs using Clojure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.181.146