News for hackers. Stuff that matters.
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