Live data from Hacker News

Code is run more than read

olano.dev

91–100 of 325 posts

Re: Code is run more than read

#91
post #86

Earlier quoted context omitted.

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?

\1 is a good question that deserves an answer.

\2 is "not always" ..

Consider SumOf 1 + 1/2 + 1/4 + 1/8 + 1/16 + 1/32 ...

an infinite sequence of continuously decreasing numbers, the more you add the smaller the quantity added becomes.

It appears to approach but never reach some finite limit.

Unless, of course, by "Number" you mean "whole integer" | counting number, etc.

It's important to nail down those definitions.

Re: Code is run more than read

#92
post #23

"biz > user" is valid on paper because someone has to pay for the party; there are a finite number of software devs and capitalism is great at allocating scarce resources where they're most needed. Or at least the "spherical cows" version of free-market capitalism is great at that. In that version of capitalism, if your OS spends too much time putting spam in the Start Menu and not enough on fixing bugs, you can just…

Just because this doesn’t happen instantaneously doesn’t mean it’s a fantasy. Large changes in an ecosystem always take time. It may be years before the incumbents are truly displaced, but that doesn’t mean they won’t be. MySpace and RIM also seemed like they’d be there forever.

Re: Code is run more than read

#93
post #86

Earlier quoted context omitted.

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?

The infinite sum of powers of 2 indeed diverges in the real numbers. However, in the 2-adic numbers, it does actually equal -1.

https://en.wikipedia.org/wiki/P-adic_number

Re: Code is run more than read

#94
post #86

Earlier quoted context omitted.

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?

https://youtu.be/krtf-v19TJg?si=Tpa3EW88Z__wfOQy&t=75

You can 'represent' the process of summing an infinite number of positive powers of x as a formula. That formula corresponds 1:1 to the process only for -1 < x < 1. However, when you plug 2 into that formula you essentially jump past the discontinuity at x = 1 and land on a finite value of -1. This 'makes sense' and is useful in certain applications.

Re: Code is run more than read

#96
post #11

Because we as programmers need to know how to progam: learning trumps all. Thus: learning > biz > user > ops > maintainer > author There was that bit dev > * meaning resume-driven development, but in reality it is learning > * And that's the conflict programmers experience in corporate structures, for example the hassle programmers experience when they interview for a position. Employers know it too but they try to s…

This is why blindly turning folks loose with AI is scary. They don't know what they don't know.

... and the "learning" is left to the AI

Re: Code is run more than read

#98
post #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

So op use this point turn back to support the opinion that readability is more important.

the inference process in article is interesting, but title tempt us to debate about a less related topic.

thanks for your comments let me finish reading.

Re: Code is run more than read

#99
Quality article – for years of developing software, I have the bingo – heard and got used to every smell as long as there was air to breathe.

I'm always in the end of this chain, doing the dirty work :)

Re: Code is run more than read

#100
Also cars are driven more than repaired. Highways are used more than they need to be maintained. Yet if you don't include some thought to how to deal with a situation where something breaks, this could (and very likely: will) eventually come back to haunt you.

But code is not the same as your car. If money is not an issue and your car breaks you could just get another one that drives equally well. Try doing that if your code breaks.

So whether values like readability, maintainability etc. can be important for good code is out of the question — what remains an open question is (on a per file basis) how to priorize between those two if such a need arises.

And that isn't a small "if": One should guard themselves against the simple thought that these are inevitable tradeoffs that are mutually exclusive. You can easily make code that is both unreadable and doesn't run well. You can also make extremely readable code that runs nearly perfectly. The latter is of course harder than writing the same code to just run well, but if you are not coding alone or your project is beyond a certain scale it might be well worth the extra thought.

The solution space for "clear structure" and "good performance" is smaller than for either of those alone, so finding a good solution here is a bigger challenge, but depending on what you plan to do it could be worth a try.

Post reply on HN