12.9 C
New York
Wednesday, December 7, 2022

What Is a Programming Language? – How-To Geek

Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.
By submitting your email, you agree to the Terms of Use and Privacy Policy.
Fergus is a freelance writer for How-To Geek. He has seven years of tech reporting and reviewing under his belt for a number of publications, including GameCrate and Cloudwards. He’s written more articles and reviews about cybersecurity and cloud-based software than he can keep track of—and knows his way around Linux and hardware, too. Read more…
At the foundation of computers and their programs are programming languages, the weird-looking lines of code that likely make your head hurt just by looking at them. But what are programming languages, and how do they work?
In short, a programming language is the way in which a computer programmer “talks” to a device. If you know how to “speak” one of these languages—and there are hundreds—you can create a program that can perform tasks. These can range from the very simple, like a script that moves a file from one place to another, to the very complex, like rendering a 3D world in a video game.
Programming languages are the reason we can do complex things with computers. At their core, computers are still operating on binary—also called machine language—a system where zeroes and ones determine what the computer does, and how. You can think of programming languages as a layer over this core, so humans don’t need to toggle the zeroes into ones and back again.
This is a very good thing: if we still had to use binary to program it would take a long time to create even a simple script. Advanced programs would likely never get made as getting all the ones and zeroes in the right palace would take an army of people. Programming languages, though tricky to learn and use, at their core are labor-saving devices.
Roughly speaking, programming languages fall into two categories: low-level and high-level languages. Low-level languages are called that because they are “close” to the machine, they can speak to it directly. This includes machine language and assembly languages, which are programming languages that are only a little removed from binary.
High-level languages are a step above low-level languages. They’re further away from the machine, but are readable by humans. “Readable” in this case means that if you know the language in question you can look at a few lines of code and figure out what’s going on. This also works the other way around: you can type up commands which will then be executed by the machine.
That said, it should be noted that programming isn’t quite as direct as that. When typing up commands in a high-level language, you’re not telling a device what to do. Instead, you’re talking to a so-called interpreter, a program which is part of the language that turns a command into binary. You tell the interpreter what you want, and it in turn tells the computer what you said, but in machine language.
The interpreter bridges the gap between you and the machine, and every language has a different interpreter. Assembly languages are a bit weird as their commands also need to be interpreted, but they use what’s called an assembler instead of an interpreter as their commands are closer related to the “pure” machine language and thus don’t need full translation.
The interpreter is a finicky bit of tech: it needs to be spoken to in a certain way for it to do its job of telling the computer how to move zeroes and ones around. Instead of saying “make the blue box go to the top right,” we have to enter a line of code that the interpreter understands, which varies by programming language. The interpreter then takes this input and tells the computer what to do.
Since natural language is too hard to understand for computers and interpreters—something that may change with the no-code revolution—we use programming languages, languages that can be understood by interpreters and humans alike. The interpreter then relays it into machine language, creating a small daisy chain.
The choice for the word “language” wasn’t made by accident, either: just like in human languages, programming languages have internal rules that keep it all from going off the rails.
A programming language will have a syntax, a set of rules concerning word order and word use, just like in a human language. For example, in English you can say “Gary gave Fred a book.” In this sentence, you know exactly who gave what and to whom; change the words around and you get a different sentence: “Fred gave Gary a book.” That still makes sense, but if you say “a book to Gary Fred gave” we have a problem on our hands.
Programming languages are no different: the right bits need to go into the right places for a sentence—usually called a “line”—to make sense. It’s just that programming languages use different ways to express themselves.
Some stuff is the same: many programming languages will use verbs, for example. In Python, which is generally considered to be one of the easiest languages to learn, you can tell it to print a line of text.
In this case, the words “Hello, world” will pop up on the screen. Naturally, commands can get a lot more complicated than that; most languages have a massive set of verbs that can be used to perform all manner of actions.
Of course, not everything makes this much sense right at a glance: most of the code you’ll come across has a crazy amount of symbols and punctuation marks you wouldn’t use in daily speech. However, once you get your head around them, they’re less weird than you think.
In human language, we can use different words to denote different things. In English, for example, we denote objects with “it” and people with “she” or “he.” If you switch these around, a sentence would fall apart. Programming languages aren’t much different: brackets and parentheses just denote different classes of action. Switch them around and the sentence falls apart.
Naturally, these things can also change across languages: a parenthesis in Python does something completely different than they do in Lisp, which is different again from C. Just like in human languages, use and meaning can shift, making some languages better at certain things than others.
So which language is the best to start learning? There is a lot—and we do mean a lot—of argument between fans of different languages about what each language can and cannot do and which is best. But the upshot is that which language is best really depends on the programmer in question. Just like with human languages, your opinion is affected by your thinking patterns and what naturally makes sense to you.
If you want to be one of the few that can “talk” to machines and make them do what you want, you could check out Python, which has a reputation for being easy to learn. If you want more of a challenge, you could check out C, which is the foundation for most operating systems. Whichever you choose to go with, it’s a lot of fun to start thinking like a programmer.
RELATED: Learn to Code with These Awesome Apps and Websites
Facebook
Instagram
Twitter
LinkedIn
RSS Feed
The Best Free Tech Newsletter Anywhere
By submitting your email, you agree to the Terms of Use and Privacy Policy.

source

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles