Image for post
Image for post

Learn to Code the Easy Way (Part 1)

Learning to write software can be hard. One of the things that can be the most challenging for a beginner is the mounds of free information online, because most of it assumes that you already know a bunch of fundamentals and you get lost if you don’t. I will show you how to get from no coding experience at all to having a working website that can receive, store, and display information. We’re going to use a programming language called Elixir, and a website framework that uses Elixir called Phoenix.

Elixir is a beautiful programming language, and will allow you to keep things very simple in the beginning but provides very powerful and helpful tools that you can leverage as you gain experience. The language is also designed very intentionally, and will push you towards writing good code as you learn more and do more with it.

When I was just starting on my journey as a coder, I took some online courses at and thought they were great. They had a lot of exercises to explain bits of code in various languages and taught me how to write some basic lines of code. But once the courses were done, I realized that I didn’t even know where to put my code so that it did something. On the website, there was always a magic black box that you typed your code into and it would tell you if you got it right or wrong. But I had no idea where to find that magic black box on my regular computer! So before I even show you how to write a single line of code, we’re going to get things set up so that you know where to put your code so it does something!

To code, you need a computer. And it turns out, you don’t even need a very fast or new computer! If you’re not already a programmer, then either you have a computer that runs Windows or you have a Mac (Apple).

If you have a computer that runs Windows, just throw it away now because it’s useless.

Just kidding! :)

I’m going to give instructions for Mac computers, because most web developers use them and Elixir is easier to use on non-Windows systems.

If you really don’t have access to a Mac, I’ve written a similar guide for Windows computers.

So grab the closest Macbook Air or whatever Mac you have lying around, and it should do the job just fine.

The first thing you need in order to write some code is a code editor. Technically, you could use the TextEdit app that comes with your Mac, or any program that allows you to write lines of text and save them as files, but you would miss out on all kinds of conveniences that make your life easier. As a metaphor, it’s like using a push reel mower to cut the grass on a soccer field. You’ll wish pretty quickly that you’d invested in the right tool for the job. Fortunately, there are much better options and we’re going to set you up with one of the best (and it’s free!)

We’re going to pick Visual Studio Code because it’s got good support for Elixir and it will grow with you as you learn more. It’s also a lot less intimidating than many of the other options, and as you get better at coding you’ll find that it has just about every tool and convenience that you could wish for. It’s one of the most popular editors, so chances are that if you learn another programming language at some point you won’t have to also pick up a new code editor to use it.

To download the editor, go to and click the download button for Mac. You can close the tab once the download starts. Then, click your Downloads folder and select Visual Studio Code (it’s a black and blue icon). Click “Open” when you get the warning about about Visual Studio Code being an application downloaded from the internet, and then close the tab that automatically opens in your browser telling you about the program.

You’ll want to open Finder and go to your Applications folder. Open Downloads and drag and drop the Visual Studio Code icon into your Applications folder. You can close Finder.

You should have Visual Studio Code open at this point. We need to do a couple of things:

Click on the “Extensions” button on the left menu, which looks like this:

Image for post
Image for post

In the search bar in the top left, type in “ElixirLS” which stands for Elixir Language Server. Click the green “Install” button. Once it’s finished installing, click the blue “Reload to Activate” button.

Now that you have a code editor set up, you’re ready to write your first code in Elixir!

In Visual Studio Code, go to the top bar and click File -> New File. You should now see a blank text page, like you would if you were creating a new Word document. Paste the following Elixir code into that blank page:

IO.puts("Hello World!")

Now go to File -> Save or press Command + S.

The name you give the file is important, or at least the ending is important. Elixir files need to end in .exs to work properly, so we’re going to name our file hello.exs.

The location you save your file in is going to be important in Part 2, so save the file in your Downloads folder.

You may notice in Visual Studio Code that your code suddenly changed color! This is because of the extension that we installed. When the ElixirLS extension sees that you have a file open and the file name ends with .exs, it will automatically change the color of different parts of the code. This is a huge benefit because as you get used to the colors, it helps you read the code better and find things faster. You can ignore any errors that pop up in Visual Studio Code, they’re just an indication that you don’t have Elixir installed on your computer yet.

Believe it or not, this little snippet of text that you saved in a file is a real program! But unlike the programs you’re used to, there’s no fancy icon somewhere that you click to make it run.

For that job, we’re going to use a program that comes with your Mac called “Terminal”. A terminal is sort of a raw interface to your computer, where you can write a few words and hit “return” and it will make the computer do things (like run programs that you’re creating).

Terminal can do a lot of things that aren’t possible anywhere else. We’re going to use it for a few things:

  1. Install the Elixir programming language
  2. Navigate to your Downloads folder where the hello.exs file is that we created
  3. Run our little program

Please click here to read Part 2, where we’ll use Terminal to do all these things!

Written by

Elixir dev building for the web with Phoenix

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store