Live data from Hacker News

“Coding is basically just ifs and for loops.”

twitter.com

261–270 of 418 posts

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

#261

"First a punch is just a punch, Then a punch is not only a punch, And finally a punch is just a punch" (heard from Bruce Lee) Basically it means that in the beginning we punch like we can.. then a martial arts student learns the proper and different ways to punch.. so a punch is no longer just a punch... Is a lot of instructions.. Then to sheer practice and repetition the right way to punch becomes second nature.. so…

Become water my friend - don't stick to just one way.

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

#262

"First a punch is just a punch, Then a punch is not only a punch, And finally a punch is just a punch" (heard from Bruce Lee) Basically it means that in the beginning we punch like we can.. then a martial arts student learns the proper and different ways to punch.. so a punch is no longer just a punch... Is a lot of instructions.. Then to sheer practice and repetition the right way to punch becomes second nature.. so…

Before one studies Zen, mountains are mountains and waters are waters; after a first glimpse into the truth of Zen, mountains are no longer mountains and waters are no longer waters; after enlightenment, mountains are once again mountains and waters once again waters.

Translation from http://www.livinglifefully.com/zensayings2.htm

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

#263

"First a punch is just a punch, Then a punch is not only a punch, And finally a punch is just a punch" (heard from Bruce Lee) Basically it means that in the beginning we punch like we can.. then a martial arts student learns the proper and different ways to punch.. so a punch is no longer just a punch... Is a lot of instructions.. Then to sheer practice and repetition the right way to punch becomes second nature.. so…

That’s what disappoints me in modern Java. There is practically no ifs. It makes it inaccessible to beginners on the project, and the streams are about twice as slow… just because devs think they are more clever if they pile 7 “.map()” to transform a list. list.stream().filter(Objects::nonNull).map(User::getUsername).filter(Objects::nonNull).filter(name -> name.contains(searchString)).map(name -> “We have found your…

You forgot to add null-check ifs for `list` and `searchString`. Oh and check-wrap for exceptions too!

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

#264

Thats why i am seeing DB schemas without indexes lately. End of the day people with this kinda thinking make others to fix the broken code that they left behind. As a senior software engineer i had to spend a lot of time at night fixing code written by junior devs and interns. the code that company and devs (just ifs and loops gang) proud of was a pain in the ass for me so i quit the job entirly and do freelancing th…

I think there's a general lesson to be learned here, which is that you should be wary of any colleague within any branch of IT that honestly claims the things you're working on are "simple". I'll take an insecure colleague that wants to do a good job over a confident colleague that refuses to listen any day.

Writing code that works is simple. Writing code that doesn't break is not simple.

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

#265

Earlier quoted context omitted.

And that's also why a lot of Architecture Astronaut that looooved Java, didn't see Python coming.

Funny, I took over a modern python service and I was pretty shocked at what I inherited. Long gone are the days of "There's one way to do things". Instead, this thing would give the most "enterprisey" Spring JEE application a run for its money with its endless annotations, dependency injection magic, all sorts of pseudo-types - both the "built-in" Python 3 ones like Set and List, but also the libraries like Pydantic.…

Long gone are the days when Python was a hacker tool. It’s been an enterprise thing since startups got wind of the fact that it could be used to attract programmers, to attract VCs.

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

#266

Earlier quoted context omitted.

Recently posted this, which wasn’t well received. https://motherfuckingwebsite.com/ Where does this fall?

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).

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

#267

I also like "all web development is basically fancy string concatenation", and as a web dev I feel seen.

George Hotz said something once that most modern developer jobs are depressing because you're not doing any actual programming. I.e. you're not given a problem to solve with code, you're just taping together frameworks and pieces of code that someone else wrote to order. It's a bit like studying to be a chef for five years and then having to put together one of five types of burgers.

Like everything Hotz says it's spiced up of course, but there's a kernel of truth to it.

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

#268
post #262

"First a punch is just a punch, Then a punch is not only a punch, And finally a punch is just a punch" (heard from Bruce Lee) Basically it means that in the beginning we punch like we can.. then a martial arts student learns the proper and different ways to punch.. so a punch is no longer just a punch... Is a lot of instructions.. Then to sheer practice and repetition the right way to punch becomes second nature.. so…

Before one studies Zen, mountains are mountains and waters are waters; after a first glimpse into the truth of Zen, mountains are no longer mountains and waters are no longer waters; after enlightenment, mountains are once again mountains and waters once again waters. Translation from http://www.livinglifefully.com/zensayings2.htm

"Before enlightenment: Ifs and loops. After enlightenment: Ifs and loops."

:)

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

#269
post #260

Earlier quoted context omitted.

What version of Basic were you using that lacked FOR? Even the shitty one crammed into my Sinclair ZX80 had FOR.

Oh, I can't say that it didn't. But I was only 7, and more amused by things like 10 PRINT "POOP" 20 GOTO 10 than, what, reading a non-existant manual? My parents weren't programmers, so I learned by stumbling in the dark. But, you've got me curious. I recall using BASICA, GWBASIC and QBASIC -- reading over their respective histories, I'd have gotten my start on BASICA on a hand-me-down 286. I'm not finding good docs…

More visually pleasing, and several keystrokes shorter, for rapid input on an unattended store demo machine:

10 print "poop ";:run

FWIW, the very first version of BASIC in 1964 supported FOR (https://en.wikipedia.org/wiki/Dartmouth_BASIC#First_Edition). I never used DOS machines but https://gunkies.org/wiki/Microsoft_BASIC claims that BASICA was based on Microsoft's BASIC, and that definitely had FOR.

Young you must have arrived at the concept of a for loop without knowing there was a keyword in the language designed to support that, which is pretty cool!

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

#270

"First a punch is just a punch, Then a punch is not only a punch, And finally a punch is just a punch" (heard from Bruce Lee) Basically it means that in the beginning we punch like we can.. then a martial arts student learns the proper and different ways to punch.. so a punch is no longer just a punch... Is a lot of instructions.. Then to sheer practice and repetition the right way to punch becomes second nature.. so…

That’s what disappoints me in modern Java. There is practically no ifs. It makes it inaccessible to beginners on the project, and the streams are about twice as slow… just because devs think they are more clever if they pile 7 “.map()” to transform a list. list.stream().filter(Objects::nonNull).map(User::getUsername).filter(Objects::nonNull).filter(name -> name.contains(searchString)).map(name -> “We have found your…

the two snippets you posted do different things

In a list

  John
  Jonhatan
  Joy
searching for "Jo" returns all three of them in the first example, it stops when the first has been found in the second.

Start including the tedious bits about adding found items to the list and the waste of intermediate variables and your "clear" code is wrapped around a lot of repetitions, that only add noise.

It just happens that you are more familiar with the second style, but pipelines are better in many other ways, clarity of intentions being one of them.

Post reply on HN