When an individual encounters a new obstacle in his or her life, no matter the significance or severity, the odds are that said obstacle has stood in the way of challengers before. In most situations this individual is probably not the first to face this challenge. Depending on the difficulty of the challenge being faced, some challengers will succeed, while others will not--some may even find a way around it.

I experienced an obstacle that, for me, turned into a roadblock that over the past decade, I revisited several times with the same outcome until I finally asked for help. I wanted to learn how to code, but I neither knew where to start or what that path forward might look like.

I learned the basics of a couple languages by playing around with online platforms like codecademy and online koans. These tools are great for learning the basics of a language while exercising dusty, old math skills to solve simple albeit, sometimes challenging mathematical problems like those you find in Project Euler.

The problem is that all of this learning is restricted to the online platform that does all the real stuff for you. I wasn't going to be able to write my own application in an online interface. I needed to learn how to run these problems locally on my own machine, but I struggled to find references to even get set up.

Now that I’m past this roadblock that kept me stationary for so long and because I simply cannot believe that I was the first or the only one who has ever faced this roadblock, I want to share how to get your computing machine set up to do the basics locally.

The following procedure is for beginners; those who have had only a taste of learning a language, but are blocked from getting any further. It provides the steps and tools necessary to get your machine setup and running small, basic programs locally for solving problems from ProjectEuler.net as well as the ClojureKoans.

Let’s get started!

Software Descriptions

Before diving into all the downloads & installations, I felt it was important to share an overview of the software we will be installing on your machine. No need to do any downloads or installs in this first section as some of them are Operating System dependent.

Clojure

Clojure is a very powerful & efficient language. It is a functional, lisp language. I've chosen clojure for this outline for three reasons.

  1. It's what I know best--I’m still technically pretty new at this coding thing too..
  2. While the syntax is a little confusing at first, maneuvering over lists and functions to create simple algorithms is actually easier and more straightforward in Clojure than in other languages I’ve used.
  3. In everything that I've read, those who start with a procedural language like java or python, are often intimidated by functional languages, and I've observed that they often don't take the opportunity to learn one.

Starting with a functional language like Clojure, gets you comfortable with it from the start. There's no doubt that you will learn procedural, object-oriented languages down the line.

Java8

There are newer versions, but for now, stick with version 8 as it is the most commonly used. Because of this, using newer versions could cause you unnecessary and seemingly unsolvable problems.

Homebrew & Chocolatey

Homebrew and Chocolatey are Package Managers, which are essentially programs that do the work of downloading & installing other applications on the correct path for you. To learn more about Homebrew or Chocolatey, visit their sites Homebrew and Chocolatey. Macs will be using Homebrew; Windows will be using Chocolatey.

Leiningen

Leiningen is a tool that automates clojure and helps to manage dependencies. Trust me, you’ll want it and will come to need it, if you continue to use clojure.

.NET Framework 4.5+

This is for windows only and is a .NET Framework which is required for clojure & chocolatey to run.

Terminal & PowerShell

While this little shell may look unimpressive upon opening, it is literally the window into your computer. With the right commands, it can read files, download data, search websites, and run applications. In fact, it is the command line for your computer. Anything that you do on your computer could theoretically be commanded through this little shell window. Terminal is for Mac while PowerShell is for Windows.

Installations, Downloads, & Setup

All instructions except downloading java (and .NET for Windows), will all be performed in Terminal/PowerShell.

Mac Instructions

Java8

Maybe Set Environment Variables

Homebrew

Clojure

Leiningen

Windows 10 Instructions

Java8

.NET Framework 4.5+


Open Powershell as Administrator. First things first,

The rest of the instructions will be in PowerShell. If you get errors between installations, close & reopen PowerShell as Administrator.

Set Environment Variables

Note: If you are not using PowerShell, this part of the instructions may not work.

This is what it should look like in the end:

win JAVA_HOME

Chocolatey

Clojure

Unfortunately chocolatey only has version 6, and we need 7, so we’ll do this manually.

Leiningen

Let's Code!

Congrats! Whether you are a Mac or a PC, you have just made your first true requests, downloads, & installations through your powerful little shell! Pretty cool!

And, I know what you’re probably thinking: coding is really just a bunch of copying & pasting, isn’t it?! Here you thought we did truly special things... I hate to break it to you that your conclusion is not entirely untrue, but I promise, it does get better. In fact, let’s have some fun!

These instructions will also be in your shell.

Cool!

The book Programming Clojure by Alex Miller is a part of The Pragmatic Programmer series, and is a very good resource for learning clojure.

Gitting to the Gist

This section is to get you setup and acquainted with github as well as to give you resources to learn the language basics of Clojure by way of the Clojure Koans and the practice of Test-Driven-Development (TDD) using the problems from Project Euler.

Git

GitHub.

Go ahead and sign up for or sign in into GitHub, so we can fork some stuff!

Forking puts copies of repositories created by others under your own repository. Anything you change in your repository will not affect the master repository, so don’t worry.

At the top right of each page I'm about to direct you to, there will be a button called Fork. That's the button to push when I say "Fork It!"
Fork

Directories

Let’s get your projects directory set up.

In your shell, note what directory you are in. It’s probably Users/{{user name}}. This is probably a good place, but feel free to select a different location:

The following commands will get you to where you want to go:

Once you’re in the directory where you want your projects folder

Local Repositories

We need to make local repositories also for you to be able to do your work.

In your projects directory

IDE

Finally, you are going to want a textEditor or IDE. I personally suggest using intelliJ by jetBrains. If you're using it for personal use only, they do offer a free community edition. One note on intelliJ, it does a lot for you! This is great, but you will come to depend on some of the tools and hints that intelliJ offers, which will impede your overall understanding of what you are doing especially while you are a novice. I started with intelliJ, so I’m not saying don’t, just be aware that it does things for you that you might need to understand as you progress in your new hobby/education/career.

There are also editors like SublimeText, TextMate, etc.

For the tasks I've supplied you with, any of those will do. Just save the files properly: .clj

Good Luck!

I’ll leave you with that.

I’d walk you through starting & running each of these tools, but my goal today was to help you get over the biggest hurdle: installation of all the pieces and then direction forward. Perhaps in a future piece, we can mock-pair together to knock-out some of these puzzles.

The truth is that learning to code involves a great deal of figuring things out on your own. That being said, it doesn’t mean that you are on your own, so if you do get stuck, remember that you are probably not the first or the only person to have ever gotten stuck at your block. If you've tried everything and still can't get there, look me up; maybe I could help.

One last hint: I highly suggest that you read the READMEs! They will tell you how to run the program and/or the specs/tests.

Sources:

  1. ParallelsDesktop - windows 10
  2. Setting JAVA_HOME on mac:
    a. Jonas Rabbe; Oct 29. 2013 & Arv; Sept 27, 2018; https://stackoverflow.com/questions/14702702/how-to-set-java-home-in-mac-permanently
    b. https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/
    c. (Temporary) http://www.sajeconsultants.com/how-to-set-java_home-on-mac-os-x/
  3. Setting JAVA_HOME on Win: https://putridparrot.com/blog/environment-variables-in-powershell/
  4. Homebrew: https://brew.sh
  5. Chocolatey: https://chocolatey.org/install
  6. Install Leiningen: https://community.chocolatey.org/packages/lein
  7. Clojure: https://clojure.org
  8. Install & Setup:
    a. Mac: https://clojure.org/guides/getting_started
    b. Windows: https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows
  9. Leiningen: https://leiningen.org/
  10. Script Mac: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
  11. Script Window: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat
  12. .NET: https://dotnet.microsoft.com/download
  13. Oracle; Java8: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
  14. Git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
  15. Clojure Koans: https://github.com/functional-koans/clojure-koans
  16. Euler: a. https://github.com/slagyr/euler b. https://projecteuler.net/
  17. PowerShell Commands: https://docs.microsoft.com/en-us/powershell/module/powershellget/update-module?view=powershell-7.1