Learning Clojure is a process that is difficult first and then easy.
The more difficult places include:
1. It’s a habitual problem with Lisp style code. It depends on personal habits
2. OO thinking advocates the encapsulation of behavior and state, that is, an object contains both behavior (method) and state (property), and behavior operates the state of a specific object. For Clojure, it is a function that operates multiple data types (for example: the rest function can operate multiple data types). At first, it feels like the separation of properties and methods that OO is opposed to. There is also OO design, which is based on objects, while functional design is based on data structures.
3. Code is data. You should have heard of this, and it is recommended by various experts on the Internet. You can first think of it as when the macro is in javac and when the function is in java. . . . This belongs to the middle and late stages of learning, and the early functions can basically be solved.
For those who are familiar with Java, learning Clojure is not too difficult:
1. The most recommended IDE is Intellij IDEA+Cursive. If you are used to IDEA, the operation is no different from writing Java
2. Book recommendation: Clojure Programming, Clojure Programming Translation is not very good
3. Just write more. REPL is very fun to run and debug. Unlike Java, you write code, run it, and the code runs. . . .
It is relatively easy to convert from Java to Clojure. After all, Clojure is a JVM-based language and has excellent interoperability with Java. The main difficulty lies in the transition between the two programming approaches from object-oriented to functional programming. From my own experience, you can start from these places:
Have a good IDE. In the past, there were not many IDEs for Clojure, and many programmers needed to learn Emacs and functional programming at the same time, which made the learning task much steeper. But fortunately, this situation has improved a lot: the CursiveClojure plug-in based on IntelliJ IDEA (blog introduction), or the CCW plug-in based on Eclipse.
There is a good book. The best introductory book for first-time Java programmers is "Clojure Programming".
Do some exercises. 4clojure.com is an excellent site for quick exercises.
It’s a good thing to be a slow learner
In the long run, it may be the fastest way to master functional programming
If you watch it for two hours you will understand. I think the language is anyway, just variable assignment, if loop function, etc., etc., the writing methods are similar
Then it is very likely that you will never be able to learn a language other than Java
I listened to a lecture on the learning curve a few days ago, and I found it quite enlightening: Learning Curve and Hacking the Brain
Learning Clojure is a process that is difficult first and then easy.
The more difficult places include:
1. It’s a habitual problem with Lisp style code. It depends on personal habits
2. OO thinking advocates the encapsulation of behavior and state, that is, an object contains both behavior (method) and state (property), and behavior operates the state of a specific object. For Clojure, it is a function that operates multiple data types (for example: the rest function can operate multiple data types). At first, it feels like the separation of properties and methods that OO is opposed to. There is also OO design, which is based on objects, while functional design is based on data structures.
3. Code is data. You should have heard of this, and it is recommended by various experts on the Internet. You can first think of it as when the macro is in javac and when the function is in java. . . . This belongs to the middle and late stages of learning, and the early functions can basically be solved.
For those who are familiar with Java, learning Clojure is not too difficult:
1. The most recommended IDE is Intellij IDEA+Cursive. If you are used to IDEA, the operation is no different from writing Java
2. Book recommendation: Clojure Programming, Clojure Programming Translation is not very good
3. Just write more. REPL is very fun to run and debug. Unlike Java, you write code, run it, and the code runs. . . .
It is relatively easy to convert from Java to Clojure. After all, Clojure is a JVM-based language and has excellent interoperability with Java. The main difficulty lies in the transition between the two programming approaches from object-oriented to functional programming. From my own experience, you can start from these places:
It’s a good thing to be a slow learner
In the long run, it may be the fastest way to master functional programming
If you watch it for two hours you will understand. I think the language is anyway, just variable assignment, if loop function, etc., etc., the writing methods are similar
Then it is very likely that you will never be able to learn a language other than Java
I listened to a lecture on the learning curve a few days ago, and I found it quite enlightening:
Learning Curve and Hacking the Brain