Welcome! In this module we’re going to start learning how to program in Ruby.
It will be a long process and you will have moments of elation, excitement and, sometimes, we're sorry to say, frustration. But we promise you, learning to think in the disciplined way that programming teaches will change your life for the better.
Our method for teaching programming starts from a different place than you might expect. If you've ever looked at programming tutorial or book you might be expecting lectures on loops, variables, data types, or something like that. We think there's a different, and better, way. We start by thinking deeply about having conversations.
Many of the ideas we’ll share in this module ask you to reflect on "when you learned to talk" or "when you’re talking with a friend." We call this "programming as conversation" and it gets you to think about communicating instead of "memorizing strange programmer words, facts, and symbols." You'll learn those words and symbols eventually, of course, but you'll see them as rules for communication, never as the point of programming itself.
Programming is communication.
At its heart, programming is about communicating strategies for solving problems.
We have to communicate with computers using funny words and symbols. The reason we do that is because people express themselves in tons of ways and it's hard to make a machine understand them all. It's far easier to teach people to talk to the machine in a language it can understand (although it's frustrating for us!).
One of the most essential ways of communicating, that we've all practiced thousands of times, is a conversation.
"Conversation" comes from the Latin words mean "with turns." In conversation we "take turns" expressing ourselves. When we converse in this way, we're interacting. Each person in the conversation shares their insights. Shared curiosity leads the pair to a new areas of discussion or explanation.
But in a conversation something else happens behind you say something / I say something. That would just be two people talking nearby. In a conversation something else happens, something that requires the things that are said to be transformed. We call the things we say "expression" and the transformation "evaluation."
In a conversation, we said, each person "expresses themselves." But let's be more precise about what that means.
"Expression" comes from the Latin word meaning "from pushing." The ancients imagined that, in a conversation, I would have an idea in my brain and I would need to "push" that idea to you through the words I chose, through my expression. To "express oneself" then is "to capture one's being" and "push it over to another person."
Once you "push" an expression to someone else, that expression needs to be evaluated. When we're talking with a friend and we say something deep, or challenging, or complex to them, we look at them and can see them evaluating our expression.
Ruby does the same.
Given an expression, Ruby will evaluate it and, like a good friend, give you a reaction about how it evaluated your expression. In day-to-day life we call that a "response." It might be a snort, a giggle, an eye-roll, a head nod, or a screaming of "ANYTHING BUT THAT!" In the programming world we call responses from the programming language a return value.
When expressions are evaluated, they return something
Congratulations! You've finished your first lesson in thinking about programming as conversation. As you might guess, expressions are really important because they're how we "push" ideas to computers and other programmers. We're going to spend the remainder of this module learning to build expressions and predict how Ruby will evaluate them.