“Coding is basically just ifs and for loops.”

  • "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 the right way to punch is the only way so it's only a punch again.

    So coding it's just ifs and loops... Then is OOP and Functional and Logic... But then once you transcend all those paradigms you understand that is all ifs and loops.

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

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

  • Well, quite: if you add that code must run sequentially it's the Boehm-Jacopini theorem: https://en.wikipedia.org/wiki/Structured_program_theorem

  • 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 these days.

    I tried to explain how something was wrong and why but no one would listen all believe they were 10x developers, Life lesson learned, never ever try to correct an idiot.

    Here are some of the practices they followed * No indexes on tables, not even unique * No DRY, NO KISS * Switching to new shiny framework/library every week * no tests * Keeping entire codebase in a single file (4k LOC) * no versioning * Exposing DB credentials to the entire internet and not acting when being warned

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

  • 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 proficient is of course another question, but achieving a basic understanding shouldn't take all that long when you just focus on how to if-else, how to setup loops, and how to assign variables.

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

  • UGH. 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.

  • In my twenties, I wanted to use all the cool PL techniques: meta-programming, reflection, monads, macros, type-level programming, etc. I'm getting older and now I want my programs to be 90–95% functions, arrays, structs, enums, and loops and only parsimoniously throw in more advanced language features.

  • There’s a joke in the fp community I can’t find right now that describes the evolution of programs from imperative side-effectful statements to a for comprehension, with exception catching, that looks nearly identical.

  • Then what the fuck is a monad?!?

    Seriously I still don’t know what a monad is and apparently it’s just a bunch ifs and for loops, so I guess I’m pretty stupid.

  • Actually coding is just literary translation into a language spoken only by pedantic idiot savants

    That's why it's pedantic idiot savants who tend to be the best coders

  • While Carmack is law, don't think this was worth a share here, as it was just a cute thing a young kid said? Only slight jokey whatever

  • Good code explains the problem to the reader and implements the solution as a side effect.

    You can often express the problem quite well using a combination of if, for, comments, variable names, function names, list/set and map data structures.

    Sometimes (<10%) you encounter a problem that's interesting enough to define a custom type, and sometimes you make tree data structure out of it (<1%). On very rare occasions (<0.1%), you need a more complex data structure.

    Code that uses thousands of classes is very hard for a reader to approach, but so is a single file with a never-ending ifs and for loops. Always write code for another person. If nothing else that other person might be you in a few months (or much sooner).

    Coding is basically just writing for humans in a language a computer can execute.

  • All life is just cytosine, guanine, adenine, and thymine.

  • Coding is basically just ifs and for loops.. But software engineering (or development) is much more than just coding.

  • I remember explaining recursion to an aspiring programmer to apply to some tree node walking or something, and at some point it clicked! I saw the second it worked in the reflection in her eyes, they got big and lit up and there was this palpable sense of "a-ha" in the room! It was one of the coolest moments of my professional life. But yeah, my kids (one of whom is picking up programming) would be right behind the "ifs and loops" statement.

  • Reminds me of a coworker who said that they only data structure you need is an array since it can be used to to mimic every other data type.

  • Sounds like the Re-birth of the "Expert System". Now with neural networks ;)

    Learning from Artificial Intelligence’s Previous Awakenings: The History of Expert Systems

    https://ojs.aaai.org/index.php/aimagazine/article/view/2809

  • Coding is just electrons having fun.

  • my professor at uni always said that machine code is just 1's and 0's and if you can count to one you can understand computers

    (with a smile on his face and shrugging his shoulders)

  • The way I interpret this is that the 'just ifs and for loops' is like Matrix rain code. In the beginning it looks like gibberish scrolling down the screen. When you master it, it's still gibberish scrolling down the screen, but it's simultaneously something else on another level as well.

    I often find myself writing simple things with a compact-but-high-level-conceptualization, that when edited by someone else, clearly only saw the rain.

  • Ifs and for loops are trash. Real programmers just write massive linear algebra operations that they can throw on a cluster of GPUs to get 50,000x parallelism. ;)

  • I wish I could have a son who understands Turing completeness without being explicitly told... I guess that's the power of the Carmack bloodline.

  • also "coding is basically over glorified plumbing". ~ my cynical coworkers

  • you guys have for loops?

  • Lol no. It is a whole sets of skills, from extracting just right abstracts from the problem domain and defining adequate sets of interfaces, to arrive at just right (clear, concise, mostly-functional) modular implementation.

    Almost no one nowadays possess these skills. I we have is node_modules crap and J2EE-like design bullshit.

    This like saying that poetry is just words and commas.

    But he is just a kid, I know. ;)

  • Ahem, and math in between. Quite a lot of it.

    Calculating the square root of a number is ifs and loops but wouldn’t be much fun without the math.

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

  • Building a house is just lumber and nails.

  • His mind will be blown to lean it all runs on protons, neutron, and electrons.

  • Quite literally how I explain coding to people.

    It’s basically that, plus resource management.

  • Ah, keen observation, young grasshopper! But nota bene: just as man cannot live on bread alone, one's understanding does not arrive merely from the consideration of a collection of atoms.

  • Yeah, it's just branching and iteration. The kid's right.

  • Just to be clear: a language with only if() conditionals and for() loops with known number of iterations (so for instance all for-each loops) isn't actually Turing complete. This is called primitive recursion, and an easy to prove example of what it cannot process is computing the Ackerman function.

    Also, you can easily see that something is fishy because all such code must terminate (where's the halting problem here?)

    https://en.m.wikipedia.org/wiki/Primitive_recursive_function

    Otherwise I completely agree with the aphorism.

  • And functional programming is just algebra. Ez Pz.

  • Thing with loops, they are complicated. Like infinity. I remember when someone taught me about multiple infinities. It is wonderful!

  • A Turing machine is basically just ifs in a loop.

  • It's not about the code, it's always been about the data over spacetime. You have a data problem, not a code problem.

  • Computers are just infinite tape marked out into squares... (Turing machine). A pyramid is just a stack of cubic rocks.

  • http://www.bash.org/?7717

  • Wait till he reads about a Turing machine

  • I really wish it was as simple as that.

  • And ppl nagging you. No clueless ppl nagging you with things like jira and idiots like jeff sutherland.

  • Wild stab in the dark here, but for some applications it's possible you may need assignments too.

  • Until he finds out about Promise.then chain. So, programming is basically just ifs, for loop and then.

  • It’s all just strings. Make the right strings happen in the right place and the computer does things.

  • Hey I found a post about my username.

  • One time I told someone I work on web apps and they said “oh that’s just html and css that’s easy.”

  • It's just 0s and 1s, really.

  • Well it is ifs and loops and assignments. Kind of not useful without the assignments.

  • Until you get to network programming, then it's "just open a socket"

  • joke aside. we know a language is Turing-incomplete if it has only ifs and bounded for loops. And if 90% programmers' tasks can be done using a Turing-incomplete language, is there any benifits we can get from this?

  • Yeah, but a master of coding uses a lot of Mathematics, like his dad does :-)

  • Add in some form of mutability and you’ve got yourself a Turing machine, yes.

  • Living is just moving stuff around based on the stimulus received. :-)

  • All we need are functions!

  • In fact it is just ifs and jumps. Loops are a higher level construct.

  • No, coding is just converting some data into other forms of data.

  • "construction is basically just concrete and steel" :)

  • Amateur. We do branchless coding and unroll every loop here.

  • haha, it is! it is a wonderful experience when you make that realization. That's the point with programming. Easy to learn. Difficult to master.

  • Coding is basically just ifs and while loops.

  • Or, coding is basically just folds and filters.

  • Gastronomy is just fat, sugar and protein.

  • with input, output, and rw to arbitrary memory.. then I think that just about satisfies turing completeness

  • And c++ is basically just c with classes.

  • Coding is basically just zeros and ones.

  • For loops are basically ifs and gotos.

  • And print. Don't forget print

  • Computers are just thinking rocks.

  • It’s just 0’s and 1’s, baby

  • just when you think it is, concurrency is a whole new level

  • And datastructures.

  • And assignments.

  • Humans are basically just ifs and for loops

  • And types.

  • git is just a graph, man

  • Ok

  • I dont understand why theres a trend against functional programming. I started as a mechanical engineer and became a manager. I think I know a bit better than code monkeys.

  • Moronic nonsense clear to anyone who has ever seen an enterprise spaghetti code joke

  • All programs are by definition a combination of sequence ,selection and itteration.

  • There's no limit to how hard HN will fellate pg and Carmack.

  • “that happened” stories by egotistical parents who need to log off Twitter for their own mental health’s sake now make the top of HN

  • “coding is basically just ifs and for loops.”

    Maybe, he knows only that much, yet

  • This is the most insightful thing I've ever seen on Twitter.