Get started with Web coding. Part 3: The command line

See all posts in this series.

So there’s code, and then, there’s code. Code (with a capital C, italics, spinning pinwheels and possibly fireworks accompanying it) is what my roommate in college studied. She spent long nights in a lab with mostly guys, most with foreign accents, and earned a B.S. in computer science, while I spent long nights at school board and city council meetings and earned a B.A. in journalism.

There’s no reason for my ex–college roommate to learn how to cover city council, so why would I need to learn how to write code?

One semester, my roommate had to write a compiler. In a required course. I will never know enough to write a compiler.

I’m not saying the journalists of the world have to become what she became — a systems analyst. But my roommate could (and still can) write standard English correctly, grammatically. She can communicate clearly. Her writing skills helped her rise in her profession. She wouldn’t know how to write a news story about a school board meeting, but in many situations in her jobs when writing was necessary, she could get that done quickly and well. It gave her an edge. It made her a better manager. It helped keep her projects on track.

For journalists in 2013, code starts to look more like that. Someone has even said: “In the digital age that we all live in, you are essentially illiterate if you can’t code.”

I wrote before about teaching programming to journalists, so here I want to say something new. I want to talk about the command line.

Screenshot: The command line in Mac Terminal

Power in your hands

Back in the 1980s when real computers were starting to appear in people’s homes, the command line was what you got. A blinking cursor, waiting for your input. There was no graphical interface, no menus, no Windows.

The command line is still there, on every computer. Most people never know that. And why should they?

Well, here’s one reason. A few years ago, I wanted to scrape some data out of some websites, so I emailed a few people who knew about that kind of thing and asked them how they would do it. One wrote back and said she would write something in Ruby. Another wrote back and said he would write something in Python. I felt very deflated. I didn’t know Ruby or Python. Moreover, it did not seem worth it to learn a whole programming language just to do the little project I had in mind.

So I never did that project.

The command line is not a programming language — it’s more like the gateway drug to programming. Without it, you will keep hitting roadblocks if you try to learn a programming language. The command line is where programming happens.

Go ahead, take a look at the command line. Do it now. It’s on your computer already. It’s waiting for you.

Screenshot: pwd and ls commands

Learn how to use the command line

I discovered Zed Shaw while I was searching for a way to teach journalism students to use Python (a programming language). It turns out that Zed not only wrote the world’s best introduction to programming for complete beginners — he also wrote a streamlined, basic introduction to the command line.

This book isn’t a book about master wizardry system administration. It’s just a quick introduction to get newbies going. — Zed Shaw

First, you must read the introduction, and you must do what Zed says. It’s not hard, but it requires a certain level of commitment. You have to want to learn it, not just memorize some stuff to pass a test and then forget it.

Here is where I see a big stumbling block for students. If you’re thinking about learning code as something you do just for this class, the one you’re in now, then you are not going to actually learn how to code. At all. If you think you don’t need to memorize things for the long term — the way I was forced to learn my multiplication tables back in fifth grade, which left me in tears on more than one schoolday — then you will never be able to code. Not in any real way.

Anyway, if you get acquainted with the command line (especially if you use Zed’s friendly little book to do so), it will be much, much easier for you to start learning any programming language.

Screenshot: mkdir and touch commands

What does this have to do with Web coding?

Good question. Because you can learn HTML and CSS and JavaScript and jQuery without ever laying eyes on the command line.

If you only want to work inside a CMS (like WordPress, or Drupal, or newsroom systems such as Publicus), then don’t worry about it. You’re just a cog in the machine. You can write text in a little box and click the send button.

But if you want to work on projects like The New York Times‘s Snow Fall, or create animated graphics that tell a story, or produce data visualizations, you’re going to need a deeper understanding. You’re going to need to learn the fundamental programming structures (really learn them) and understand how they work. You will not need the equivalent of a B.S. in computer science, and you will not know as much as a systems analyst. You will need to work with variables and if statements and for loops. These exist in JavaScript, and they — these structures — are the mechanics of Web interaction.

So if you begin at the command line — at that blinking naked cursor — you can get there.

If you try to get there with JavaScript only, and no other programming languages, I’m not so sure.

This Series

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.