eli5 How do people code with binary?

1.29K viewsOtherTechnology

Like I get that it can be a 1 or a 0, and that stores information, but how do you get information out of that? And how do people code with it? Seems like all it could store is numbers

Edit: Thank you all, this is very helpful

In: Technology

26 Answers

Anonymous 0 Comments

When I was studying computer engineering in college, one of my professors had a saying “bits are bits”. To the CPU of a computer everything is just high/low and nothing else.

But as others have said those combinations and strings of high/low can be assigned meaning. The CPU doesn’t need to know or care about the meaning as long as we program it to do the right thing with the data.

Here’s an example. Music inside a computer is represented by a series of numbers that tell the the sound card how high or low to make the voltage on the output at a specific time. When you click the little slider and drag it to the right to “turn up the volume” this is telling the CPU to take the current audio data and to multiply it by some factor that is related to how high you set the volume. In the context of making the sound louder, this simple math actually makes sense.

The CPU doesn’t know or care that the data it’s multiply is “music” or “volume level” it just does the math and then sticks the result in whatever memory location it was instructed to. In the case of music that “memory location” is actually the sound card.

Another example is graphic design. Let’s say you are making a flyer for an event at your local library. You have a picture of your friend Ellie who has green eyes. You decide you want to match the background to her eyes. In the program you can use a mouse tool to click on her eyes and it stores the color in the program so you can make it the background.

The CPU doesn’t know or care that you’re making a flyer. It just asks the mouse where it is, then it asks the program what color is on the screen where the mouse is and then it stores that color in system memory. But all that data looks the same to the CPU, and basically it’s all numbers. It gets the data from the mouse by looking in a memory location that is actually the mouse. When it goes to ask the application for the color, it doesn’t know the application’s name, just its ID number. To get that color data from the application the CPU is actually just looking in another memory location. When it stores the color it’s just putting it back to a specific memory location. So all the data the CPU works on is literally just high/low for *everything.*

This concept is actually part of the reason why computers can crash or lock up. The programmers have to be careful to tell the CPU to get and work on the proper data because the CPU can’t tell the difference between music, an essay, email, printer settings etc etc. It will happily try to “add” a picture of your dog to the setting for how long before your screen saver turns on and then spit out the “result” even though that makes no sense.

You are viewing 1 out of 26 answers, click here to view all answers.