Is Clojure suitable for personal use for rapid Web development?

Source: Internet
Author: User
Rapid Web development many people use Python and other dynamic languages. Clojure is also flexible as a dialect of Lisp. Is it suitable for rapid Web development? Why? What are the advantages and disadvantages of Clojure compared with Python? Rapid Web development many people use Python and other dynamic languages. Clojure is also flexible as a dialect of Lisp. Is it suitable for rapid Web development? Why?
What are the advantages and disadvantages of Clojure compared with Python? Reply content: it should be said that it is quite suitable. Although Clojure is not long in history, the "framework" [0] that supports web development already has the following: Ring and Ring-based Compojure. Ring supports the middleware mechanism (which can be understood as a plug-in). many core functions are implemented through middleware, such as session, cookie, and params resolution [1, the middleware mechanism allows you to easily assemble the required functions on the ring. for example, [2] has some existing third-party middleware.

By the way, the Ring class library itself draws on the Rack and WSGI features in Ruby, so you don't have to worry about fast development.

Although Clojure itself is a JVM language, it is better than Java that you can do it without any special configuration for the code developed with Ring: whether you change the html code or the Clojure code, you can immediately refresh the code to see the effect-instead of restarting the server. This should be an important feature for web development speed.

What are the disadvantages compared with Python? I can't really remember it for a moment. maybe I don't use much. Here is what I wrote in Clojure for two hours in the evening. you can feel it: provident fund loan calculator

[0] Clojure actually prefers class libraries instead of frameworks, because the framework sounds very important.
[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 using clojure. This is the blog I wrote with clojure .. Http://github.com/baoliang/clojure-blog > What are the advantages and disadvantages of Clojure compared with Python?

Examples.
My former colleague, who used to write python professionally. Later, because of clojure, we had been writing clojure to our company. Several of his own projects are written by Clojure.

I have been writing clojurefor more than two years. I like this language very much. I wrote python for several months in the middle. When we arrived at the new company this time, most of the company's code was python + php. I wrote python. They asked me to make the service faster and more stable. Python is still a little tired, but it should be able to solve it.

Python should be a good language. Clojure. It is easy to use. it can open ports for hot debugging and implement dynamic management of plug-ins. The development process is simple and 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" parameters from the source code directory: "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}) (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.