Summary: Learning any new language is a challenge, and Clojure is no different. Finding the time to learn and practice is a real challenge, so we need to make the most of what time we have. These tips will help you immerse yourself in Clojure.
Learning Clojure can be a challenge. Learning any new language can take a long time. Just like with learning a new spoken language, we need to expose ourselves to the new programming language frequently and for long periods of time. When our brains are immersed in the subject, only then will they begin forming the neural connections that we call “learning”. With repetition, patterns appear and we begin to see Clojure as a native would.
But we’re busy and don’t have much opportunity to use Clojure at work. How can we find the time to learn and practice Clojure? If you want to get good at Clojure, you’re obviously going to have to make an effort. Here are my tips for making that effort count.
- Get your system set up.A great first step is to get your development environment ready. Find a block of an hour or two (at the most!) to get the JVM, Leiningen, and an editor set up. You can find instructions for Windows, Mac, and Linux here, compliments of Clojure Bridge. Test them out to make sure they’re working. Then, when you do have some free time, all you’ll have to do is run a
lein repland you can start coding. For learning, Light Table is fine, but so is any other editor you’re comfortable with.
- Start a scratch project.Leiningen comes with some great project templates for many different types of applications. You can make a new project with a clean slate just to practice coding. When you’re just starting out, I suggest using the default template. It will set everything up you need to get your code running in Clojure. When you’re feeling inspired to solve some Clojure problems, all you’ll need to do is run
lein new clojure-problemsand you’ll get a new project that’s ready to run. Of course, replace
clojure-problemswith whatever you want to call the project.
- Solve small problems.Sometimes we have 5-10 minutes here and there to code. You can make good use of that time by solving small, toy problems that practice core Clojure skills. Big skills are made out of small skills, so these little exercises really pay off. Repeat the same exercises for added insights.
4Clojure is a great site with tons of small, fill-in-the-blank exercises that break down learning Clojure to a very fine detail. You’re given some expressions with blanks. You have to fill in the blank with something that will make the expression true. These are great for practicing the micro-skills and to get you used to Clojure. You can also do them on your phone. The web version works well on mobile browsers, and there’s an app for Android. Sign up now and it will keep track of you progress. It takes a minute.
I cut my Clojure teeth on Project Euler problems. They’re more involved than 4Clojure. They’ll take more time per exercise. And they’re designed to be challenging in any language. The easy solution is often not efficient enough, so you’re challenged to dive into the nitty gritty of real-world algorithmic issues. I found these wonderful for forcing me to write practical Clojure code. Allocate 30 minutes to 1 hour per exercise. Sign up now so you can keep track of your progress.
- Play while you’re waiting in line.There are a few ways to do Clojure on your phone. There is a free iPhone/iPad ClojureScript REPL called Replete. And there’s a free Clojure REPL for Android. Install one on your phone now so it will be there when you have a moment.
Like I said before, 4Clojure also works fine in mobile browsers.
- “Increase your vocabulary.”One of the iconic tools of learning a language is the flashcard. Why not use them for learning a programming language? Write down the names of standard library functions and macros, one on each card, with a sentence on the back for what it does, and bring them with you wherever you go. When you get a chance, whip them out and start reviewing. Your brain will pick them up with repeated exposure. I don’t suggest you review the entire standard library, just what you find useful and don’t already have memorized.
You can get 100 Clojure flashcards to print out.
- Get unstuck quickly.Programming is full of obstacles that can block you for weeks. I’m often surprised any of us have the patience for it. Instead of trying to power through, ask someone for help. The Clojurians Slack is great for asking those quick questions. I ask questions there all the time. There are people of all experience levels ready to help out. Sign up now so it will be there when you need it. You can always ask me in the discussion board or .
- Small bites.Don’t bite off more than you can chew. For instance, don’t try to learn Emacs, Clojure, and music theory to start hacking in Overtone. Start with one thing and build a foundation. Choose a project that you know a lot about and do it in Clojure. For instance, if you’re a web programmer, build a simple blog engine in Clojure with an editor you’re familiar with. If you do data processing, try using Clojure for it.
- Plan your progress.One of the best ways to learn is to choose one small skill and get it done. Plan your project out a little bit ahead of time and you’ll know exactly what you can work on next. Back in a former life I was learning iOS development. I would plan a three-hour block on Saturday morning to make progress. During the week, I would figure out one thing to accomplish during those three hours. It’s always easier to plan than to do, because you can do it when you’re doing laundry, eating, etc.
One of my first goals was getting the phone to recognize a touch event and showing a circle where I touched. It might seem like a small goal, but by breaking down my larger goal (my idea for the app) into small, achievable objectives, I made sure I was never overwhelmed and always feeling like I was making progress.
So if you’re planning a web project in Clojure to learn, your first goal might be to get a “Hello, world!” server set up and deployed. Your next goal might be to connect to a database and do a query. There’s already a lot to figure out, so start small and plan a little bit. When it’s time to start, you’ll know exactly what you need to work on, so you won’t waste time.
- Share with the world.Sharing your work with a supportive community can really help you cement your skills. Consider writing a blog post, putting your code up on Github with a nice README, or presenting it at a local user group. Explaining how you did something can help others but it’s also a great way to make the skill yours.
I hope these tips help you see how much time you might have for learning Clojure. If you’d like to learn Clojure, join the PurelyFunctional.tv Online Mentoring program. It’s step-by-step guidance from Clojure dabbler to professional.