Want this course?
Course: Introduction to Clojure v2
How to use the course. What is Clojure and why do people use it? How to get set up for the course.
How to use this course
This course is designed to introduce you to Clojure slowly but surely. It's an interactive course meant to give you the skills you need--from the thinking skills to the typing skills--to write Clojure. Please follow along with code as I type and do the exercises. This is not a lecture format where you can sit back and simply absorb lots of material. It's all about getting into the code.
So just remember a few things:
- Whenever you see some code that I type, you should type it, too. Pause the video if you have to.
- Whevever there's an exercise, pause the video and do it. I'll show my version immediately after.
- If you get lost, don't worry. All of the code is available to copy-paste and in the git repo. There are commands in the notes for switching to any version of the code. And you can reset the state of the bakery at any time.
- Pause and rewind all you want.
- Most importantly, play around and have fun!
And have fun!
What you'll need to follow this course
You will need Java JDK and Leiningen installed, as well as git. You can find Java Leiningen install guides for all the major platforms here.
You will also need a terminal (command prompt) and a web browser. These are usually installed on all computer systems.
Finally, you need to install Git. Git is a software repository system. It will let you fetch and navigate the source code. Don't worry, all the commands will be given to you. Please follow the install guide for Git here.
Getting the code
There is a git repo with all of the code that we type. You can get the code by running this at the terminal:
$CMD git clone https://github.com/lispcast/introduction-to-clojure.git
The code will differ slightly from the video since the code is kept up to date with new releases to make sure it still runs.
There are git "tags" set up to navigate the code at different points in the video. You can find the command to switch to different git tags throughout the notes (this document). I suggest you clone two copies of the repo. You can use one to follow along and do exercises and one as a clean reference.
Here's how to clone the second copy of the repo. This one you should keep clean (don't modify anything) so that you can navigate around a known working version of the code.
$CMD git clone https://github.com/lispcast/introduction-to-clojure.git introduction-to-clojure-clean
What is Clojure?
Clojure is a programming language, developed originally by Rich Hickey, to run on the Java Virtual Machine (JVM). The Java Virtual Machine is a widely supported runtime. Many companies, large and small, have JVM deployments, and Clojure can run on all of them. In fact, Clojure was designed to interoperate well with its host.
People choose Clojure for a number of reasons.
In many, you write code in a text file. Then you compile it. Then run the program starting from nothing. This style of development gives a very slow feedback loop. It can take many seconds to test code you just wrote. Clojure was built to support dynamic development with fast feedback. You start a Clojure system and interact with it, including writing and running code. Your feedback loop is much faster and it's easier to understand your code.
Everything is available to you: the compiler, creating variables, instatiating objects, running your tests, etc. We'll be using a built-in command prompt called a Read Eval Print Loop (REPL) to interact with the system. We'll also use text files for code we'd like to keep.
Java is considered to be an Object-Oriented (OO) language. Now, you can do any paradigm in any language, but Java makes Object-Oriented Programming the default and easy method. Clojure makes a different choice. Clojure is well-suited to Functional Programming (FP). If Functional Programming is a better fit for the problems you are solving, then Clojure might be a good match.
When we write software, we're often writing information systems. In software, the information we process is called data. Clojure puts data front-and-center. Much of what we'll be learning in this course is how to model a problem as data and how to process it.
There are many other reasons, but these are the ones we'll be exploring in this course.
Now let's get started!
Code is available: lispcast/introduction-to-clojure
You can checkout the code in your local repo with this command:
$CMD git clone https://github.com/lispcast/introduction-to-clojure.git $CMD cd introduction-to-clojure