We're planting a tree for every job application! Click here to learn more

Functional Workplaces: Freshcode - Why and How to Learn Clojure

Inna

5 Jul 2021

6 min read

Functional Workplaces: Freshcode - Why and How to Learn Clojure
  • Clojure

Clojure-04.png

Why did you choose Clojure?

The journey to Clojure started with an interest in functional programming. As is known, programming includes two core paradigms, core methods. The first one, object-oriented programming is mainstream and the other called functional programming is tasking with different unusual, non-standard approaches. The latter one is a more academic method but it already entries the mainstream programming adopting some ideas, like lambda functions and so on.

So, my story began with learning Haskel and Common LISP. By the way, it is these languages that inspired Rich Hickey to create Clojure. In general, all new programming languages are based on existing ones with adding some new things. It is like a synthesis process or a synergy. Clojure, in my opinion, is an outstanding result of such a process.

How did Сlojure web development at Freshcode begin?

I started using Clojure in 2012 having already had the experience of functional programming with Haskel and Common LISP. It all started when we decided to launch a startup in Java (cause our team was composed of Java developers) using such enterprise technologies as JSF and Spring. But after weeks of working, I had understood that progress was too slow, too many bugs, impasses, etc.

It was a good reason to switch to my functional programming experience and realize it within that startup. We had decided that JVM-hosted Clojure would be quite a clear and suitable language for us. So, it was a bit of a "just for fun" story, but as a result, Clojure became one of the core solutions at Freshcode programming culture.

Clojure-07.png

Why did you choose Clojure?

I didn't choose Clojure, Clojure has chosen me. :-) Initially, I had another tech stack after finishing training courses, JS, and all that. I spent a week waiting for a JS project, but luckily one of our team leads offered me a new Clojure-based project and became my mentor.

Is it difficult to learn Clojure?

I think the barrier to entry Clojure for newcomers is much higher in comparison with a number of modern programming languages. Clojure is a specific language, it's JVM-based, so it would be good to know Java. You can hardly learn Clojure so quickly as JS, for example, which you can practice a month later after beginning to learn. The shortage of sources to learn Clojure may be a problem too.

What challenges were you faced while learning Clojure?

The main challenge while learning Clojure is to turn your mind around 180 degrees because the functional language implies whole other approaches to deal with the challenges. For example, immutable data. You don't overwrite previous data structures but create new ones that will be handled by the garbage collector that makes the memory free, determining only the objects that have no longer references to them. And, of course, parentheses. During the first month, you see parentheses only. :-) And for today I've already learned to look through them. Lastly, there are a lot of already existing functions but I am not sure it's too difficult to learn them.

Can you remember some funny stories that happened in the early stages?

There were some funny moments while I was starting to learn Clojure with my mentor at Freshcode. We use IntelliJ IDEA as IDE and I had to switch to it too. As an "I need to customize it all right now" fan, I quickly created shortcuts and hotkeys and was totally happy with it. Unhappy was my mentor only, cause when he was teaching me and writing something in REPL weird stuff happened. He's used to his shortcuts and they were diametrically opposed to mine sometimes. For example, he had been writing some function, when, whoa, the console was closed. Whoa, the system was rebooted. And so on. It was getting on his nerves, and I was just kind of sitting in my chair and smiling only. Finally, I re-customized shortcuts for my mentor's ones. The end. :-)

Снимок экрана 2021-07-04 в 21.33.47.png

What difficulties were you faced while working with your first Clojure-based project?

New syntax and new functional programming approach were the main difficulties, I mean a total paradigm shift. Difficulty with syntax has resolved instantly. Literally, one or one-and-a-half weeks was needed to get used to it and, furthermore, to love it. And a functional programming approach mastering was a more challenging task. But I was lucky because a programmer that was developing a product before me had written a lot of perfect Clojure code. He'd created Clojure style guides and so on. I appreciate it a lot.

Do you remember your first project on Clojure?

It was an OpenCart-like online store. I was engaged in backend development that supported work with databases, products, orders, cost recalculation, and other basic features for the online shopping app. The only distinctive feature was that it was written in Clojure.

Can you remember some funny stories that happened in the early stages?

I can remember the development of an application for golfers to find partners for the game. The software development process was divided among the different developers from different corners of the world. I was doing a backend part. And once I had found a bug in the user's schedule synchronization that had been already developed by another side team.

It was a feature when a user notes his free time for a game, choosing morning or afternoon in the timetable. This timetable settings inexplicably hadn't been saved after clicking the Save button. And the "best part" was that the bug had reproduced on my machine only. We were doing everything to find the problem and fix it, but all we had understood was that the reason lay in the server.

Finally, it turned out that settings were sent to the server locally. The server was accepting only understandable keys, namely English-language names of the days of the week. And when requests with Russian-language names were coming, it just skipped them. The other-side dev team was passing the translated input string, that's all. Consequently, it worked on English-language iPhones only. Yes, it was funny.

What would you advise newcomers who are just beginning to learn Clojure?

The key lesson I've learned from my experience is that you'll never master something without the practical task, the practical focus. Whenever you have a task to do something, it is a matter of choice. And then if you choose Clojure to realize this task, mastering will become a much quicker and more effective process. You will focus on what you really need for the task at hand. And, in the process, you will generate additional knowledge.

As for books, I'd recommend "Clojure for the Brave and True" by Daniel Higginbotham and "The Joy of Clojure" by Michael Fogus and Chris Houser, the second edition.

Снимок экрана 2021-07-04 в 21.34.53.png

Why did you choose Clojure?

When I was working with projects using JS I wanted to switch to something new to get new knowledge, new experience, and new skills. So I started to learn Clojure, practicing it on a new project. I really liked to deal with all those endless parentheses and how it works. :-) The choice of Clojure was my sincere desire to master a part of the functional programming world.

What difficulties were you faced while learning Clojure?

Nothing was daunting during learning Clojure. You just need to understand a fundamentally new programming language with its unique paradigm. Clojure is regarded as a functional language, but it includes object-oriented programming elements that you can realize. There are several features to deal with, such as lazy evaluations or immutable data structures. They are somewhat complex concepts but nothing extraordinary.

Can you remember some funny stories that happened in the early stages?

I don't know if we can call it something funny, but there were some fails when new Clojure features and its awareness hadn't become ingrained yet. For instance, lazy evaluation, when you create a collection and iterate over it, inducing some side effects, e. g. running a command line. You are making everything correct (as you think), then waiting for the result… and nothing happens. Then you have this eureka moment: hey man, it is a lazy collection and it computes data on-demand only. But it was happening from inexperience only, it's no wonder.

Do you remember your first project on Clojure?

Of course, I remember it. There was a lot of math and data science within it. It was full of implicated things, such as macros and internal domain-specific languages that you need to deploy and check how it works. The project was large and it was quite difficult for me as the first project using a new programming language. But it was interesting and gave me a lot of experience.

Did you like this article?

Inna

See other articles by Inna

Related jobs

See all

Title

The company

  • Remote

Title

The company

  • Remote

Title

The company

  • Remote

Title

The company

  • Remote

Related articles

JavaScript Functional Style Made Simple

JavaScript Functional Style Made Simple

Daniel Boros

12 Sep 2021

JavaScript Functional Style Made Simple

JavaScript Functional Style Made Simple

Daniel Boros

12 Sep 2021

WorksHub

CareersCompaniesSitemapFunctional WorksBlockchain WorksJavaScript WorksAI WorksGolang WorksJava WorksPython WorksRemote Works
hello@works-hub.com

Ground Floor, Verse Building, 18 Brunswick Place, London, N1 6DZ

108 E 16th Street, New York, NY 10003

Subscribe to our newsletter

Join over 111,000 others and get access to exclusive content, job opportunities and more!

© 2024 WorksHub

Privacy PolicyDeveloped by WorksHub