r/learnprogramming • • Apr 28 '22

If everything is ultimately binary, does't that just make programs a specific number?

I did the CS50 course a while ago and they covered binary in there. I did binary back in 2006 when I was at college too so understood the logic behind it already. It's either on or off!

When a C program compiles, it goes through it's phases and compiles to assembly and then ultimately machine code i.e binary.

Let's say our program is 5,000,000 pages of 1's and 0's. All of those 1's and 0's make up a single number....albeit a super long number.

Does that mean that the entire Linux operating system, for example, can be represented by an actual number?

If so, why are we not storing programs as a number because that would take up less space than the 5,000 pages of 1's and 0's.

110101000101011111011011111110111100 = 57000443836 in decimal. So why don't we store programs in decimal and convert that to 1's and 0's in real time?

Storage would be much less. Is that how compression works?

These may be crazy questions but it just entered my head earlier when thinking about what the binary of a program can represent.

Even shorter than decimal is HEX.... So why don't we store programs in Hex?

Any help appreciated on this one so I can wrap my head around it.

1.7k Upvotes

346 comments sorted by

View all comments

Show parent comments

1

u/maxpossimpible Apr 29 '22

Then you could consider biological life as just a number as well, albeit with base 4.

1

u/SufficientUndo Apr 29 '22

Somewhat - it's actually way more complicated.

1

u/maxpossimpible Apr 29 '22

True, because you need a system to read the code and translate it. Though that is true for computers as well.

1

u/SufficientUndo Apr 29 '22

No, I mean it's more complicated than the double helix. There is, for example, also mitochondrial dan and a whole load of other ways information is encoded.

1

u/maxpossimpible Apr 30 '22

Sure there's mitochondrial DNA that's just passed down maternally. And sure there's epigenetics as well, but that's those changes don't have an inheritance component to them - they're just small modifications of how certain genes are expressed, either slightly silenced or enhanced. DNA Methylations and histone modifications.

There are also RNA silencing and post-transcriptional modifications... But I think the essence and replicability of us as an organism are maintained 100% in the chromosomal and mitochondrial DNA. Of course, you'd need a "machine" to translate this, same as you'd need a machine to translate the computer code. In this case, it's a cell, for computers it's a...

But gotta give it to you, not a lot of people know about mitochondrial DNA.

1

u/SufficientUndo May 01 '22

Yes - I agree - my point is only that someone's DNA sequence is not nearly enough to represent a particular human being. I don't think that's what you were claiming, but I think it's important not to think that the helix is analogous to a computer program that produces a person.