Clojure Architecture like Uncle Bob did -


i trying implement clojure architecture uncle bob did there http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html , describe in clean code in episode 07 - architecture, use cases , high level design.

nothing in inner circle can know @ in outer circle.

enter image description here enter image description here

i want code core of app business rules , tests. core has have definitions of operations on "objects" in database user, payment, advertisement etc. implementation of how should done has on higher level of application.

so question is: can give me example of architecture application on github on image circles? learning clojure , want see how technically can done. trying myself have bad results. simple example of code me lot. i want know how create layers in clojure on image step step.

i glad information on how high quality in clojure. can code, video or article. can free or can buy.

the key element uncle bob's clean architecture dependency inversion. there multiple ways implement clojure: using higher order functions , protocols 2 relevant (shameless plug blog post of mine on dependency inversion in clojure). e.g., define persistence protocol data, ignorant of particular implementation:

 (defprotocol mydatadao     (load-data [])     (save-data [])) 

you have implementation of said protocol use database or normal file system (note: use of reify 1 option):

 (defn make-mydata-db-dao []     [... db-setup-code ... ]     (reify mydatadao          (load-data []             [... data-query-code ...])          (save-data []             [... data-save-code ...]))) 

instead of hand-crafted make-mydata-db-dao might want @ stuart sierra's excellent component library.

however, need implement different circles: that's question of using namespaces , ensuring put e.g. protocol definitions right inner circles/layers , implementations correct outer layer.

let's assume gateway code in general in namespace app.gateway.*. protocol mydatadao might end in namespace app.gateway.dao. implementation though belong in different, outer circle. let's db code in namespace app.db.*, might put make-mydata-db-dao app.db.dao.

unfortunately, don't know of existing codebase in clojure implements thoroughly. actually, interested in seeing real-world example of implemented in language , hearing more benefits , downsides or difficulties of using it.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -