Live data from Hacker News

Code is run more than read

olano.dev

81–90 of 325 posts

Re: Code is run more than read

#81
post #73

Earlier quoted context omitted.

Maybe you will find the proof that the infinite series 0.9999... exactly equals 1 interesting: https://en.wikipedia.org/wiki/0.999 ...

Wow, can't believe I've never realised this. How counterintuitive. The 1/3 * 3 argument, I found the most intuitive.

I like the argument that observes "if you subtract 0.99(9) from 1, you get a number in which every decimal place is zero".

The geometric series proof is less fun but more straightforward.

As a fun side note, the geometric series proof will also tell you that the sum of every nonnegative power of 2 works out to -1, and this is in fact how we represent -1 in computers.

Re: Code is run more than read

#82
post #73

Earlier quoted context omitted.

Maybe you will find the proof that the infinite series 0.9999... exactly equals 1 interesting: https://en.wikipedia.org/wiki/0.999 ...

Wow, can't believe I've never realised this. How counterintuitive. The 1/3 * 3 argument, I found the most intuitive.

Another intuition:

All the decimals that recur are fractions with a denominator of 9.

E.g. 0.1111.... is 1/9

0.7777.... is 7/9

It therefore stands to reason that 0.99999.... is 9/9, which is 1

Re: Code is run more than read

#83
post #8

For many of us, running our code 1 billion times will cost less than a few minutes of a developer's time. Hell, I could spend $200 for a month of server time on AWS and run a lot of my (web API) code 100 billion times. Optimizing for human readers is always better until you're working on something that proves itself to be too slow to be economical anymore.

Also, for my compiled code (in Go), the code that I write is not the code that the compiler generates. I can write simple code that's easy for {{me in 3 months}} to read and let the compiler do the fancy stuff to make it fast.

Re: Code is run more than read

#84
post #8

For many of us, running our code 1 billion times will cost less than a few minutes of a developer's time. Hell, I could spend $200 for a month of server time on AWS and run a lot of my (web API) code 100 billion times. Optimizing for human readers is always better until you're working on something that proves itself to be too slow to be economical anymore.

From the article:

> When I say “run” I don’t just mean executing a program; I mean operating it in production, with all that it entails: deploying, upgrading, observing, auditing, monitoring, fixing, decommissioning, etc

Re: Code is run more than read

#85

Hey, author, if you end up reading this thread: put the conclusion on a sticker. I'll put one on my laptop and give a bunch to friends. For anyone that didn't make it to the end, the conclusion was: user > ops > dev biz > ops > dev biz ≹ user

In the long run user > biz, otherwise users will be using a product of a different biz via the enshittification cycle.

Assuming a non-shit business, you could think of "biz" as "customers integrated over the long term". Therefore putting "users" and "biz" as incomparable could be interpreted as prioritising users, sustainably.

At least that's how I interpret it.

Re: Code is run more than read

#86
post #73

Earlier quoted context omitted.

Wow, can't believe I've never realised this. How counterintuitive. The 1/3 * 3 argument, I found the most intuitive.

I like the argument that observes "if you subtract 0.99(9) from 1, you get a number in which every decimal place is zero". The geometric series proof is less fun but more straightforward. As a fun side note, the geometric series proof will also tell you that the sum of every nonnegative power of 2 works out to -1, and this is in fact how we represent -1 in computers.

How can the sum of a bunch of positive powers powers of 2 be a negative number?

Isn't the sum of any infinite series of positive numbers infinity?

Re: Code is run more than read

#87
I think the corollary to the title (to turn it around on the author) is not 'Code is read more than written' but 'code that can't be read won't run for long'. Disclaimer: Experienced sysadmin trying to make a lateral move to development and as such a complete noob.

Re: Code is run more than read

#88
post #33

TIL of ≹, which "articulates a relationship where neither of the two compared entities is greater or lesser than the other, yet they aren't necessarily equal either. This nuanced distinction is essential in areas where there are different ways to compare entities that aren't strictly numerical." ( https://www.mathematics-monster.com/symbols/Neither-Greater-... )

Likewise, TIL. In your link however it states "Example 1: Numerical Context Let's consider two real numbers, a and b. If a is neither greater than nor less than b, but they aren't explicitly equal, the relationship is ≹" How can that be possible?

It is false - real numbers fulfill the trichotomy property, which is precisely the lack of such a relationship: every two real number is either less than, equal or greater than.

But the numerical context can still be correct: (edit: ~~imaginary~~) complex numbers for example don’t have such a property.

Re: Code is run more than read

#89
post #77
post #73

Earlier quoted context omitted.

Wow, can't believe I've never realised this. How counterintuitive. The 1/3 * 3 argument, I found the most intuitive.

It's a flawed psychological argument though, because it hinges on accepting that 0.333...=1/3, for which the proof is the same as for 0.999...=1. People have less of a problem with 1/3 so they gloss over this - for some reason, nobody ever says "but there is always a ...3 missing to 1/3" or something.

The problem is that there are two different ways to write the same number in infinite decimals notation. (0.999... and 1.000...).

Thats what's counter intuitive to people, it's not an issue with 1/3. That has just one way to write it as decimals, 0.333...

Re: Code is run more than read

#90

Earlier quoted context omitted.

for the Reals, it is only hypothetical, the domain has a total order. \inf and $\inf + 1$ comes to mind but I don't think it really counts

> \inf and $\inf + 1$ comes to mind but I don't think it really counts That just depends on the numeric structure you're working with. In the extended reals, +inf is equal to +inf + 1. In a structure with more infinite values than that, it would generally be less. But they wouldn't be incomparable; nothing says "comparable values" quite like the pair "x" and "x + 1".

I guess it depends on the exact definitions, but reals usually doesn’t include the infinities. At my uni we introduced infinities precisely as an extension of the reals with two values defined by `lim`.
Post reply on HN