4 Steps to Optimize your Computer for the Aspiring Programmer

Starting out in the world of programming is daunting. This challenge is exacerbated by GUIs (graphical user interfaces) like Codecademy that allow dev noobs (like me and you!) to learn basic programming without having to tangle with critical dev tools like text editors and the Command Line. The following tips allow you to springboard your dev learning by setting up your (Apple) computer with all the tools and hacks you need to become the next Wozniak.

1. So Many Editors!

I remember when I was starting out, the search for the right editor was exhausting — Especially when you’re not sure yet how to use that editor to interact with the Command Line (more on this), or the web!

I’m going to make it simple for all you budding hackers: Use Atom. It’s free, it’s easy, and more and more seasoned vets are making the switch. As a beginner, it works great due to it’s simple package manager and effortless customization tools. Also, when you’re a pro, you’ll be glad Atom is your editor as it’s fully open-source and can be profoundly customized to your every need. Download Atom and put it on your dock, right next to Terminal.

Best friends Terminal (left) and Atom.

Once you have Atom up-and-running, here are a few tips for getting the most from your editor from the beginning:

Snippets:
  • Set a pry snippet for your Ruby prying needs and learn more about how snippets can make your life easier. To do this, open your Atom settings with “COMMAND ,” (or the boring way through Preferences…) and click on the “Open Config Folder” button:
Atom settings (COMMAND ,)
  • Next, select your “snippets.cson” file, which is a Coffeescript file (which is kind of like a cool kid Javascript file…), and paste in the following bit of code:
‘.source.ruby’:
 ‘pry’:
 ‘prefix’: ‘pry’
 ‘body’: ‘require “pry”; binding.pry’
Atom Config Folder snippets.cson
  • We did this for two reasons: First, this bit of code is saying, “When Atom is working on a Ruby file (.rb), and ‘pry’ is typed into the file, it will be replaced with ‘require “pry”; binding.pry’. This will become very helpful when you start actually building programs and TESTING those programs — Essentially, it prevents you from having to rewrite a bunch of code over and over again, something that should always be avoided. Second, and more importantly, this exercise has introduced you to the ‘snippets.cson’ file in the Atom Config Folder, which will be super helpful anytime you find yourself rewriting the same trivial code — Make a snippet for it!
Packages:

Atom packages are super fun to look for and even more useful when you find good ones. First, I’ll cover how to install new packages (it’s really easy), then suggest some packages to start out with.

  • To search for and install new packages, simply go to your Atom settings page (COMMAND ,), navigate to the ‘Install’ tab, and go crazy searching for awesome packages.
Packages I recommend starting with:
  • File-Icons: The purpose of this package is purely aesthetic, as it simply provides themed icons to differentiate between file types, but it’s cool.
  • Linter: This package is especially great for the novice programmer. It provides feedback on syntax errors in your program and helps to identify solutions. You’ll need to download language specific packages to accompany the main Linter package, i.e. Linter-Ruby.
  • Open-Recent: Simple package — Puts an ‘open recent’ option in the File menu. Sometimes helpful.
  • Ruby-Block: This package is Ruby-specific, but I recommend finding similar packages for whichever language you’re learning. Ruby-Block highlights the start and end of whichever block you are currently editing, which becomes helpful when trying to figure out where you’re missing an ‘end’!
  • Zentabs: Zentabs helps you to stay organized by limiting the amount of tabs that can stay open.
General Atom Settings and Shortcuts:
  • As you wrap up your Atom setup, I recommend reviewing the general settings page frequently (again, COMMAND ,) and messing around with the configurations until you have it just right. Some quick suggestions include finding and using a favorite programming font, showing invisibles so you can practice perfect syntax, and selecting ‘Soft Wrap’ so you can read your lines while the editor is in a half screen window.
Select ‘Soft Wrap’ so you can read your lines while using a half screen window
  • Last bit about Atom, some important shortcuts: I recommend reviewing all the shortcuts for all of your frequently used applications and memorizing the most useful ones. As far as Atom, there are two that I find myself using most often: COMMAND-d and COMMAND-\. COMMAND-d is a nice shortcut that allows you to select a word and then repeatedly press COMMAND-d to select all the words in the file that are the same. This becomes useful when you find yourself changing a variable or method name. COMMAND-\ simply minimizes the tab column of the left side of the editor, providing more space for your code.

2. Bash What? and the Command Line

Learn to love the Command Line. On your Apple, this is the app called ‘Terminal’, which has many alternatives, which you can research and download should you get to that point. Basically, Terminal allows for text-based interaction with the operating system by using a Unix shell that accepts commands. The most commonly used Unix shell is call the bash shell, and your bash profile is a collection of script that tells your bash shell how to look and act. The quickest way to fall in love with the Command Line (i.e. Terminal), is to love your bash profile.

Here’s some tips on making your bash profile bad bash (Command line jokes are funny.. I promise.).

First, open your terminal and type the follow command: ‘atom .bash_profile’

You’ll use the ‘atom’ command a ton in order to open files with your editor (if you’re using Atom). The above command will open Atom directly to your Bash Profile, which will most likely be empty if this is your first foray into command line customization. Below is a screenshot of my current Bash Profile. We’ll use this as an example to get your customization started.

  • The first line is simply a welcome message that appears every time I open a new Terminal tab. ‘Echo’ is a Unix command that displays a line of text.
  • The next line:
export PS1=”\e[0;30m\W \e[m\e[0;33m✈︎ \e[m”

formats my command prompt — the part of my command line that appears every time I return to a new line. As you progress in your dev learning, you’ll start to see more and more creative command prompts and overall Bash Profiles, often known as dotfiles.

  • The next two lines format the coloring for the Command Line:
export CLICOLOR=1 and export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

‘CLICOLOR = 1’ simply defines a command line interface color theme that’s already builtin. ‘LSCOLORS’ formats the coloring for output of the ‘LS’ command, which lists all the files and directories located inside your working directory (you can identify your working directory with the command ‘PWD’, which stands for ‘print working directory’).

  • The next 13 or so lines of my profile are the most commonly added kind of line — Aliases. An alias is similar to the snippets we discussed above. They are simply shortcuts you can define to quickly get to common destinations or perform common actions from the Command Line. The first few aliases I’ve defined are just quick commands for navigating through my file system. The next group of aliases are used to quickly perform Git commands. My only suggestion for defining aliases is simply to pay attention to commands you find yourself keying frequently and define aliases for them — Don’t go overboard.
  • The last line in my profile is a bit of code that will eventually be helpful when working with Rails (as in Ruby on Rails or RoR). It might be a good idea to learn about this the hard way :).

3. Finish Setup with Homebrew, Git, and RVM

Homebrew is what’s known as a package manager, which is a program used from the Command Line to install many of the tools you will use as a developer. Installing Homebrew on your computer is a straightforward process, starting with the installation of Apple’s Xcode:

  • To install Xcode, simply go the the App Store, search for Xcode and download. This can take a while, so be prepared to wait — A good time to customize Atom!
  • Once Xcode is loaded on your machine, use the Command Line to download Homebrew. To do this, open a Terminal sessions and copy and paste the following command:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This command simply tells your computer to install the Homebrew application. You many need to press enter through a few prompts in order to complete the installation.

Once the installation is complete, type the command: “brew doctor”. This is a Homebrew command that checks to make sure Homebrew is running smoothly. If everything is ready to go with Homebrew, you will get the response, “Your system is ready to brew.” If you do not get this message, troubleshoot the issues using the error message and every developers favorite troubleshooting resource — Google.

  • Once Homebrew is up and running, it’s time to install Git (Git is probably already installed on your computer, but you’ll want to instal the most recent version). Git is kind of an enigma for many new programmers, but it is an incredible resource that is learned very quickly. Basically, Git is a version control application that helps manage changes to files. GitHub is simply an online repository for you to store your software versions, known as ‘commits’. There is a ton to learn on this topic — I recommend starting here. To install Git using Homebrew type the following command in the Command Line: ‘brew install git’. The screenshot below also includes the command ‘brew update’ — You should run this command as often as you remember to update your version of Homebrew.

The next step is to setup your GitHub account. When you write your first program and want to push it to a GitHub repo, you’ll connect your GitHub account to your Git with the command ‘git push’.

  • Next step is to install RVM, which is an application that allows you to install and manage multiple versions of Ruby and Rails on your machine (RVM stands for Ruby Version Manager). If you are learning RoR, this a a great tool. Download RVM with the following command:
‘curl -L https://get.rvm.io | bash -s stable — auto-dotfiles — autolibs=enable — rails’
  • Next, rerun ‘brew doctor’ to make sure everything is still working properly. Now that you have installed Homebrew, Git, and RVM, you will come across other packages you will need to install with Homebrew as you get more experienced. When you need to install a new package, make sure to run ‘brew update’ and ‘brew doctor’ before running ‘brew install package_name’.

4. Final Tips

Your computer should now have an excellent foundation to help you become an awesome programmer. These last few tips are just some small tools and tweaks to make your coding workflow as efficient as possible.

  • First, find a window management system that works for you — Some application (one is now built into OS X El Capitan) that helps you organize your active windows. I use Moom, but Divvy is also very popular.
Quickly split your screen into to side-by-side windows with Moom. This is my standard screen — Atom next to Terminal.
  • Second, speed up your keyboard and learn to type! The default speed for Apple keyboards is pretty slow — In System Preferences, make your keyboard move as fast as it goes (see below). Then, use typing.io to practice typing.
Speed up your keyboard!
  • Third, bind ‘caps lock’ to ‘control’ — ‘Caps lock’ is rarely useful and mostly always annoying… Navigate to the same screen seen above and select ‘Modifier Keys…’ Once here, simply change the ‘caps lock’ menu to ‘^ control’.
Death of caps lock

That’s it. Comment additional tips!

Happy coding.

N