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.
“Coding is basically just ifs and for loops.”
251–260 of 418 posts
Re: “Coding is basically just ifs and for loops.”
#252Re: “Coding is basically just ifs and for loops.”
#253Earlier quoted context omitted.
I'm may be biased because I spent too much time arguing about this but you hear those $fancy_principles / fp / hard oop / "clean code" evangelists, and then you go to any repo of real world software - linux, compilers, kubernetes, git, blablabla and everywhere you see for loops, goto, ladders of if statements
I mean, you cherry-picked by quite a criteria there. It’s all C and Go, and they somewhat lack higher level abstraction capabilities. On the other hand compilers are often written in C++, or are bootstrapped in the very same language though. Also, what about OpenJDK, elastic search, all the web servers running the whole cloud? Linux might be the underlying OS, but that’s not the program actually doing business logic.…
My claim is:
Almost all real world, OSS, big, battle-proven code bases are nowhere even close to evangelist's "sanity".
They're full of loops, nulls, gotos, ifs and all ""bad stuff""
>all the web servers running the whole cloud
I literally opened first file that I've seen in nginx repo and take a look at this:
shitton of ifs, for loops gotos and all of that in one, a few hundreds lines long method.
https://github.com/nginx/nginx/blob/master/src/http/ngx_http...
>On the other hand compilers are often written in C++
are they?
>or are bootstrapped in the very same language though.
thus what?
Re: “Coding is basically just ifs and for loops.”
#254If 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…
Re: “Coding is basically just ifs and for loops.”
#255"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…
Re: “Coding is basically just ifs and for loops.”
#256Earlier quoted context omitted.
Those mean nothing without the proteic machinery that translates codons into other proteins though. DNA and RNA without ribosomes is like a language without a compiler.
Umm.. what are those codons and other proteins made of? ...
Re: “Coding is basically just ifs and for loops.”
#257And really, aren't loops just ifs and jumps under the hood? So coding is just ifs
I started in GW-BASIC when I was a kid, and all I needed was IF and GOTO. You could do anything with that. No loops, no functions, no nothing. IF's and GOTO's!!!
Re: “Coding is basically just ifs and for loops.”
#258Earlier 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 my experience programming programming with primitives and basic flow control operations frequently tends to be at least be order of magnitude fast…
Will your manually written imperative code beat an SQL database for the same task? Because it uses a very very high level description on what it has to do and chooses an appropriate algorithm for that for you. You can optimize one specific query (quite painstakingly, I believe) to beat a general db, but it is very far from clear that “for loops will beat higher level abstractions”, imo.
With my own set-up I can have my data in pre-calculated immutable tables that are memory mapped off disk. That means I can write lock-free code. My updates are large hour-long batch operations off a written journal.
For the lexicon I'm also rolling a special one-way compression scheme/hash function that guarantees uniqueness but only works due to quirks with the data.
General purpose databases can't do these things, because then they wouldn't be general purpose databases.
SQL databases perform really well on average given your query is relatively optimized, but they do not represent the pinnacle of performance. Any time you want the fastest most efficient code to deal with a particular use case, it pays enormous dividends to roll your own implementation that has domain awareness. It means you can cut corners general solutions simply can't.
Re: “Coding is basically just ifs and for loops.”
#259"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…
I started off writing a lot of 68000 machine code. I was always amazed what you could accomplish with a lot of loops and branches. I never lost that sense that at whatever higher level I was at later on, it was all loops and branches.
Re: “Coding is basically just ifs and for loops.”
#260UGH. Back in my day the only language was BASIC and we only had IF and GOTO. Dijkstra has made these children SOFT and I'd piss on his grave if I could be arsed to get out of my rocking chair.
What version of Basic were you using that lacked FOR? Even the shitty one crammed into my Sinclair ZX80 had FOR.
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 on the language, but a familiar program [1] uses FOR loops -- so they were supported. But I distinctly recall hand-rolling a for-equivalent loop with GOTO and IF, counting down to zero.
[1] https://web.archive.org/web/20130918210121/http://www.coding...