We’re going to cover quite a bit today, so be sure to carve out some time for this one. Also, it’s best if you follow along, so if you don’t already have Eclipse installed, see last week‘s article for a link to the download page.

My goal today is to show you how to get started with Eclipse, and then show you the building-blocks of programming: variables, conditional statements and for loops. These three things form the basic tool set that you’ll use in every program from here on out. Variables are how you store and access information. Conditional statements are how you control the program and allow it to make decisions. For loops are the most basic way to run through a set of data points, running calculations or making decisions along the way.

Two weeks ago I discussed a thought exercise that will help you get in the right frame of mind for doing some computer programming.

Today, I want to help you get an Integrated Development Environment (IDE) set up, so you can follow along with my examples in the coming articles.

The Language: Java

The programming language of choice is Java. Java has several advantages for us than other languages:

Java has fantastic documentation. Sun / Oracle, who controls the Java Language, has a large library of documentation on functions, interfaces and other important bits. There are also loads of tutorials.

Java is Object Oriented. This means that all of our Java code has to do with things, rather than more abstract ideas like memory locations, pointers and other stuff that makes my head hurt.

Java is platform independent. This is the biggest reason for Java’s success. You write code once, and you can run it anywhere: Mac, Windows, or Linux. I’ll go into more detail on this later.

Java is everywhere, primarily due to the points above.

So, we’re using Java because it’s the biggest thing in programming right now, it’s very approachable, and it won’t matter what computer you’re using to follow along, the code is identical for everyone.

The IDE: Eclipse

So, here’s what you want to download: Eclipse. Eclipse is an IDE, and the package I’ve linked to includes the packages for working with Java and using GIT to keep backups of your code. GIT is also how I’ll be giving you sample code, via GitHub.com. Don’t worry, you don’t have to make a GitHub account to access my code, but you will need one to upload code if you ever want to send me your code.

Here’s why I like Eclipse:

Real-time compliation level errors: Normally when you write code and you typo a variable or function name, mismatch some curly brackets ({}), or whatnot, you don’t find out until you attempt to compile your code. Eclipse examines your code as you type, and gives you error and warning flags when you type variables you haven’t declared or mistype function names. This is a huge time saver.

Eclipse integrates Git, so you can keep remote backups of your code up to date with just a few clicks of your mouse.

Eclipse has support for several programming languages, so if you ever want to branch out from Java, you don’t have to learn a new IDE along with a new language.

Whenever you meet someone new, one of the first questions that comes up is “What do you do?”

For me, the answer is programming. For some, that brings to mind the classical TV/movie trope of Mountain Dew, thick glasses, a pocket protector and walls of unorganized computers and blinking lights. For others, I instantly get slotted as someone who knows how to program VCRs and can fix their computer.

My hope for this series is to dispel some of the stereotypes surrounding programming, confirm others, and give you a chance to learn some programming skills of your own, if you’re so inclined.

Programming 101: PB & J

If you’ve ever been to a summer camp, or leadership training or anything that required team building, you may have done the PB&J exercise.

Everyone sits in a room facing a table, which has a jar of Peanut Butter, a jar of Jelly, a loaf of bread and a knife. Usually the team leader sits at the table, and calls out the most confident person in the room. That person sits in the front of class, with their back to the table, and has to give instructions to the person at the table, and get them to make a PB&J.

The twist is, the person at the table pretends be an alien and has no idea what a PB & J is (let alone a sandwich), is mute and can’t give feedback, only follows the instructions of the person who has their back to the table, and follows them to the letter. The person assembling the sandwich doesn’t know how to open the jars. Doesn’t know how to use the knife. Doesn’t know how to untie the twisty-tie holding the loaf of bread together, has no idea what “spread” means, etc.

OM NOM NOM…

If you’ve never seen this, it’s hilarious, and usually ends with the assembly person covered in PB & J, a mess all over the table, and a hungry audience.