Guide to start using Specs?


#1

I tried to read official docs for several times, but it still confuses me how to solve my real-world problems in Specs. I’m using assert to very some of my arguments in my projects and definitely I need something more powerful.


#2

I had the same confusion when I first saw specs. Then I practised parsing a lot data structures with clojure.spec/conform and suddenly things get clearer :slight_smile:


#3

Do you write blogs when you practice?


#4

Sorry, I didn’t think about that. But that’s a good idea!


#5

Hi,

Maybe you’ll find these interesting:

Cheers


#6

Have you read the official guide https://clojure.org/guides/spec it was enough for me to get going.


#7

tried to read official docs for several times

I doubted if there are others things I need to learn first. I don’t have much experience on testing or backend being a front-end developer.


#8

Oh, sorry, when you said docs I thought you meant https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha

I have not found a lot of good tutorials appart from the official guide yet, since its all pretty new.


#9

Fogus’ blog posts look promising:

  1. http://blog.fogus.me/2017/01/10/clojure-spec-introduction/
  2. http://blog.fogus.me/2017/02/10/clojure-spec-data-design-01-sketching-a-struct/

If only there were more posts in this series :).


#10

Why it has to be namespaced keywords in Clojure Spec?


#11

Just like immutability is enforced in Clojure so people don’t shoot themselves on the foot, only namespaced keywords are allowed for good reason: no name collision in the long run