Live data from Hacker News

“Coding is basically just ifs and for loops.”

twitter.com

111–120 of 418 posts

Re: “Coding is basically just ifs and for loops.”

#111
post #14

That first reply is so funny to me because it hits too close to home https://twitter.com/nice_byte/status/1466940940229046273 The more I do this, the more I gravitate towards the simple things.

Funny, I posted this on another HN thread [0] recently, but it's perfectly relevant again: We shall not cease from exploration And the end of all our exploring Will be to arrive where we started And know the place for the first time. T. S. Eliot - Little Gidding [0] https://news.ycombinator.com/item?id=29043941

How then am I so different from the first men through this way?

Like them, I left a settled life, I threw it all away

To seek a Northwest Passage at the call of many men

To find there but the road back home again

Stan Rogers, "Northwest Passage"

Re: “Coding is basically just ifs and for loops.”

#112

Earlier quoted context omitted.

> you eventually "give up", and clock your 9–5 writing if+for making a fine living, but erroneously pass that off as a mature This comment sure indicates to me where you most likely are on the curve. In all seriousness, I think this is considerably off the mark. After enough experience you realize that expressivity and convenience are antipatterns and don't actually simplify things but are harbingers of complexity, b…

Personally I disagree. We should be using state machines and pure functions. If+for loops are just what's easiest to express in the major languages of today. they are no more or less computationally expensive but due to lack of tooling they are often cheaper to write. In languages and libraries that allow FSM and pure functional kernel based designs you can get just as clear logic that is expressible not just to the…

> Personally I disagree. We should be using state machines and pure functions. If+for loops are just what's easiest to express in the major languages of today. they are no more or less computationally expensive but due to lack of tooling they are often cheaper to write.

In my experience programming programming with primitives and basic flow control operations frequently tends to be at least be order of magnitude faster than more complex state management paradigms. Compilers are very good at optimizing that style of code. Loops often get unrolled, the and the branch predictor is kept happy. A good compiler may use vector expressions.

In many cases with cold code it flat out doesn't matter, the CPU is plenty fast, but when it does matter, explicit if-and-for code absolutely mops the floor with the alternatives.

Re: “Coding is basically just ifs and for loops.”

#113

And really, aren't loops just ifs and jumps under the hood? So coding is just ifs

https://youtu.be/otAcmD6XEEE?t=1965

Sequence, selection, iteration (or recursion if available).

Note that the child overlooked the assumption that it's sequential.

Re: “Coding is basically just ifs and for loops.”

#114

This is funny, but it's like saying "Math is basically pluses and minuses". I see coding as playing with hardware without having to use soldering iron.

Mathematics is "just" set theory and everything else, including arithmetic, can be built on top of that.

Honestly that's not a great example given that you can't understand ZFC until you already know enough set theory to understand the motivations for ZFC.

Re: “Coding is basically just ifs and for loops.”

#116
post #14

That first reply is so funny to me because it hits too close to home https://twitter.com/nice_byte/status/1466940940229046273 The more I do this, the more I gravitate towards the simple things.

The more experience you have, the more you see through the code to what is underneath.

"...there's way too much information to decode the Matrix. You get used to it, though. Your brain does the translating. I don't even see the code."

Re: “Coding is basically just ifs and for loops.”

#119

Earlier quoted context omitted.

Despite being a joke, I know it's the "Ha Ha Only Serious" [0] sort. I can't help but think this is severely biased by the trends of "enterprise software," where you eventually "give up", and clock your 9–5 writing if+for making a fine living, but erroneously pass that off as a mature, Jedi-like way of thinking about programming, like the meme suggests. (And, consequently, you spend no less time debugging hairy, nest…

>I have no beef with if+for, but a large part of the reason they're "goto tools", if you will, is because industry is slow to assimilate many state-of-the-art ideas, sometimes by as much as 40 years. For assimilation to happen, the state-of-the-art solution also has to result in a net gain over the existing solution, and the higher the differential in complexity between the two, the bigger that gain has to be.

Functionally, this looks like selling off your client base and closing the doors rather than rewriting internal tools that mostly still work.

There's no "rubber meets the road" in OPs position because there's no cost in their calculations.

Re: “Coding is basically just ifs and for loops.”

#120
post #88

Earlier quoted context omitted.

I'd never seen that meme before, but there's a Bruce Lee quote (maybe apocryphal) that has had a lot of meaning for me ever since I got over the same hump myself. “Before I learned the art, a punch was just a punch, and a kick, just a kick. After I learned the art, a punch was no longer a punch, a kick, no longer a kick. Now that I understand the art, a punch is just a punch and a kick is just a kick.”

makes me think of the Buddhist "Before enlightenment: chop wood, carry water. After enlightenment: chop wood, carry water". not my favorite source since it doesn't go into the 'scaling the mountain' bit, but every source that talks abt that part seems to be...eh: https://buddhism.stackexchange.com/questions/15921/what-is-t...

“Before enlightenment: if then. After enlightenment: if then.”
Post reply on HN