7 ms·
Why is so fundamental about the fact that a byte is 8 bits? The fact that a byte is 8 bits is more for historical reasons. Likewise, an int is traditionally 32
by woojoo666 4y ago
Why is so fundamental about the fact that a byte is 8 bits? The fact that a byte is 8 bits is more for historical reasons. Likewise, an int is traditionally 32 bits, but Javascript and Python programmers don't need to worry about that. If a programmer doesn't know that a byte is 8 bits, they probably just forgot it since it wasn't necessary for them to know.
- Kim_Bruning 4y agoWell, I would be slightly worried if a carpenter forgot how many centimeters go into a meter. (Or how many feet go into a yard?). "Sure", you say, "but they don't need to know it by heart. The carpenter can always look that up if they really need it." This is true. You are 100% correct. But think of this: Said conversion is pretty common in Carpentry, so each time our Carpenter forgets, they're going to end up looking it up again really quickly. You would think that after having looked it up umpteen times, the Carpenter would effectively end up memorizing the conversion by accident. Right? So while I suppose it's not strictly necessary, it would definitely be a bit funny to encounter a Professional Carpenter who doesn't have centimeters<->meters memorized.
- Ralfp 4y agoThis analogy assumes that JS/Python devs work with byte-level measurements all the time like how carpenters work with measurements centimeter-level measurements, which is very debatable.
- Kim_Bruning 4y agoTwo things: As the saying goes: if all you have is a hammer, every problem resembles a nail. You can validly say "I've never actually needed a screwdriver", even if the screwdriver might have been more useful for the job at hand. It also depends on what domain you're working in. I just happen to have been working on a Python/JS GUI to operate a Robot this past month. Interfacing with the Robot did require use of bits and bytes. Fortunately both Python and Javascript do support those operations for just those kinds of situations. So while I do agree that some jobs can be done in javascript and python where you can avoid needing bits and bytes, that's my two answers: 1) Bits and bytes sure can come in handy at times. They might be the best tool for some jobs. and 2) For some jobs you really do need to manipulate bits and bytes. You can't avoid them forever. So if you like writing a lot of different kinds of programs for a lot of different kinds of things, you're almost certain to end up using bits and bytes sooner or later. Do that often enough and it does tend to stick. That includes Python and Javascript.
- woojoo666 4y agoI could say the same about CSS though. Eventually, many developers end up working with CSS some way or another. But I still wouldn't consider flexbox a CS fundamental
- Volundr 4y agoJavaScript and Python need to calculate filesysizes, measure network bandwidth and track memory usage just like every one else. There's also of course bit shift operations and byte arrays. Heck byte size is relevant to floating point even.
- carlmr 4y agoBut you do need to worry about that in almost every other language.
- woojoo666 4y agoJavascript is currently the most popular language, and many developers get exposed to it sooner or later. Should we be regarding it as part of "CS fundamentals" now? We didn't even learn it in my school. Point being, the stack has grown larger, and just like we don't expect programmers to know electrical engineering, I don't think we should require front-end devs to know low-level knowledge (just like I wouldn't require backend devs to know CSS)
- mytailorisrich 4y agoA software engineer that forgets that there are 8 bits in a byte is like a surgeon that forgets where the heart is in an human being, in my view... One might argue that it would be fine because as an orthopaedic surgeon specialised in hands they didn't need to care about the heart area but really you wouldn't let them near a patient because it's such basic knowledge that not knowing raises a massive red flag and the basic competency of the person is called into question.
- defrost 4y agoA byte is the smallest addressable unit on a given architecture. Depending on the hardware that byte can be 8, 12, 24, 32, or 64 bits (in my own experience over the years). It's sad so many here are claiming that there are always and only 8 bits to a byte. I've already replied to one person who quoted an ISO standard, that they clearly had not read, in support of this misconception.
- anthony_d 4y ago> A byte is the smallest addressable unit on a given architecture. That’s normally called a word. I’ve seen casual usage of “byte” in that context but formal documentation has always used word.
- Kim_Bruning 4y agoI've also seen "word" used more often. Though maybe some older literature does use "byte" sometimes?
- kcartlidge 4y agoWords and Bytes are different things. As are (genuinely) Nibbles and Chunks.
- defrost 4y agoThere's historically been sloppy overlap between "byte" and "word", even today formal documentation doesn't clarify a difference. This stems from architectures that had both a both a minimal and maximal addressable "atomic chunk" via segmented architecture. Conversations about this varied between Intel, Motorola, TI chipset users, PDP v Cyber programmers, etc. From a Standard C Programming (as portable assembly) viewpoint Char and Byte are interchangable and are the smallest atomic type .. with the number of bits defined by a header constant. [1] https://www.iso.org/obp/ui/#iso:std:iso-iec:2382:ed-1:v1:en https://www.iso.org/obp/ui/#iso:std:iso-iec:2382:ed-1:v1:en
- LinAGKar 4y agoNo, a word is data size they work with as a unit. Modern 64-bit computers have 64-bit words, but they're still 8-bit addressable, so they have 8-bit bytes.