Live data from Hacker News

“Coding is basically just ifs and for loops.”

twitter.com

361–370 of 418 posts

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

#365
post #139

Earlier quoted context omitted.

New developers write simple but shortsighted code. It gets the job done, but it will be painful to work with in the future. Intermediate developers, bitten by their past mistakes, decide to future proof their work. But they don’t just look one or two steps ahead, rather they try to look five steps ahead and identity problems that do not and may never exist. Consequently, they over-engineer, over-abstract, and over-co…

Had a boss once who insisted that all if statements should be pushed out to factory classes, and all control logic should be done by constructing a different instance of an interface. It was a pretty rigid system, but at least it did force me to write small focused classes that were easy to test. Debated for a long time whether that methodology was stuck in the second phase or if it was actually the third. Still don'…

The key insight to "at least destroying your architecture makes it easy to unit test" is that being able to unit test is not actually that important. There's other kinds of testing out there!

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

#367

If you want to go even lower than that, coding is basically just saying yes or no in response to a yes or a no . Sure, that's oversimplifying it, but that's the smallest unit of information being changed during computation. But yes, once you learn the basics that are shared between most programming languages and don't get distracted by the nuances, it doesn't take that long to pick up a different language. Being prof…

All chemistry is just sharing electrons.

Or positrons.

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

#368

Earlier quoted context omitted.

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…

I inherited a piece of code that was designed as a state machine and the state machine design basically made the project become pure technical debt as requirements increased over time and engineers had to make it work with the state machine model that had been chosen when the project started. If the project had instead been designed to have less unnecessary state and “transitions” it would have been a lot easier to m…

State machines are refactorable if you use state charts. Using one giant FSM is like committing compiled code.

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

#369
post #266

Earlier quoted context omitted.

In going too basic. We can go to simple and elegant without going all the way back to crappy stone tools. http://bettermotherfuckingwebsite.com/ https://evenbettermotherfucking.website/

It’s interesting that on mobile the original one is actually nicest (to me).

right, the problem is that on wide displays we really aren't meant to read, say, 27 inch-wide columns of text.

The silly thing is that it's literally one CSS property, max-width, that takes care of that problem.

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

#370
I'm one one of a small number of people at my FANNG company that can work on a legacy MM LoC Perl project.

Many of them are much smarter than me, but I think my insight which I remember getting around 6 months in is that it's just code, in many places hard to read/follow, but it will ultimately just do a logical set of instructions.

Post reply on HN