You’ve heard people talk about “coding”, “writing code” and “learning to code”. Code, code, code. People love to talk about it. People love to sing its praises. People love to make a big deal about how important it is. But it might seem like they never get around to actually saying what it is.
Code is text that a computer understands and obeys. Code is written in a special kind of language called a programming language. It’s made up of words and symbols (which you might normally think of as punctuation) that are arranged in such a way as to be meaningful.
Code is also known as source code because it is the source of a computer’s behavior. We use source code to create programs that run on a computer. This is why the terms “coding” and “programming” are synonyms. A person who’s writing code is said to be programming a computer.
NOTE: In fact there are several terms used to describe the act of writing code. Here are a few: coding, programming, hacking, software development, and developing. Some people might argue that each term has a subtly different meaning, but in the end they all mean telling a computer what to do.
Unfortunately, you’ll find that there are many synonyms and ambiguous terms used throughout the world of coding. This is a fact that may surprise you since the code that we write must be very precise and exact in order to instruct the computer to do what we want. It’s as if we have a limited capacity for strict precision - and we have to use all that on the computer - so that we become loose with our language when talking with other humans. Fortunately, humans are much better at handling ambiguity than computers, but it takes some time and patience.
This is some code written in the Python programming language.
print("What is your favorite ice cream flavor: chocolate, vanilla or strawberry?")
flavor = input()
if flavor == "vanilla":
print("Hey, vanilla is my favorite ice cream too! We should be friends!")
else:
print("I guess everyone is entitled to their opinion."
)
Take a moment with the code above. Try not to get bogged down in the details, but see if you can get a feel for what it would do if run by a computer.
It’s almost English, isn’t it? I mean, it’s sort of English. Well, it’s kinda, vaguely similar to English. Right?
After you’ve spent some time reading the code, take a few moments and write down what you think it does. Once you’ve done that click the text below to see a description.
Click here to read about the code
As we said earlier code is used to create programs (often called applications or apps) that run on a computer. Every program you use was created with code. From games to word processors to the web browser you’re using to read this, as well as thousands and thousands of others … all written in code. And, moreover, that code was all written by human beings. Human beings, just like you.
This may seem a silly question, but it really isn’t. The definition of what is or isn’t a computer is becoming less clear all the time. Rather than offer a definition, it’s probably more clear to give some examples:
All either are computers or have computers as an essential component. All are powered by software written in code.
Computers and the programs that run on them are not magic. We stress this fact a lot at NSS because it’s easy to forget. We spend a lot of our lives using software without considering the work that goes into it. Without considering the people whose job it is to write the code.
In a way, it’s a testament to the quality of the programmers that it’s even possible for users to ignore all the work that goes into creating software. Web design pioneer Irene Au refers to good design as a refrigerator. “When it works, no one notices, but when it doesn’t, it sure stinks.” As programmers, we get to dig in and understand the complexities that make programs work so they can be blindly used by people who don’t need to think about how they were created. Just as the intricacies that make a refrigerator run are not rooted in some strange, unknowable mysticism, neither is the code we write nor the software we create.
So, no, it’s not magic. It’s the culmination of time, grit, and hard, yet rewarding, work. Work done by real people. People like you.
If you’re ready to dig into the complexities of Software Development with hands-on learning at NSS, check out our upcoming Jumpstarts or Bootcamps and apply today!
The code does the following:
It prints a message to the user to ask what their favorite ice cream flavor is.
It then waits for the user to type in their favorite ice cream, and “saves” the word they typed into a container called flavor.
Finally, it checks to see if the flavor the user entered is "vanilla".
If the flavor is vanilla, the code prints the message: “Hey, vanilla is my favorite ice cream too! We should be friends!”
Otherwise, the code prints the message: “I guess everyone is entitled to their opinion.”
Here’s a demonstration of the favorite_ice_cream program running. In this demo, the program is run twice.
NOTE: Do not worry if none of this makes sense to you. We’ll get there.