I'm learning Clojure
by developing a small web application.
Coming from java
world, I'm trying to understand how to design my data using keywords
.
How should I access a data structure (model) fields?
For example, I have a comment
with a body
field.
I'm using the keyword :body
to access the model value,
but it seems very difficult in the future if I would like to change the body
name to something else (for example content
).
As for java
, I would encapsulate it with a get
function,
how should I use it in clojure
?
What are the design pattern or best practices?
Aucun commentaire:
Enregistrer un commentaire