Clojure, it will be the beginning of a good partnership?
One of the my personal goals, based on the advice of pragmatic programmers, is to learn a new programming language. And Clojure was elected!
Why Clojure?
Well, I hope in my journey I can really justify my choice, but I have some small reasons that lead me to delve into it:
- A language that runs on the JVM
- A language that you produce concurrent applications with some security (competing applications in a world of smartphones and cloud with a very strong processing power)
- A dynamic language (can do things at runtime) and functional (in short is a language that emphasizes the availability of functions and prevents states)
- The Sneer staff is using pro core of their solution and professionals such as Klaus Wuestefeld and Rodrigo Bamboo know what they do.
Differences and characteristics
Programs written in Clojure are small and this can translate into simplicity, a small program is easier to read, easier to understand, easier to refactor and easier to maintain.
The smallest unit of work is the function in Java I’m used to create specialized classes and objects together to solve problems. Already in a functional language we created highly specialized functions to solve the same problems.
In an object-oriented language you normally pass objects as parameters or receive objects as result, instead in functional programming do the same thing with functions.
Another point that is different, for me at least, the values are immutable in Clojure. See, an immutable object is an object in which their status can not be changed after being created, and for me that come from Java is as if all values are declared using the final clause.
Clojure has the following primitive types: maps, lists, vectors, sets and functions. We can compose primitive types in structures that represent the data. In Java you need to create a type to store a given.
Clojure has a large number of functions that operate on basic types.
“It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.” – Alan Perlis first winner of the Turing Award.
Interoperability
Clojure runs on the JVM, so it can easily use Java classes, you have the ability to create instances of classes, call static methods and implement interfaces very easily. And the reverse also applies, you can create a program in Clojure and call it Java.
For me were sufficient grounds to embark on this journey, let it clear that all information here is interpretation of what I read and what I had contact, so forgive me if I’m committing gaffes.
In the next article I will start coding with Clojure.