is Clojure suitable for individuals to do WEB rapid development?

Source: Internet
Author: User
Tags fast web
Web Rapid development Many people use Python and other dynamic languages, Clojure as a kind of Lisp dialect, but also very flexible. So is it suitable for fast Web development? What is the reason?
What are the advantages and disadvantages relative to python,clojure?

Reply content:

It should be said to be quite suitable. Clojure Although the history is not long but the "framework" [0] that supports Web development already has: ring and ring-based compojure. Ring support middleware mechanism (can be understood as plug-ins), many of the core functions are implemented through middleware, such as session, Cookie,params parsing [1] and so on, The middleware mechanism allows you to easily assemble the functions you need on the ring, for example [2] There are some third-party middleware.

The ring library itself has borrowed heavily from Ruby's rack and Python wsgi features, so there's no need to worry about rapid development.

Although Clojure itself is the language of the JVM, it is more cool than Java that the code developed with the ring does not require any special configuration: Whether you change the HTML code or the Clojure code, you can see the effect immediately by refreshing it-without restarting the server. This should be an important feature for web development speed.

A disadvantage compared to python? For a while I really can't remember, maybe I don't use too much. Here's what I spent two hours in the evening writing out with Clojure, you can feel it: CPF Loan Calculator

[0] Clojure actually prefers to call class libraries, not frames, because the frame sounds like a very heavy thing.
[1] Https://github.com/ring-clojure/ring/tree/master/ring-core/src/ring/middleware
[2] https:// github.com/ring-clojure /ring/wiki/third-party-libraries Development is still fast. / http rebajie.net I wrote it in Clojure. This is the blog I wrote with Clojure. / http Github.com/baoliang/clo Jure-blog What are the advantages and disadvantages of > relative to Python,clojure?

An example is described.
My former colleague, originally specialized in writing Python. Later because Clojure, to our company, has been writing clojure. Several of his own projects were written by Clojure.

I have been writing Clojure2 for years, and I like the language very much, and I wrote Python for a few months. This time to the new company, most of the company's code is python+php. I just wrote Python. They want me to make the service fast and stable. Python is still a little tired, but it should be solved.

Python should still be a good language. Clojure is more. Very good, can open the port, used for hot debugging, while the plug-in dynamic management can be implemented, the development process is very simple, fast,
(defn render-test [ret tmt]  (-> (resp/response "------render----test------")     (#(resp/content-type %1 "text/plain"))))(defn foo  "I don't do a whole lot."  [x]  (str "来自源码目录的参数:" x))(defn handler [^Integer x]    {:$r render-test :text (str "hello world, road goes sucess!" (foo x))})(defn home [req content ^Integer num]    {:hiccup "home.clj" :content (str "home" content) :num num})(defroad road (GET "/web-test-0.1.0-SNAPSHOT-standalone/main" handler)               (GET "/web-test-0.1.0-SNAPSHOT-standalone/home/:num{\\d+}" home))(defn -main [& args]  (log/info "---------log4j test-------")  (jetty/run-jetty road {:port 3000}))
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.