News for hackers. Stuff that matters.
Re:Why do arrays start at 0? by just_boost_it on Wednesday August 24, 2022 @04:32PM (#32585351)
We're 20 years past the point where you can expect everyone in tech to trace every instruction down to machine instructions. Higher level languages abstract away the need for it, and for the most part, we can rely on the authors of those languages to make many of the decisions that impact performance. The rest of us learn about these details on posts like this. It's not a sad fact, in fact it's probably one of the most useful things that's happened in tech. It frees people to think about other problems.
Re:Why do arrays start at 0? by TillE on Wednesday August 24, 2022 @05:01PM (#32585692)
I barely touch assembly in my day to day work, but I do understand on a fairly deep level how a computer works, which I feel is extremely important and very frequently influences how I write high-level code.

Certainly one can bang out code their entire career without ever having a clue how machine code works, but I really wouldn't advise it. At worst it leads to total ignorance, and at best you accumulate a disconnected set of "best practices" as inscrutable lore handed down from on high.

Re:Why do arrays start at 0? by iopq on Thursday August 25, 2022 @02:16AM (#32590209)
When I did web dev it was more important to know how the WEB BROWSER works, not how machine code works

it's not useful to know how the browser allocates memory or garbage collects it, it's more useful to know that it has web sockets. Don't get the idea that things you know are relevant to other people.

Re:Why do arrays start at 0? by Aeolun on Wednesday August 24, 2022 @08:57PM (#32587975)
You go as deep as you need to. My day job involves writing tons of Javascript and there is zero need for me to dive into the underlying processes until something goes wrong. So far the lowest I’ve ever needed to go was the node source.
Re:Why do arrays start at 0? by ZephyrBlu on Wednesday August 24, 2022 @07:57PM (#32587518)
What do you consider "high-level code" and in what way does deeply understanding how a computer works influence your approach?
Re:Why do arrays start at 0? by iopq on Thursday August 25, 2022 @02:18AM (#32590222)
In college, I optimized the array removal routine from O(N^2) to O(N) by using INVARIANTS

But it probably ran in like 100us anyway

Re:Why do arrays start at 0? by aspyct on Thursday August 25, 2022 @03:24AM (#32590672)
Ugh, invariants...

Anyway, complexity stays relevant, no matter what language you use. That's the real deal.

Re:Why do arrays start at 0? by iopq on Friday August 26, 2022 @05:17AM (#32604967)
It only stays relevant if the JavaScript is too slow. In the case of removing two elements from an array of length 8, it's not too slow to remove them one by one since, again, it runs in microseconds
Re:Why do arrays start at 0? by ryanbrunner on Wednesday August 24, 2022 @05:26PM (#32585992)
If you're not raining about how your code translates to logic gates, you're not a competent programmer. /s

Abstractions are good, and while we should be careful not to completely trust a brand new abstraction, high level languages are established enough that we don't need to worry about it.

Re:Why do arrays start at 0? by ivanhoe on Wednesday August 24, 2022 @05:51PM (#32586251)
20 years ago ASM was just as cryptical black magic to most of programers as it is today... try perhaps 40 y/a...
Re:Why do arrays start at 0? by metafunctor on Wednesday August 24, 2022 @04:55PM (#32585622)
Not sure if you were around 20 years ago, but you sure couldn't expect everyone in tech to understand machine instructions as well as the layers above, all the way up to corporate politics.

But some people, yeah, they could do it.

That has not changed.