Comments

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 498

  • @slotharmstronk1348
    @slotharmstronk1348 День тому +4810

    Breaking news: programmer writes unreadable code; Refuses to comment.

    • @deuterium_oxide7382
      @deuterium_oxide7382 День тому +86

      this is one of the funniest jokes ive read in months

    • @vulkarma741
      @vulkarma741 День тому +14

      Care to comment?

    • @JBirdBobbyJ
      @JBirdBobbyJ День тому +10

      This deserves a heart from Thor.

    • @Deathnom
      @Deathnom День тому +5

      The 3rd type of comment lol

    • @BigHeadDP
      @BigHeadDP День тому +2

      I am still bad about it, learned SQL from my last job and I was always but spitting out the code. It would be nice and uniform in my editor but otherwise it was confusing coming back a year later after something broke

  • @CheeseTako
    @CheeseTako День тому +2492

    "I don't remember what this does, but deleting it breaks everything"

    • @Quantumact2908
      @Quantumact2908 День тому +130

      tf2 dev comment momemt

    • @kiritotheabridgedgod4178
      @kiritotheabridgedgod4178 День тому +48

      Riot, looking at the mess of spaghetti code that is league of legends:

    • @NIX-FLIX
      @NIX-FLIX День тому +29

      People code like how I name my files
      After a day, I’ve completely forgotten what was inside of it because it’ll be named something like “butternut squash”

    • @bj2840
      @bj2840 День тому +5

      The holy pineapple

    • @endosym5023
      @endosym5023 22 години тому +7

      The legendary coconut.jpg

  • @mikeaustin4749
    @mikeaustin4749 День тому +1149

    “# TODO: Fix this”

    • @gaetanodepaola2ndchannel179
      @gaetanodepaola2ndchannel179 День тому +23

      Me after every 2 lines of code

    • @blanq820
      @blanq820 День тому +91

      # DO NOT PUSH THIS TO PRODUCTION
      *currently looking at production code.

    • @joshuacheung6518
      @joshuacheung6518 День тому +1

      #forgot what "this" was

    • @CGCTV
      @CGCTV День тому +7

      *written in 2017* me reviewing the code 7 years later...

    • @jaxionmaxomus4315
      @jaxionmaxomus4315 День тому +4

      @@blanq820bro why does that sound perfectly like it’s from a game made before 2014

  • @hadorstapa
    @hadorstapa День тому +1259

    I've definitely seen a third type: the exhausted exasperated coder comment. "Do not change this. It works. No-one knows why, but if you change it nothing works any more. DO NOT TOUCH."

    • @niceuser2face611
      @niceuser2face611 День тому +95

      The fabled “out of bounds tomato of gravity” if it’s gone the entire game stops Physicsing

    • @NIX-FLIX
      @NIX-FLIX День тому +27

      @@niceuser2face611 I always assumed developers had reasons to put random objects out of bounds that affect the entire level apparently not

    • @perphenanolastnamethopls3610
      @perphenanolastnamethopls3610 День тому +35

      ​@NIX-FLIX The typical reason for out of bounds items is to hide them from the player's eyes. If it's a model, it's probably so that the game only has to load in that file when the area is loaded, not wherever that item is used.

    • @narrowwing
      @narrowwing 22 години тому +4

      Ah yes tf2

    • @Evan_C.
      @Evan_C. 20 годин тому +8

      @@niceuser2face611Fallout 4 did this but instead out of bounds objects fixing things it’s out of bounds objects causing crashes, like Willy’s Wonderland in Nuka World with the worms that crash the game making the area unplayable. There’s mods that clean these out of bounds objects up but Bethesda should fix these kinds of game breaking out of bounds objects.

  • @geodudegaming123
    @geodudegaming123 День тому +310

    I was always told by my professors in college "comment your code like you know the next engineer to look at it is a serial killer and knows where you live" 😂

    • @Unknown_Genius
      @Unknown_Genius День тому +39

      We heard more of a "Your job is making it useable for the dumbest possible user, don't become the dumbest possible user yourself by not knowing what you've done anymore".

    • @ratofthecity6351
      @ratofthecity6351 20 годин тому +3

      comment your code like the reader is a kernel dev

    • @arthurvergolino6859
      @arthurvergolino6859 15 годин тому +13

      your teacher is a good teacher. mine just told "yea, this is clean code. do this, so the next person knows what the heck you were doing." nobody did that, he came in at some random day afterwards and said "okay now everyone, stop coding, and sit on the chair of the person right by your side. you gonna see now why clean code is important." from that day, everyone started commenting.

    • @geodudegaming123
      @geodudegaming123 15 годин тому +1

      @arthurvergolino6859 lol that's one way to teach commenting lol

  • @heygarrett
    @heygarrett День тому +112

    WHY is always good, but WHAT has its place; I can appreciate WHAT comments that mark the borders between components.

    • @crediblesalamander8056
      @crediblesalamander8056 День тому +16

      some people are so obsessed with avoiding comments that they'd rather use an anonymous function to give something a name rather than just writing a comment. it's quite strange.

    • @ilyte1
      @ilyte1 День тому +1

      Most people can visually see what a thing does, though.Especially if you name it correctly

    • @blackjacktrial
      @blackjacktrial День тому +8

      What is not terrible - it's just "not as good" as a why.
      And if you need a what comment, it may indicate a needed why comment somewhere else. It's fine as a placeholder until they why becomes clear to the coder.

    • @descendency
      @descendency День тому +2

      @@blackjacktrialthere are times where what is more important than why, but that’s usually in ASM or some globally managed dumpster fire.

    • @pretzel4626
      @pretzel4626 День тому +4

      I agree that saying "what" comments are bad is a bit reductive in a vacuum. I've yet to see a style guide that takes this stance. I've seen plenty of 'don't add redundant comments', but not "what == bad"
      Most people would agree that "what" comments are great for things like docstrings, header files or wherever the interface is declared/exposed, and spots where there are variables or functions with unclear names. They're also used for a lot of reference documentation.
      That said, he's putting in an inline comment to describe a process/behavior/interaction that isn't evident by the name or adjacent context by setting that value, which understandably lends to a "why" comment. If I were to look at that Potion object I would probably assume "unbreaking" was a property it applied to whoever used it, not an attribute of the potion object itself.
      I can only hope the nuance isn't lost on people and they don't take his verbatim statement at face value.

  • @louisrobitaille5810
    @louisrobitaille5810 День тому +105

    There're 2 types of comments:
    2. The bad ones
    1. The good ones
    0. The nonexistant ones.

    • @actuallyasriel
      @actuallyasriel День тому +6

      zero indexing my beloathed

    • @louisrobitaille5810
      @louisrobitaille5810 День тому +3

      @ Zero indexing is the mathematically logical indexing. Digits in order are 0, 1, 2, …, 8, 9. Everything starts at 0, not 1 😅.

    • @actuallyasriel
      @actuallyasriel 21 годину тому

      @@louisrobitaille5810 you're right but that doesn't mean I have to like it!

    • @ratofthecity6351
      @ratofthecity6351 20 годин тому +2

      ​@@louisrobitaille5810i think the better reasoning for zero based indexing is that zero represents an offset, not an order. a basic array isnt a list of numbers, its a pointer to a series of numbers; youre not accessing the zeroth element of the array, but zero strides away from the start of the array.

    • @louisrobitaille5810
      @louisrobitaille5810 10 годин тому

      @@ratofthecity6351 Aren't the 0th stride and the 0th element the same thing 🧐? Item 0, item 1, item 2, item 3, and so on. People're just too used to counting from 1 to 10 instead of 0 to 9, despite it being basically same thing (in this context) 🤔.

  • @Just_a_commenter
    @Just_a_commenter День тому +439

    In my work, I like to think of it like this: any comments or details left must be able to clearly explain a given thing to someone who knows little about what they're looking at.
    I do this with my emails, my invoices, and my client interactions... usually helps to prevent a lot of questions or mess-ups down the line.

    • @chlml
      @chlml День тому +15

      it'd also help you understand what you did or why, later when you check them

    • @akuro6470
      @akuro6470 День тому +2

      ​@@chlmlwho is future you if not someone liable to have become unfamiliar with previous work

    • @kennymuller3115
      @kennymuller3115 День тому +3

      @@akuro6470idk who future me is but past me is a lazy bastard who leaves me to deal with his fuckups. I hate that guy 😂

    • @khrishp
      @khrishp 23 години тому

      My first and only post to stack overflow was in high school. I was submitting a basic coding assignment that i was presenting to my class later that was filled with comments like thor is recommending. I was asking a general question about commenting etiquette in java and explained what i was doing with it. I was torn apart and told that i was pretty much the devil for having more than one comment block above each function block and that i was stupid for not using the standard format for every comment. Have never logged into stackoverflow never again.

  • @fgbthepoh
    @fgbthepoh День тому +22

    There is another.
    // DO NOT TOUCH

  • @michael2636
    @michael2636 День тому +28

    Context is in great demand but poor supply

  • @lkyuvsad
    @lkyuvsad День тому +140

    I appreciate the drive in recent years to write code that uses thoughtful naming that strives to be self documenting. I certainly don’t miss variables in longish methods named “x”.
    But I do think we should write more of these sorts of comments to explain what we were thinking when we wrote code.

    • @crediblesalamander8056
      @crediblesalamander8056 День тому +5

      recently, i was taking two university programming courses. i got whiplash when one of them banned comments almost entirely and encouraged thoughtful naming, the other course pretty much demanded comments every other line and the norm was using abbreviated or one letter names for some reason.

    • @lkyuvsad
      @lkyuvsad День тому +1

      @ we seem hard coded as a species to want absolute rules that mean we can stop thinking, when the optimal stance is often fuzzy

    • @travisperkins9920
      @travisperkins9920 День тому

      My uni professor told us we had to write comments for every single line of code we wrote. It taught us more than anything to just write shit comments.
      This is the same professor who for our final eval had us hand writing code with pen and paper, and he took marks away for unclear indentation and other crap ​@crediblesalamander8056

    • @Deadgye
      @Deadgye 15 годин тому +1

      The change in common aspect ratio from 4:3 to 16:9/16:10 was an underappreciated godsend for programming.
      I used to adhere to lines having a maximum width of 80 characters, but nowadays my minimum maximum width is at least 120 characters. It'd be even longer if I didn't default to always having two editor frames side by side.
      The prevalence, accessibility, and support of IDEs (or more importantly their autocomplete/assist) is the other side of the coin. Longer names are significantly less annoying when you don't have to manually type them out in full every time.

    • @howdyfriends7950
      @howdyfriends7950 11 годин тому

      i think as modern coders had to finally start fundamentally modifying infrastructure that was written in not particularly intuitive high level languages like js, being frustrated by not being able to read code became like this universal stressor to coders, so there was this grassroots renaissance where everyone came together and got their shit together to make everything more legible.

  • @lorech.8326
    @lorech.8326 День тому +1115

    Saw the title and thought he was talking about UA-cam comments

    • @colyrne
      @colyrne День тому +37

      # this comment is here because user misunderstood the purpose of the video initially, but all was cleared up

    • @qhu3878
      @qhu3878 День тому +3

      I am incredibly disappointed

    • @TheRadioknight
      @TheRadioknight День тому +1

      Same

    • @jordan_cagle
      @jordan_cagle День тому +2

      Same, but as someone learning computer science, this is helpful. Also do you know how hard it is to read someone else’s code? If you want to try I have a community post of some code I made, try to see what it does and tell me if you can understand it.

    • @juliennovak7554
      @juliennovak7554 День тому

      Same when I got the notification

  • @ninjaslicertheguardian6433
    @ninjaslicertheguardian6433 День тому +32

    I try to live by this quite a good bit. When I tell people at work about how I might do things or what different safety rules are I try to tell them WHY I/we do that/have it as a rule. Becuase most of the time people seem to be more receptive to things when they know the reason behind it, not just “hey (don’t) do that thing!”

    • @TheScorch191
      @TheScorch191 День тому +1

      "because I told you" only works with little kids

    • @clockwork_mind
      @clockwork_mind День тому +2

      ​@@TheScorch191and even then it only works while you're around to enforce it. Like cats and spray bottles.
      And yeah, I've had like a 90% hitrate with starting to care about restrictions after learning the actual reasoning behind them. I didn't care about hearing protection until learning about resonance and human ears and the actual mechanics of hearing loss. I didn't take electricity or flammables seriously until learning the details of that physics/chemistry, and exactly how careless mistakes can murder you.
      The other 10% are restrictions that I gleefully ignore after learning they have little to no reasoning behind them.

  • @xoBetsyhy12-y2y
    @xoBetsyhy12-y2y День тому +167

    When I saw the title, I assumed he was referring to UA-cam comments.

  • @GrimoireMogri
    @GrimoireMogri День тому +12

    I would augment this by noting that a lot of the reason people write those bad comments is to remind themselves of how the programming language works cause they’re juggling too much of the system in their brain. Plotting down some design context as part of your ‘why’ is often more helpful. In the video, I’d refer to enchant too, something as follows:
    Unbreakable is an item enchant property that prevents this item from disappearing when used if set. 1 is the default value.
    Then you can in theory extend and/or move this to code documentation later if you have to cause ya did enough of the work when it hurt your brain the most.

    • @blackjacktrial
      @blackjacktrial День тому

      So a what comment is an interim why comment.
      It's not awful, but it's incomplete.

  • @t888hambone7
    @t888hambone7 День тому +51

    We set unbreaking here because otherwise this item will disappear when used…

    • @Acrophobia2
      @Acrophobia2 День тому +9

      Because otherwise the game will…..
      …Break…
      I’ll show myself out😂

    • @JabberingJester
      @JabberingJester День тому +9

      That's a good comment!

  • @Teddytheviking
    @Teddytheviking День тому +8

    This is exactly what I am doing when working, and someone tells me to do something new or that I am unfamiliar with: do not just tell me WHAT to do but also WHY. That way, I can perform the task with the goal in mind to achieve the best result.

  • @SirZotolo
    @SirZotolo День тому +18

    The number one thing I learned so far is that you should be explaining things to people as if they are babies who don’t know anything

    • @lkyuvsad
      @lkyuvsad День тому +11

      …especially when the “people” is me in 3 months and I’ve forgotten everything I was thinking at the time

    • @Unknown_Genius
      @Unknown_Genius День тому

      @@lkyuvsad more like 1 week, on good days 2 hours if we're being honest.

  • @chernobyl169
    @chernobyl169 День тому +5

    The entire legacy of good coding practices was apparently wadded up and stuffed into Thor's head because nobody else does this

  • @scottdelaney5549
    @scottdelaney5549 День тому +4

    This reminds me of the "Real Programmers" jokes we used to tell back in the mid 1980's, specifically:
    Real Programmers don't comment code.
    If it was that hard to write, it should be that hard to figure out.

    • @descendency
      @descendency День тому

      “Comments are for bad programmers’ code.”

  • @Jack-mq4ui
    @Jack-mq4ui 21 годину тому +4

    "This was part of a failed feature, but removing or otherwise altering it in any way shatters the entire program. I don't know why. I've tried fixing it, but the only solution was to leave this as if it was still interacting with the scrapped feature."

  • @waynescopeland
    @waynescopeland День тому +2

    "The person who knows "How" will always have a job. The person who knows "Why" will always be their boss.

  • @talleywa5772
    @talleywa5772 День тому +2

    "We don't know why this works. A priest has been called."

  • @adamantii
    @adamantii 17 годин тому +1

    Ideally, well-written code should explain the “what” for itself. Clearly-named variables, functions and intuitively structured code can often remove the need for comments entirely

  • @GenCorbulo
    @GenCorbulo День тому +4

    I can read code just fine, but I can’t read my coworkers minds.

  • @Consumedfever697
    @Consumedfever697 5 годин тому +1

    Comment: "remove after launch"
    Gitblame: 8 years ago

  • @HowardRNFL
    @HowardRNFL День тому

    I had a professor in college that said "Those who know how will always work for the ones who know why." Blew my little brain at the time but stuck with me my whole life.

  • @RBRT02
    @RBRT02 12 годин тому +1

    I love how in this short, he only explains what you should do, but not why.
    Obviously, in this case, it's really not needed, but it's still kinda ironic.

  • @stevo8826
    @stevo8826 День тому +1

    alternatively, write an entire novel. give that one thing an entire origin story

  • @ViscountGames
    @ViscountGames 6 годин тому +1

    Reminds me of when I had a hashtable with linkedlists that had to grow when any of the linkedlists got to a certain length, it had to grow. So I called my hashtable dict, and I called my growth function stroke... Cause in order to make your dict grow, you have to stroke it

  • @cloudymatch5833
    @cloudymatch5833 День тому +2

    I learn so much from Thor. It’s refreshing to see some one with morals use there powers for good.

  • @descendency
    @descendency День тому +1

    There are some pretty hilarious, expletive-laced comments that fall into a 3rd kind.

  • @Henarato
    @Henarato День тому +1

    the most important part of communication is context 100%

  • @malcolmjamesmyers6190
    @malcolmjamesmyers6190 18 годин тому

    I love your content, your mindset is rare and very few people unlock perspective and knowledge and have the ability to combine that, you teach alot of people things that change their lives, sometimes they don't realize it until after.... None the less... Please more info about programming like this :)

  • @TheEstafista
    @TheEstafista День тому +1

    Back then was taking QA classes our teachers always said:
    -Make your test cases clear and simple, so simple that someone who doesnt know anything abaut QA could understand what to do.
    So I tryed showing them to few people to check that. No one cared to look...

    • @Unknown_Genius
      @Unknown_Genius День тому

      That sounds like any law ever made, same as pretty much any contract ever made tbh.

  • @blindedjourneyman
    @blindedjourneyman 11 годин тому

    As someone that LOVES digging through other peoples coding and script, THANK YOU! Good comments should be more common, as a bonus say you cooperate with someone to write software, IF YOU DONT COMMENT WHAT DOES WHAT you cant be pissed if they accidentally break something trying to fix another SIMILIAR THING!

  • @hh126
    @hh126 День тому

    i had to manually search you uo because its been months since you were naturally reccomended to me and your shorts and noel’s are the nourishment i need

  • @bluemanjoe1238
    @bluemanjoe1238 16 годин тому +1

    As a cool sci student I must say thank you

  • @Mashii52
    @Mashii52 День тому +5

    # this jpg of a coconut is here because deleting it will break the game

  • @crimsondragon2677
    @crimsondragon2677 10 годин тому +1

    Code is read more than written, and very few things hurt more than looking at yesterday’s code without a clue as to why it’s there.

  • @Soapy-chan
    @Soapy-chan 13 годин тому

    it's like the settings in the BIOS
    >enable TPM
    >click on it to get explanation
    >this setting enables or disables TPM
    OH WOW THANK YOU THIS TOTALLY EXPLAINS IT

  • @seanmenzies1986
    @seanmenzies1986 День тому +1

    I will add one inglorious exception: when you comment a more complicated function before writing, then leave it in because you're proud it all worked out.

  • @goblinwisdom
    @goblinwisdom День тому +1

    I literally me proof my notes for everything, because months later, i forget the context hundred percent.

  • @SolusDarkcoat
    @SolusDarkcoat День тому +2

    "WHY?!" -Thor Goblinsson

  • @Doctor_C_Jack
    @Doctor_C_Jack 14 годин тому

    I started saying "yes" out loud when watching this short because of how true it is.

  • @firenzarfrenzy4985
    @firenzarfrenzy4985 День тому

    I'm not even a programmer but I feel like this advice extends to more fields. Anyone can figure out what something does if they're taught or can even use context clues. It's a lot harder to figure out why it's there because function may not have obvious implication. Hence a 'why' is way more valuable than a 'what'.
    Anyone who reads your code now knows your thought process and the function's purpose.

  • @mBlackThunder
    @mBlackThunder 18 годин тому

    This fits very well with my belief: "if you havd to write something only once, do it right"

  • @michaelcollins3380
    @michaelcollins3380 9 годин тому

    YES!!! Comment on the reason and intent. What it does can be derived from actually readying the code. Thank you Thor!

  • @joshua7551
    @joshua7551 7 годин тому

    The number of times I have written a 'why' comment and saved myself headache from having to reread my own code is super high

  • @ealtar
    @ealtar 12 годин тому

    especialy with game that can be modded, having usefull comments is a godsend

  • @CaliHime
    @CaliHime 11 годин тому +1

    To be fair, "This sets unbreaking to 1" as a comment for "unbreaking: 1" is like posting a sign above a door that reads "This is for going through".
    That's some high levels of "No shit sherlock" right there :P

  • @kasomoru6
    @kasomoru6 День тому +1

    I would be honored to work on you code Sir.

  • @BenRangel
    @BenRangel 9 годин тому

    PR reviews are so important for deciding where comments are needed.
    I often find that pieces of code I imagined would be confusing to other devs are self explanatory to them, and if I add too many comments they will read right past them and miss the important ones

  • @tylerzade6890
    @tylerzade6890 День тому

    I'm getting back into programming, I haven't done it since college in 07. I probably wouldn't have of. If it weren't for you inspiring me. Originally I learned visual basic and SQL. But I found an app to learn Python on. And it feels as exciting as learning programming for the first time again.

  • @Valnuss
    @Valnuss 37 хвилин тому

    Depends on the language, method of coding and situation. There can be bigger chunks of code that doesn't make sense to put in a function. So it's useful to write a comment describing what the following block does.
    "Why" is useful when it's obvious what the code does.

  • @necrowdancing
    @necrowdancing 19 годин тому

    Okay, this is actually so much more helpful than being taught to just type out what it does.

  • @parametr
    @parametr 17 годин тому

    Oh, how many times I had to explain this to "wizard style" software engineers...
    Too real, man

  • @snarpking
    @snarpking День тому

    it's about why being more important than the what, it's about the why typically being less obvious than the what. Explain what isn't obvious. Are you literally ust assigning a value to a variable? The why is going to be less obvious. Are you checking if the players health is still positive after being attacked? The why is self explanatory, but the what might still be worth documenting. I for sure agree that the why is typically what is more important, but it's more complicated than just "document why, not what"

  • @CielHunterNorwood
    @CielHunterNorwood День тому +1

    Programming equivalent of "Never mind, fixed it myself."

  • @EssaysInTheCommentsSection
    @EssaysInTheCommentsSection 21 годину тому

    This is actually pretty helpful. I will now promptly ignore it because listening means rewriting hundreds of comments because i went for the "quantity over quality" route.

  • @rend3ring
    @rend3ring 12 годин тому

    I think this kinda thing should be also be known even for conversations. A great example is telling kids, "because I said so" or "because I'm your parent," saying that doesn't teach reasoning.

  • @madmulk9
    @madmulk9 День тому

    As I sit here, nearly midnight, mere days after I thought to myself that I want to learn how to work in s&box (and godot sometime but that's a whole other wheelhouse) I am glad to see this. I may have a small amount of programming in my background but having good comments eluded me

  • @dancing_drake
    @dancing_drake 2 години тому

    I did a stint as a programmer before changing paths to become an Art Therapist. When working with code the number of times I wish there was reasoning behind the old code rather than just useless comments was uncountable. It really made it hard to know when adding or changing anything if it was also somehow changing other important things without knowing because the code wasn't well documented or in some cases with the really old code, just so inefficiently written.

  • @C_Corpze
    @C_Corpze 4 години тому

    I think adding a "why" to a lot of things is very important because everyone likes to know the reason why something is the way it is.

  • @Ryan-ts3py
    @Ryan-ts3py Годину тому

    Comments should never explain what code does, because if someone can't just read it and understand what it does then it's bad code. 100% agree that comments should be about why that code was necessary.

  • @Kubaxwot
    @Kubaxwot День тому +3

    This sets unbreaking to 1

  • @dahorn100011
    @dahorn100011 14 годин тому

    My favourite is the meme
    "junior devs be like"
    And it was a picture of a stop sign with a arrpw pointing to it saying "this is a stop sogn"

  • @statphantom
    @statphantom День тому

    OMG i literally say this to my students every year. don't comment 'what', comment 'why'. good to see other people in the industry have similar views

  • @AndrewLince
    @AndrewLince 20 годин тому

    From someone learning how to code from scratch, thank you. Very few instruction courses really anywhere state anything like this even though one would think it's common sense to do this. Yea, I'm serious.

  • @jam_herobrine1642
    @jam_herobrine1642 День тому

    Thor: "We put why its there, not what it does"
    My comments: "This is here as without it, the code doesn't work, I have no idea what it does"

  • @gabrielleme00
    @gabrielleme00 День тому

    At my job, my team has a rule of no comments. The purpose is to force us to write meaningful names for everything, and promote encapsulation whenever possible.
    This philosophy has been working quite well on our projects. I know it's not "one size fits all", though.

  • @firstnamelastname9237
    @firstnamelastname9237 17 годин тому

    “This sets unbreaking to 1”
    “This tree is an aspen. We know that it’s an aspen because of the way it is”

  • @sage5296
    @sage5296 День тому

    “what” can be important to if the way the code itself works is unclear, but usually in that case you should just rewrite the code to be more clear

  • @mariusg8824
    @mariusg8824 День тому

    In most cases, type b is backed by source control. You can click on a line and see its commit message. It's less error prone and less verbose, and only fails if anyone manages to erase all relations to source control. In that sense, for most modern devs its perfectly okay to not comment in code.

  • @nabra97
    @nabra97 22 години тому

    Type one was what we were told to do at uni. On my first job, I wanted to make the best impression and made sure to put them *everywhere*. Nobody cared until, two years later, we needed to share the code with our partners. Wouldn't be surprised if some of that is still there

  • @matetheone4953
    @matetheone4953 13 годин тому

    You know what.... as I think about it really... I'll get started tomorrow and rewrite my comments. Thanks for the advice.👍

  • @LokelyConed
    @LokelyConed 15 годин тому

    I cant remember who the creator was but back when i was coding basic menus for campaign GTA V, I used someones menu that they uploaded as a learning document and i swear to god, every single unique line of code was explained.
    From "this line sets the key that is used to open the menu" to "this line uses r,g,b values to set the colour for all slider bars. Only takes effect if previous line is set to 0".
    It was a coding noobie's wet dream 😂

  • @shakefist1
    @shakefist1 13 годин тому

    Me, an intellectual, “ah yes. There are 2 types of comments. Single line and multi line.”

  • @Resetium
    @Resetium 21 годину тому

    "This is set to unbreakable because, for whatever reason, it deletes a random item when used otherwise."

  • @FALG31
    @FALG31 День тому

    Yeah good point...
    ...if we could understand the "why" of code ourselves

  • @SneakySquidStreams
    @SneakySquidStreams День тому

    As a brand new programmer, who also just saw the Necro thread post, I feel like there is an oppurtunity here for a joke between these two shorts that could be VERY funny.

  • @Gh0stWh33l
    @Gh0stWh33l 9 годин тому

    "Yes, this causes a Memory Leak. Too bad!"
    "This is bad dumb code but more importantly it's bad dumb code that does nothing. Why? Did it ever?"
    "My hope with this code is that I am never allowed to work on GUI ever again."

  • @galakstiv
    @galakstiv День тому

    I also love variable with a name that is the value, ie: FLAG_P = "P" instead of giving the variable name a meaning like FLAG_PROCESSED = "P".

  • @wontpower
    @wontpower 15 годин тому

    Lukewarm take: If you need to explain what your code does in a comment, it’s time to refactor

  • @TheTrashMobileGamer
    @TheTrashMobileGamer День тому

    "The spell works. I dont know why if tampered with the machine will die Please leave it be kind regards exausted tech wizard"

  • @sterlingodeaghaidh5086
    @sterlingodeaghaidh5086 11 годин тому

    "-- If you remove this section I will haunt your soul for eternity."
    Was in a script I co-wrote with a colleague.

  • @alexandrefillot9600
    @alexandrefillot9600 День тому

    That's funny, we're taught to make comments the wrong way (although, our codes can sometimes be messy AF).

  • @altreusplays
    @altreusplays 15 годин тому

    Code: what
    Comments: why
    Documentation: how

  • @MatttKelly
    @MatttKelly День тому

    Thor just flexed his experience on us all. 99% of you are guilty and you know it!! 😂

  • @DavBotsArcade
    @DavBotsArcade День тому

    My favorite comment is "I do not know what this does but when I take it away everything goes to shit."

    • @Snowsc-dp7qo
      @Snowsc-dp7qo День тому

      @@DavBotsArcade “when writing code only programmer and god knows what the code does. Few weeks later only god knows” this is the truest wisdom anyone has ever said about software development.

  • @kalengray4073
    @kalengray4073 19 годин тому

    Professor's: "what i dont know what your talking about, this is clearly fake."

  • @LeonardChurch33
    @LeonardChurch33 День тому

    Sometimes the "what it's doing" comments are nice when you're summarizing the function of a big block of code.

  • @NoLootStudios
    @NoLootStudios День тому

    I've been doing this actually, but mostly because I forget how or why I used certain code, so I over-explain things to my self so I know future me will understand it.

  • @thegabrelian631
    @thegabrelian631 День тому

    I feel like explaining what it does us important for more complicated bits of logic or whatever too

  • @RoyalPhoenix2015
    @RoyalPhoenix2015 8 годин тому

    Remember profs hounding people for comments in homework, thought it was stupid. Now I’m real world (and working on 13 year old code), I believe no comments should be automatic failure for an assignment.

  • @ZombieMinion1992
    @ZombieMinion1992 50 хвилин тому

    I work at a bank and I wish people would apply this to when they leave holds and comments on accounts. I don't want you to write "hard hold" I want to know WHY. Or god forbid they put "Ask favorite animal" when there are 3 people on the account and the answer isn't even in our system!!!!

  • @ArchEpoch
    @ArchEpoch Годину тому

    Code should be as self discriptive as possible. This is usually done with good discriptive variable/class/type/function names. It is also done by programming to the affirmative if possible (and some other good patterns). Comments should only be used to describe the reasoning behind something, if it is not apparent. (Or automation designed to look at comments like an doc generator).

  • @anthonysilva5481
    @anthonysilva5481 День тому

    So here's what I've learned:
    Bad comment: This is a video on comments
    Good comment: I should make more useful and non-redundant comments on things, because that will make my comments more useful and non-redundant.
    Wait, I think I did it wrong...

  • @_pitako
    @_pitako 19 годин тому

    thor literally teaching me better than my college lecturers

  • @mrsquiggles1379
    @mrsquiggles1379 13 годин тому

    "they're both the same picture" 😂