What is Clojure? Clojure is a programming language created by Rich Hickey, that was released in 2007.
It is: A dialect of Lisp Powerful with many, many brackets Hosted on the Java Virtual Machine (JVM = Parasitises Java’s stability/performance and can use Java libraries Dynamically compiled =Faster than scripting languages. Turned into Java byte code for the JVM An impure functional programming language Does not enforce the functional paradigm Aimed at Concurrency / Asynchronous Programming Currently at version 1.7, see more article1article2
Basic References
Programming Clojure authored by Stuart Halloway : 기본 입문서
Manifold.deferred - Methods for creating, transforming, and interacting with asynchronous values.
Manifold.streams - Manifold’s streams provide mechanisms for asynchronous puts and takes, timeouts, and backpressure. They are compatible with Java’s BlockingQueues, Clojure's lazy sequences, and core.async's channels. Methods for converting to and from each are provided.
Manifold.bus - Manifold also provides a simple event bus that can be used for pub/sub communication.
Promesa
Porsas (metosin) - tools for precompiling the functions to convert database results into Clojure values. This enables basically Java-fast database queries using idiomatic Clojure.
Application Framework & Libraries
Ring (HTTP support in clojure)
wrap-params (parsing params)
wrap-reload (for development)
wrap-resource and wrap-file-info (static files)
Route match and dispatch, Restful Application Libraries
Reagent (react-like component render, data -> hiccup conversion)
Hiccup - HTML representation in clojure
Duck Framework for Server Application Dev - github
Duct is a highly modular framework for building server-side applications in Clojure using data-driven architecture. It is similar in scope to Arachne, and is based on Integrant. Duct builds applications around an immutable configuration that acts as a structural blueprint. The configuration can be manipulated and queried to produce sophisticated behavior.
Friendly SQL Functions: insert!, insert-multi!, query, update!, delete!
If you need more expressiveness, consider one of the following libraries to build SQL/parameter vectors, or run queries:
HoneySQL – a composable DSL for creating SQL/parameter vectors from Clojure data structures
seql – a simplified EQL-inspired query language, built on next.jdbc (as of release 0.1.6)
SQLingvo – a composable DSL for creating SQL/parameter vectors
Walkable – full EQL query language support for creating SQL/parameter vectors
HugSQL – If you prefer to write your SQL separately from your code, take a look at HugSQL
Ragtime is a Clojure library for migrating structured data in a way that's database independent. It defines a common interface for expressing migrations, much like Ring defines a common interface for expressing web applications. Ragtime needs three pieces of data to work: migratable data store, an ordered sequence of migrations,strategy on how to deal with conflicts
HugSQL
HoneySQL
Walkable
Reloaded Workflow [Application State Management]
Introduction
The reloaded workflow uses components that can be started or stopped, arranged together into a system. During development, the system is started in a running REPL. After source files are changed, the system is stopped, the source files reloaded, and the system started once more. This can be put into a single command or even attached to a shortcut. A component could include stuff like reading configuration database connection running a Jetty server A short list of libraries offering support for this approach: Component see this [Excerpted from Stuartssierra's component github site]
A component is a collection of functions or procedures which share some runtime
state. Some examples of components:
Database access: query and insert fucntions sharing a database connection
External API service: functions to send receive data sharing an HTTP
connection pool
Web server: functions to handle different routes sharing all the runtime state
of the web application, such as a session store
In-memory cache: functions to get and set data in a shared mutable reference
such as a Clojure Atom or Ref
Commponents are intended to help manage stateful resources within a function paradigm.
Integrant is a Clojure (and ClojureScript) micro-framework for building applications with data-driven architecture. It can be thought of as an alternative to Component or Mount, and was inspired by Arachne and through work on Duct. Rationale: Integrant was built as a reaction to fix some perceived weaknesses with Component. In Component, systems are created programmatically. Constructor functions are used to build records, which are then assembled into systems. In Integrant, systems are created from a configuration data structure, typically loaded from an edn resource. The architecture of the application is defined through data, rather than code. In Component, only records or maps may have dependencies. Anything else you might want to have dependencies, like a function, needs to be wrapped in a record. In Integrant, anything can be dependent on anything else. The dependencies are resolved from the configuration before it's initialized into a system.
Sample dev application in the repository is very useful to understand the function of mount's component runtime dependency management. You can start, stop, reset the workflow of application starting jetty web server, then connecting a database, initializing application's state, then nrepl server.
HoneySQL transforms clojure data structures into SQL format so you don't need to write SQL manually. Also using HoneySQL makes you program a complex SQL programatically.
HoneyEQL parses EQL and gets output from SQL DB. First sql-db-metadata (databases, schemas, tables, columns) which can be retrieved from JDBC connection is converted to honey-eql-metadata (entities, attributes, primary keys, foreign keys, one-to-one relation, etc), then an eql-node results in some relevant data in SQL DB if some attributes in honey-eql-metadata are there matched for the eql-node. As of now, PostgresSQL and MySQL only are supported. For me, Microsoft SQL Server needs to be supported so I will make it.
Who did a great work on clojure development, specially thanks mentioned in the community:
Rich Hickey & Cognitect team for Clojure and Datomic
David Nolen for bringing many fresh ideas to the community including om.next
James Reeves for Duct framework. The best development experience I've ever had
Tony Kay for his heroic work on fulcro that showed me how great things can be done
Wilker Lucio for pathom and being very supportive
Sean Corfield for clojure.java.jdbc which we all use extensively