10 ms·
Ask HN: Should a professional software dev know how many bits go in a byte?
Would you say that if you program computers for a living you should always know there are (usually) 8 bits in a byte? Or is it perfectly fine not to know that / can it be considered specialized knowledge if you only program high level software, e.g. front-end web or CRUD business applications?
- jb1991 4y agoAbsolutely they should know. This comes up so many times even in high-level programming that anyone who’s doing anything beyond very trivial student applications should know this stuff.
- jiveturkey 4y agoShould you even know what a byte is?
- ssdspoimdsjvv 4y agoAt that point you also won't know how text encoding works, or why integers only store numbers up to a certain limit, which are problems that you encounter in high level software as well.
- tjansen 4y agoWhile this is true, I know several productive software developers who probably have no idea how text encoding works or what's the limit of integers.
- jiveturkey 4y agoknowing the limit is not the same as knowing the WHY
- mjbeswick 4y agoAbsolutely they should, as without knowing what a byte is there is little chance someone would know how data is represented in computer systems.
- smcn 4y agoThis may be an outdated opinion based on the people I'm seeing leave bootcamps. I think that underlying architecture is so heavily abstracted these days that you do not need to really know _how_ a computer works in order to make something functional.
- yoz-y 4y agoYou can definitely make something functional without knowing how it works. But it will only work until it doesn't, then you won't be able to debug it. Coding javascript for example is removed enough from the internal working of the processor that a lot of details don't matter. But should you need to send a binary data packet somewhere through a websocket...
- smcn 4y agoDon't get me wrong, I agree. I just see a lot of people bypass the basics. I think that this kind of thing will become too low level for most developers and it'll become speciality knowledge. I'd say that most developers I've met have been content to sit and plug one package into another, without too much care about how they work.
- adrianN 4y agoOnce you encounter the problem of sending binary data somewhere, presumably you will look up how to do that and find out all you need to know about bits and bytes.
- mytailorisrich 4y ago> based on the people I'm seeing leave bootcamps Someone who has only attended a bootcamp cannot really be considered a 'professional software dev'...
- smcn 4y agoThese are people who have gotten jobs and are being paid for it. I only encountered the ones good enough to have passed interviews at companies.
- beardyw 4y agoModern JavaScript has byte representations like Uint8Array so I would say yes.
- seren 4y agoIt is important to understand how many MegaBytes/s are sent through 100 Megabits/s ethernet link for example. (or whatever communication link)
- praash 4y agoThis is the strongest point that comes to my mind. I feel that most consumers are completely unaware that their perception of transfer speeds and file size differ by almost an order of magnitude. I absolutely hate how marketing takes advantage of this. Imagine the frustration after thinking that your 10 Mbit/s connection can download a 6 GB game in just ten minutes. Many internet operators advertise speeds as "1Gb/s" or even "100M". Add in the confusion between 5G and 5 Ghz WiFi.
- pmontra 4y agoConsidering ACKs traffic when doing back of the envelope estimates I divide by 10: 100 Mb/s = 10 MB/s (on Ethernet, Wi-Fi who knows.) But that introduces a new problem: how many developers have an idea of how networking works? A smart developer I worked with once told me that he only knows how to turn Wi-Fi on and off.
- maxbaines 4y agoHmmm this is interesting, my background is industrial automation, where every day I would work with bits and bytes. But today and the last 10 or so years I have been building higher level software, machine data collection, web, db etc. I can honestly say not once have I had to deal with bits or bytes, I cannot think of an instance here I have needed the knowledge either. So I guess it’s not a requirement for software development today. But I still feel it’s important knowledge but can qualify why.
- netsharc 4y agoNo issues with UTF-8? I guess less of a big deal if you're just using English.
- superchroma 4y agoProbably not, it's something you can look up, and the 1000 vs 1024 naming distinction (e.g. kibi vs kilo) continues to be something that most developers I encounter aren't up to speed on. I use libraries with classes modelling such units in them if I need to do arithmetic with them, at the very least to offer security for others when they look at my code. I think what matters is that you're reasoning about things and being thorough and careful. Broadly, I haven't yet had someone give me a pop quiz at my job yet.
- shafyy 4y agoI don't think it's required to work as an average professional web dev. If you want to be a good developer and keep getting better, understanding the fundamentals of computer science is very important (and makes the job more interesting, in my mind).
- Vanit 4y agoYep. Even in a language like JavaScript it'll come up for handling binary data blobs/streams.
- vbezhenar 4y agoThis is basic knowledge. Of course one should know how many bits go in a byte. It's like asking if one should know how to replace a bulb. Not a software developer, every person should know that. It's like knowing that there're 1024 bytes in kibibyte or 1000 meters in kilometer. These days one should even know how exactly double is represented in hardware as it's the main type in JS and one should clearly understand bounds of integer numbers which could be represented in double without precision lost.
- hericium 4y agoI wouldn't call someone not knowing basics "a professional". And this is a basic knowledge not only for programming but networking, too. This theoretical person from the title does use internet and would like to know how many megabytes per second can be pushed through their n megabits link, no?
- dragonelite 4y agoOf course people should know some of the basics of hardware and software development. Not knowing the basics or the chain of steps a framework or a protocol takes means you might oversee optimisation or pain points in a certain workflow. But then again knowing how many bits go in a byte it's not needed to be productive in 99% of the cases. Then again when a professional software developer can't tell me how many bits go in a byte or cant at least explain to me how to read/use call stack/stack frame in a IDE or terminal etc. I really start to wonder how experienced and professional that developer really is.
- raxxorraxor 4y agoI guess you could develop in a high level language and don't know about it. But I guess at some point you would come in contact with that knowledge. It is quite useful knowledge though, at least in some applications. I do embedded systems where I use bit operations regularly. I also do visualizations in the browser with JS mostly and I cannot remember ever needing to know that a byte is 8 bit (usually). Thinking about it I don't know the exact size of the datatypes I often use either...
- Kim_Bruning 4y agoHow about 1 byte per channel for colors? (eg #FF00AA)
- retrac98 4y agoIt depends if it's going meaningfully affect their ability to develop software. In a lot of modern software engineering roles it won't.
- orangepanda 4y agoBytes/bits are themselves an abstraction. If you dont work with this representation directly, then this trivia can be added with others in the list of things you dont know.
- dusted 4y agoEmotionally, I want to say yes, they should know how many bits are in a byte, how many bytes are in a kilobyte (1000) and in a kibibyte (1024) and what big and little endianness is, and at least some part of the computing history that had led us to where we are now.. But rationally, I know that a lot of programmers don't care about computers, or even about programming and to them it's just a job.. And I guess I have no right to judge that..
- biztos 4y agoFor many of us a kilobyte will always be 1024 bytes despite the newfangled fashion for “kibi” this and “gibi” that. Fortunately the people who adhere to the “ibi” cult are usually sticklers for compliant capitalization, so when I see “kB” I know it Must Be One Of Them. Now get off my lawn, all 1000 of you!
- pmontra 4y agoI'm more in the 1024 camp because that's what I grew up with but K is kelvin degrees and k is kilo. I can forgive everybody living in a non metric country but not someone living in a metric one.
- wruza 4y agoAnd I don’t mind counting in 1000s or in 1024s depending on situation, but that -bi- just sounds so stupid. Kibi, mebi, gibi, tebi, pebi… bruh. Like childish mockery. Binary kilobyte could be fine.
- thrill 4y agoNope, it's kilobyte. The "other one" is disk-manufacturer-marketing-speak-kilobyte.
- dusted 4y agoYes, you're exactly right, in the same way as kilometer is 1024 meters and the other one is just car-manufacturer-distance-per-fuel-unit-marketing-speak-kilometer.. Kilo means 1000, and meant it before computers were a thing.. We retrofitted 1024 onto it literally hundreds of years later.. because it was close enough, it got annoying to deal with, we fixed it, if only recently in 2008, but better late than never..
- iib 4y agoThe highest respect goes to the person answering `CHAR_BIT`, of course.
- mettamage 4y agoThe problem with purely learning things on a need to know basis is that every debug task that goes outside of the programming knowledge of the dev becomes an incredible scavenger hunt.
- joe-collins 4y agoEven if someone doesn't need to work at a sufficiently low level as to need that information regularly, not knowing that suggests a severe lack of fundamentals and hints at trouble on the horizon. Someone could play at chemist and work with raw materials and follow recipes without knowing about electron orbitals, but without that understanding they may make disastrous choices if given insufficient oversight and their capacity for problem solving is limited.
- popcorncowboy 4y ago> not knowing that suggests a severe lack of fundamentals and hints at trouble on the horizon Exactly this. Strictly speaking you really don't need to know how many bits are in a byte, but it'd be difficult not to have picked up this kind of information having spent any time in the field. The absence of this knowledge is a strong indicator of shallow expertise.
- schwartzworld 4y agoI knew the answer, but that's because I learned it as a kid. I've never seen bits or bytes mentioned in resources for learning high level languages, nor has the topic ever come up in a professional setting. For a professional dev in a high level language, this basically is a useless piece of trivia. It doesn't hint at trouble, because my code runs on machines that measure memory in gigabytes or at least hundreds of megabytes. Gatekeeping.
- wink 4y agoI'm sorry to disappoint you, but the so called high level languages like Python or Java are perfectly capable of working with bits and bytes, and countless developers have done so. The gatekeeping card won't fly here. This is not some obscure implementation detail of C/C++.
- schwartzworld 4y agoI know they can work with bits and bytes, but your average web dev often doesn't get into that kind of stuff. I don't need the bitshift operator to put a button on a webpage or expose an endpoint.
- xupybd 4y agoI would say so. But I'm trying to think if I've ever had to use that? I don't think so.
- AlphaGeekZulu 4y agoYes, probably any software developer should know the trivial fact, that a byte consists of 8 bits (nowadays) - even if the developer is not involved with bit operations. Much more important, in my eyes, and more sophisticated, is the concept of the computer "word": a professional software dev should know how many bytes go in a word, how word length corresponds with bus width, memory organisation and how types depend on word length. And in my humble opinion, Unicode encoding is such a basic concept, that every dev should understand it on a bit level.
- artemonster 4y agoThe infestation of the workforce by the bootcamped parrots that puke out memoized nonsense and call themselves a professional programmer is going to further degrade the quality of code everywhere
- basilgohar 4y agoI didn't appreciate this comment at all. I have worked with folks from non-computer science backgrounds that only picked-up programming from a bootcamp and they were fine programmers for their level. I would gladly have them on my team over others that bring with them a bad attitude or cannot work well with others. There's more to a successful team than top-quality code on the first try. Very few people can do that, even among experienced developers. Bad code is due, in large part (in my experience) due to a lack of any kind of technical leadership. Put a competent tech lead or manager (i.e., one that can code/was a senior dev before) over even mediocre developers and you come come-up with decent code. Surely there are folks better than others, but bootcamp graduates aren't all bad and not the only source of bad programmers. It's more about attitude and willingness to learn than out-the-door abilities, in my opinion, as I stated elsewhere in the comments.
- tpxl 4y agoThey need not know by heart, but they should be able to find out if necessary. Reminder that 8 bit bytes were standardized in 1993 (ISO/IEC 2382-1:1993 according to Wiki), and before that it was common to have bytes be 6, 8 or 9 bits.
- defrost 4y agoIncorrect. From (the latest version of the standard you gave) > byte > string that consists of a number of bits, treated as a unit, and usually representing a character or a part of a character > Note 1 to entry: The number of bits in a byte is fixed for a given data processing system. > Note 2 to entry: The number of bits in a byte is usually 8. Note Carefully: "usually" ie. Just as it has always been - 16bits in a byte for any CPU with a smallest addresable unit being 16 bits, or 32, or 12, or 24. As a C programmer I've worked with bytes of many different bit numbers, hence the need for a C compiler constant to define such things. Today it is typical for 32 and 64 bit DSP processing chips (eg the TI DSP families) to have 32 | 64 bits per byte.
- WithinReason 4y agoOn GPUs the smallest addressable unit is a DWORD (32 bits) but no one calls them a byte.
- defrost 4y agoAny C | C++ compiler targeting that GPU will call that 32bit blob a CHAR and will have the constant CHAR_BIT sety to 32 in (c)limits.h Within the low level standard C programming commmunity the terms Byte and Char are interchangable and vary by architecture or domain (8 bits in a networking application domain, potentially more bits on various target architectures).
- WithinReason 4y agoIn OpenCL C a char refers to 8 bits: https://registry.khronos.org/OpenCL/specs/2.2/html/OpenCL_C.html#restrictions https://registry.khronos.org/OpenCL/specs/2.2/html/OpenCL_C....
- brunooliv 4y agoI think any person remotely interested in computers or programming can and should "know" that a byte is 8 bits. But... does it matter? Unless you are working with hardware or in embedded systems more directly, it ABSOLUTELY does not matter at all. What matters is to have a critical eye for numbers when they matter and/or are "off". That is much more valuable for the day-to-day work. "Damn, before we could easily hit this endpoint X times per second and after that refactor and library change it's down to X/5? We need to have a look". Sizes of DB tables, latency of endpoints and being able to properly read stacktraces or logs from a third-party service is much more valuable. PS: people writing in the comments about not knowing how text encoding works, about sending data trough sockets, etc... Folks, you know how to do these things because they are required from you at your day job, you probably had exposure to proper patterns and got help from experienced people within that particular niche at your company. That's all. Knowing 1 byte is 8 bits is absolutely meaningless knowledge on its own. I needed to know these "standard sizes" for my CS degreee,sure. Do they matter for my day-to-day work? Not in the slightest.
- Kim_Bruning 4y agoDo you ever inexplicably encounter the number 255 (or 256)?
- brunooliv 4y agoAt my day job? Never happened. Interviewing? Sure. Those LeetCode algorithmic problems have a tendency to sometimes touch upon these well-established values of the underlying architecture of bytes/bits and how memory pages are structured, etc. The thing is: Working with Java and Python in your classical corporate job maintaining a DB schema, creating and/or optimizing endpoints with Flask and/or Springboot, most of these underlying concepts will be shielded from you entirely. Again, in Java, you can specify the load factor for a HashMap when you create it... I bet you 99% of the developers working with Java have never needed to do it or might not even know what it is or how it works under the hood. Maybe they don't even know that internally the hashtable size is managed in powers of two... but again, I don't truly believe this matters for 99% of the work you'll be doing. It's either something that you need to use or fully understand, or something that will always be abstracted away from you. 8 or 2^8 or 2^8-1 are just numbers basically.... It's good to know a bit their intrinsic meaning or why they are relevant just as a general knowledge, but, unless you are doing C programming at a very low level, embedded systems, microcontrollers, etc, this is just knowledge that will _never_ be used.
- joshka 4y agoYes, regardless of how much these are abstracted in modern software development. Size is an important aspect of many things in a computer. It impacts: - storage capacity - speed of communication - speed of computation - representation of numeric values - encoding of strings Bits and Bytes are the fundamental units of size and representation, and knowing them is critical to understanding most other things that build on top of them. For high level software, you see this come up in: - integer limitations (e.g. database identifiers) - internationalization of user interfaces - floating point numeric comparison and other mathematical operations - communications over various transport layers - speed of various abstractions that are used to make the higher level software fast / good
- aoshifo 4y agoI was about to say "no", until I realized just how much I internalized this knowledge. In front-end you may be able to write decent applications without knowing that, but for CRUD apps it would say it is impossible to avoid. I mean, it's something you will inevitably stumble upon. I'd say that even if you actively try to avoid learning how many bits go in a byte you will one day wake up screaming "Fuuuuuuck, I never wanted to know that there are 8 bits in a byte!!!!!" There, now you know, too!
- alkonaut 4y agoYes. This comes up even in the highest level and most trivial work. And not just “should be able to look it up”, but should know it in their sleep. Should also know other esoterica like e.g how a string could be zero terminated in one case but length prefixed in others, Joe they could be one, two, four, or variable numbers of bytes per character/glyph in a string and so on. Not because one needs this every day but a) because doing work adjacent to it means you eventually shoot yourself in the foot and b) doing any amount of work will expose you to this and not having picked up on it means you aren’t picking up things.
- Kim_Bruning 4y agoThere's a surprising number of programmers who can't count in binary, or who can't do bitwise operations , or ... any number of things. It's surprising how far some people can get with their hands tied behind their backs. I wouldn't recommend it of course. Also it might possibly be a kind of warning flag: how can someone constantly be exposed to this stuff and never pick it up? But somehow it does sometimes happen! (see also eg. : https://news.ycombinator.com/item?id=32216904 https://news.ycombinator.com/item?id=32216904 Experienced C programmer who can't fizzbuzz?) [ For folks wondering why I'm talking about counting: Bits and bytes is all about learning to count with just 1 finger: 1, 10, 11, 100, 101, 110, 111, 1000, ... And the largest number you can count up to in a byte is 1111 1111 of course (A byte has 8 Binary digITs, and the highest number you can count to in a byte is having all those digits be 1s. In decimal this is the number 255. If you use a computer a lot, you might have run into 255 more often ). ]
- oxff 4y agoIf you can't do napkin math with bits and bytes to calculate capacities, bandwidths, flows etc. you are lacking one of the most essential skills there are, and need to pick up the slack ASAP.
- basilgohar 4y agoWhat I have observed, as more and more people from a wider background enter into computer science and software engineering, is that it's not so much what they know or don't know that matters, but rather, what is their attitude towards learning something they don't already know. If they embrace new knowledge and appreciate those who bring it to them, then I couldn't think of someone better for this art. If, on the other hand, they dismiss anything that they don't immediately see the value to, even at the behest of someone either more senior or experienced, then I would say, that is the red flag.
- StupidOne 4y agoWhen you are working as backend developer and your clients are mobile devices, is your message 8 times smaller or bigger is difference between up-and-running and outage.
- postcynical 4y agoBased on my 25years experience with that line of work, this knowledge is not required at all and won't make you write better code. Some coworkers will question your competence, which is a disadvantage. Hiring wise, if you've spent a few years programming without ever learning about "that bits&bytes thing", an employer is tempted to doubt your education, level of curiosity and/or general interest in your field.
- ragebol 4y agoI think it's hard not to know this, but outside of embedded I don't think I ever needed that knowledge. So as always: it depends. A front-end dev: nope, don't think so. Embedded software dev: you don't become one without knowing.
- exyi 4y agoPeople say you should know something about the lower-level programming and they are right IMHO. Even as computer user: Internet speeds are regularly given as megabits per seconds. How do you estimate how long will a 5GB file upload without knowing it's 8b/B ?
- lupinglade 4y agoDo you really have to ask?
- anotherhue 4y agoUneducated people do not determine whether basic knowledge should be classified as 'specialised'. If they've learned enough to market themselves as a software person, then they should have learned about bytes.
- MrDresden 4y agoYes. Knowing that 8 bits make up a byte is basic knowledge akin to knowing H2O is the chemical make up of water. I would internally question the knowledge of someone claiming to be a professional in this field if they didn't know this fact. Though that doesn't mean they couldn't be proficient and able to do their job.
- wruza 4y agoThat’s a strange question. If by professional you mean by trade, then yes, many programmers don’t work with bits or type limits directly and could do fine without that knowledge. If by some sort of baseline certification (school, degree, etc) it’s hard to imagine that it’s not in an educational program, e.g. UTF-8 hints at it directly it the name. Can a programmer read a text file without knowing about UTF-8, at least as an enum-like parameter? Or know floating-point limitations, which every programmer should know, and not notice that float32 is 4 bytes wide? Or choose #rrggbb color never realizing that each 00..FF part stands for 2 hex / 8 bits? I think in reality it’s either a sign of a very narrow specialization, very low experience or just a complete lack of awareness. It’s like going through a forest for months and never noticing a fallen tree.
- MattPalmer1086 4y agoWhat a surprising question! To me, knowing how computers work is just something I thought every programmer would just know as fundamental knowledge (note bytes don't always have 8 bits, but it's the most common). I guess there is not an absolute need to know this if it doesn't affect business logic type programming or UIs, although I think I might think a person was not very well educated or curious if they didn't know that.
- WelcomeShorty 4y agoShould a programmer also know about FS block sizes? About ethernet size? About Multithreading? Memory access bandwidth? CPU architecture? Stored procedures in a DB? Current encryption schemes? I would say it depends totally on the tasks of the coder. If you fiddle around with some ASP: NO. If you are squeezing every last bit for Netflix performance: YES. Our domain is so incredibly huge, deep, wide & divers that I do not expect regular coders to be familiar with most details.
- orwin 4y agoIdeally yes? The only thing i'm not opiniated on is block size because while this is interesting, this isn't usefull for debugging or optimizing. All the rest any dev should have an idea of what it is and seek further knowledge when needed. Even if he is a frontend dev.
- drewcoo 4y agoTo all of the people who think devs should know this: Should devs also know economics and philosophy and English literature?
- beej71 4y agoThose seem out of scope in a way that the number of bits in a byte isn't...?
- jacknews 4y agoIt's almost like a journalist or novelist not knowing there are 26 letters in the alphabet. Sure you might not actually need to know it to do your job, at least most of the time. But sometimes you will, and honestly it's a bit ridiculous not to know it.
- jareklupinski 4y agoYes, so that you can make people chuckle when you tell them 4 bits is a 'nibble'
- throwaway2016a 4y agoMy first tech question I got asked at an interview 20 years ago was: > Is this number positive or negative? > 0101 0101 They expected me to ask about things like endianness and to know the least significant bit is the only one we are about to answer that question. While bits in a byte "is" a "low level" topic. It is one of the more useful ones even for CRUD. My instinct is that "yes"... basic knowledge like this is important. After all, even as an API developer I have often had to know things like how many bytes an int is on my machine, how bitwise operators work, whether the system is little endian or big endian, etc. Also, how do you understand Unicode (something very important for i18n) if you don't know the answer to this question? But then I had to go back and second guess myself. Most of this stuff is abstracted out now. I would say it comes down to what type of data you are dealing with. If you're dealing with files in binary formats, compilers, etc. Then yes, you need that stuff. And yes, a simple CRUD app does sometimes need to deal with that stuff. But if not? I guess it's fine not to know.
- packetlost 4y agoI would argue the subset of software engineering that does not require this type of knowledge is a far, far smaller portion than that does. Maybe if you're only dealing with the simplest of CRUD + web stuff. Looking back on my own career, which started in corpo CRUD hell, it was still relevant knowledge a number of times.
- TheCoelacanth 4y agoThat's like if a professional writer didn't know how many letters are in the alphabet. It has no bearing on actually doing the job, but how on earth did you manage to learn the necessary skills without learning that?
- AnimalMuppet 4y agoIt rarely has bearing on actually doing the job. But all abstractions leak. Once in a while, the number of bits in a byte leak out.
- forinti 4y agoI find it hard to believe someone who codes doesn't know this. Bits, bytes, words, doubles, floats, ints... This information is everywhere. Every coding book starts with this.
- beej71 4y ago20 years ago? Definitely. Today things are a little different. So much abstraction makes it possible to plug programs together without knowing such things. If I were hiring a generalist hacker type, they'd better know the answer. I expect a generalist to be able to do all kinds of tasks. But a specialist on something high level might get a pass.
- farseer 4y agoUnless you only write excel formulas or strictly do GUI development, I think you should know this. It is also a great phone screening question.
- zerof1l 4y agoMy answer to the question of whether should X know Y is yes if this is what you do on daily basis. If this is relevant but needed only occasionally, then just having a vague awareness of it existing and being able to find exact information when needed is enough. In my opinion, a professional is not somebody who knows absolutely everything there is to know in the field, but someone who firstly has a lot of hands-on experience and somebody who can quickly fill in the gaps in the knowledge when necessary. A "professional software dev" is a very broad category. In most of web development, you can get away just fine without knowing how many bits are in a byte. On the other hand, in Arduino you'd encounter bits and bytes on a regular basis. As for me, if somebody was to ask me this question during an interview, I would assume that it's a trick question. There were some old exotic architectures in the past such as IBM that stored data in 6bits.
- blikdak 4y agoYes. Try adding 1 to a number which is already (in binary) all '1's. If you don't know the size of a byte, or an 'int' or a 'long int' etc for the language you are using you will be mystified why it is now 0, or maybe some other number your language decided was sensible to use (signed vs. unsigned etc). Then extrapolate that times 100 when dealing with floating point etc and presenting a sensible total in your shopping cart web app. If you don't know this stuff learn it or stay away from programming.
- irvingprime 4y agoFunctionally, you don't usually need to know this kind of thing. But it's something that is taught in CS 101, pretty close to day 1. Yes, you should know stuff that basic! A better fit for your question would be, should a dev know the difference between big endian and little endian? (Hint: Yes)