How to Write CODE That Documents Itself

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 พ.ย. 2024

ความคิดเห็น • 207

  • @InfallibleCode
    @InfallibleCode  4 ปีที่แล้ว +7

    👕 Check out my merch store at teespring.com/stores/infallible-code-merch

  • @DanieIMonteiro
    @DanieIMonteiro 3 ปีที่แล้ว +42

    What I've learned from programming and heard from many senior level programmer is to never document WHAT your code does - rather document the WHY. Like, WHY did you solve it like this? Is there a reason WHY you store the data in this form? WHY do we even need this?
    This in combination with good method names really helps a lot

  • @shieldgenerator7
    @shieldgenerator7 3 ปีที่แล้ว +88

    this was both informative AND entertaining, a very rare combo in code tutorials

  • @Patrickblox
    @Patrickblox 4 ปีที่แล้ว +36

    One of the only channels whose videos I always watch because I always learn something new. Thank you, Charles, your videos are extremely valuable.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      I'm so glad to hear that! Thank you :D

  • @tafellappen8551
    @tafellappen8551 3 ปีที่แล้ว +4

    imho whats worth mentioning here is when you refactor like this dont just assume it works like it did before, especially if youre not the only one working on the code. As a developer my dad has many a horror story about how an overconfident dev was like "wow this code bad right here i can write better code" without checking with anyone or making it clear enough that they changed anything, and suddenly everything is broken and nobody knows why.
    even for code that is 100% me, maybe im just dumb but theres countless times where i go to refactor even the simplest thing in my own code and it just stops working because i forgot something little or messed up my syntax
    and honestly, im not sure how i feel about just automatically deleting "zombie code" or "redundant" comments. as with most things in code it depends - the example youve given definitely seems to warrant the cleanup. I think that every time you see something like this its worth considering whether its still serving any purpose. Maybe as i gain confidence and skill as a developer I'll become more comfortable with the idea of comments like these having to go, but right now it makes me uncomfortable.
    I've found that I always need to comment my code like I take notes for a math class - which means i need act like im talking to a literal brick. It not only helps me think about the code as I write it, but also greatly helps me rebuild my working mental model of, basically, how i think about my code, whenever I pick up where i left off. Sometimes my comments probably look redundant to others, but my brain just needs to see something written in a color that isnt the color of the code. Much like I wouldnt want someone to just say "you dont need this" and throw away half my math notes, I wouldnt want someone to do that to my probably seemingly redundant comments. If i dont need them anymore, I will know and remove them.
    I've worked with uncommented code in an sdk that was very descriptive of the intent but it didnt fully work. we tried fixing it but the code structure leaned so heavily into "describing intent" that the actual logic was so abstracted that it was nearly impossible to follow. the method calls were seemingly *endlessly* nested and when you finally reached the last one you still had no idea how the code actually functioned. after days of this and zero progress we decided that we would be better off foregoing the sdk entirely, immediately everything got much smoother.
    in a similar manner, the zombie logic i leave also usually serves a purpose to me. if its not gone i probably am still using it, if for no reason other than to use as a checklist as i write the new logic. and while it is in source control, by deleting you could be forcing someone to have to spend time hunting around source control in the future.
    tl;dr; a badly worded way of saying i really cant see myself irl being as carefree with deleting comments as you were in this video, im too afraid of throwing away someone's notes.

  • @cesargamedev716
    @cesargamedev716 4 ปีที่แล้ว +25

    I really like the idea and in fact I was already doing similar things in my code, but I don't think this is enough to avoid using comments as a whole. Also, comments have been very useful for me, as thanks to them I've been able to create documentation websites using only doxygen and no aditional work, as it reads the comments and converts them to clear documentation.That said, encapsulating conditions and other similar functions is really nice, more if they're something you'll need to use more than once, but using them to substitute all of the code willl generate a lot of code just for properties, which I think could be a problem if you need to change those properties at some moment. So my position is, use this to reduce the complexity of code and the reliance of comments but find a balance so that you can keep at least comments for the methods and such.
    And yeah, keep your code clean and write selfexplaining names for variables, methods and all of that.

  • @RictorScale
    @RictorScale 2 ปีที่แล้ว +1

    This is extremely helpful. I always knew that we should use variables instead of hardcode value for maintainability if we need to change something but I never thought of using varibles purely for readability. That makes SO MUCH SENSE

  • @BabakSalimi74
    @BabakSalimi74 4 ปีที่แล้ว +5

    I want someone like Charles to review my code!
    The problem with not working in a company is you don't have a senior checking your code, then you end up with a mess in your code and you have to learn it the hard way!

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +2

      Haha I wish I had the time to review everyone's code, too xD but you're totally right, having someone else look over your code and provide feedback is incredibly valuable.

  • @jeniferirwin
    @jeniferirwin 4 ปีที่แล้ว +4

    Up until now I wondered why I've seen so much code that appeared to be wasting time declaring variables that didn't seem to need to be declared. You explained this so well that now I FINALLY understand it, and I thank you! Also... oh noes! Poor Charles! I hope Barles doesn't have to 'delete' him!

  • @alexallin8019
    @alexallin8019 4 ปีที่แล้ว +4

    I've been pushing for this sort of change at my work place. Currently we have strict rules about commenting everything that results in comments on getter methods like:
    /*
    * gets X
    */
    public int getX(){}
    etc
    Meanwhile X might be an actual variable name that does not correspond to an x co-ordinate and takes 10 minutes of reading through the code to figure out.
    One counter point to the sort of self-documenting code you suggest though, performance. I know that 99% of the time there is no real performance hit for all these method calls, but I have talked to people working in AAA games that have told me they have tons or duplicated, inline code in their engine because the overhead of function calls is too much to maintain 60fps when added up over the whole project. So these people rely heavily on comments to explain algorithms etc that would be better encapsulated in a method call. When working on less demanding games, or on enterprise software though, I definitely prefer to have clearer code and remove the comments.

  • @fmproductions913
    @fmproductions913 4 ปีที่แล้ว +7

    Interesting topic and good video! Reminds me of some parts in the book "Clean Code" by Robert C Martin. There is also the notion that other team members often won't update comments when a method is changed and that methods and variable names should be self explanatory in an effort to reduce the need for comments as much as possible. I think I should revisit the book someday since my memories of the concepts are already a bit fuzzy, but it is a good read. Having methods for small checks that have a verbose name is also mentioned to be a good idea.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +4

      Clean Code is a great book that should definitely be on every programmer's shelf. Your comments makes me want to read it again!

    • @mrp0001
      @mrp0001 4 ปีที่แล้ว +2

      This video reminded me of that book too, I'm currently reading it in free time

  • @bogdanzarzycki9885
    @bogdanzarzycki9885 3 ปีที่แล้ว

    It's a great eye opener. I was aware of the problem, but not really knew exactly how to solve it nicely. Just extract everything you can into lambda type properties, that i love so much.

  • @nikolaynakorkeshko448
    @nikolaynakorkeshko448 3 ปีที่แล้ว +1

    After reading comments for this video:
    Some tips for people who really wants extract all code parts to different methods for better understanding:
    Extract all code that you dont cleary understand in very big project, also do it with every frequently called code => slow down your program.
    Check this out: simple inline calculation vs method call(with same calculation inside) results for 1 million calls:
    Inline: 10,6802 mills
    MethodCall: 29,5754 mills
    Results are same but execution time(perforamance) different. Inline 3 times faster. You can do same test.
    If you really want to understand some code parts when you back to it, just use #region instead of move all code to whole method and consume you cpu time(imagine it runs on slow mobile cpu, not on pc)
    Next tip. If you are team lead or just you development team consists of 3+ programmers and some of them can be changed over time, then you obviously need ready to use documentation(website, generated from xml comments in code) for your team. That will makes some processes run faster.
    Next tip. If you don't want see a lot of comments in your code, you can move docs in different files and link it via xml special tag using just one comment line
    Last tip. Computer dont do the magic, everything has a price. Remember that

  • @davidrogers6987
    @davidrogers6987 3 ปีที่แล้ว +8

    I do recommend proper naming conventions for methods, steer away from the "for each" traps. Strong commented code creates ease for people from different disciplines especially at times when refactoring is a thing. Additionally, creating accessible information that doesn't require you to go into the code is A+.

  • @RishabKapadia
    @RishabKapadia ปีที่แล้ว

    i was just about to comment my entire code base (small). thanks. love the content style and your speach. subscribed.💙

  • @tommallama9663
    @tommallama9663 4 ปีที่แล้ว +15

    Only you could write a code talk with a Halloween theme and still make perfect sense xD

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +1

      Hahaha this is my favorite comment xD

  • @Bisirsky
    @Bisirsky 2 ปีที่แล้ว +1

    Wow, I'm a linguist and it's the best explanation why I was so irritated by someone's else code.

  • @mrp0001
    @mrp0001 4 ปีที่แล้ว +4

    Awesome video! Great production quality as always, that Halloween part was great.

  • @halivudestevez2
    @halivudestevez2 2 ปีที่แล้ว

    Your example is very good, useful. Especially the property getter expressions.

  • @papermartin879
    @papermartin879 4 ปีที่แล้ว +23

    infallible code socially distances from himself somehow

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +3

      You can never be too safe 😉

  • @simonhagfalk
    @simonhagfalk 4 ปีที่แล้ว

    Great examples of how to document code easily. Also big + for the comedy in this one.
    I like to write function names that are descriptive and reduces the need for comments aswell. Sometimes the method names get a bit long though.

  • @newgoogleaccount3526
    @newgoogleaccount3526 3 ปีที่แล้ว

    Acting, Teaching and Comedy, you are very good at many things. I learned many things from this video. Nice concept of content and tutorial.

  • @kylebarvel
    @kylebarvel 3 ปีที่แล้ว +2

    If you need help remembering what zombie code is, just remember 1- they are the undead and 2- they look green (well in most cases)

  • @tillschonberner4910
    @tillschonberner4910 4 ปีที่แล้ว +12

    Lol, nice Halloween reference!

  • @Skeffles
    @Skeffles 4 ปีที่แล้ว

    Fantastic video! Learning to write self documenting code is super key for any dev. I am a big advocate of it and barely use comments.

  • @JuankQuinteroMejia
    @JuankQuinteroMejia 3 ปีที่แล้ว +1

    I just realize I tent to do this kinda and dont leave so many comments, just titles to some things in functions, cool!

  • @artcadev
    @artcadev 3 ปีที่แล้ว

    Nice entertaining, it makes sense but definitely a bit hard for Junior Developers like me, but it make sense and it something I should start learning from my early steps.

  • @newgoogleaccount3526
    @newgoogleaccount3526 3 ปีที่แล้ว

    This is a good video, this channel is very underrated.

  • @MasterKrepta
    @MasterKrepta 4 ปีที่แล้ว +2

    The funny thing Is I just spent the last hour removing "Zombie Code" from my Business partner's class... and found this video in my subscription feed :)

  • @eruchii7200
    @eruchii7200 4 ปีที่แล้ว +1

    Love this idea 👍. Gonna try it on my project.
    Good job on the zombie concept 😁

  • @JuankQuinteroMejia
    @JuankQuinteroMejia 3 ปีที่แล้ว +1

    I lost it with namespace Redrum xDD

  • @Yearning.Astrophile
    @Yearning.Astrophile 3 ปีที่แล้ว +1

    Too good bro👍👍👍 the concept is very understandable love from India

    • @InfallibleCode
      @InfallibleCode  3 ปีที่แล้ว +1

      Appreciate it! Sending love from the US 🙌

  • @lakeviewgames2975
    @lakeviewgames2975 4 ปีที่แล้ว +1

    Love the format and pretty informative too 👏 keep up 😎 Looks like I'm going to delete some zombie code in my project too

  • @fivestarfire
    @fivestarfire 3 ปีที่แล้ว +1

    Your videos are a gift. I appreciate you!

  • @andresantos-gamedeveloper7117
    @andresantos-gamedeveloper7117 3 ปีที่แล้ว +3

    Dude i really like the PT-BR comment once i understand and laught a lot hahahahah and great video, please keep comming with this great content please :D

  • @CaverHTC
    @CaverHTC 4 ปีที่แล้ว +1

    Lambda expressions are awesome!

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +1

      Right? That's definitely one of my favorite features of the language.

  • @darryljf7215
    @darryljf7215 4 ปีที่แล้ว

    Ace vid.
    I’m converted. I often leave code commented out thinking I may find it useful in future.

  • @_Amilio_
    @_Amilio_ 3 ปีที่แล้ว +1

    Actually very informative. Thanks
    Also, sick rig bro 🤙

  • @christinaVennegerts
    @christinaVennegerts 3 ปีที่แล้ว

    Thank you so much for this! Your videos helped me incredibly much in learning how to write good code. I hope you're okay and will upload again in the future :)!

  • @Faygris
    @Faygris 4 ปีที่แล้ว +3

    A horror episode of a programming tutorial... Well, that's new. I love it! 😀

  • @RohanDaDev
    @RohanDaDev 2 ปีที่แล้ว

    Amazing video! One of the most informative on comments i've ever seen!

  • @revilorere
    @revilorere 2 ปีที่แล้ว +1

    This video was amazing, entertaining and informative :D

  • @ClutchGen
    @ClutchGen 3 ปีที่แล้ว

    Fantastic. Great use of Socratic Dialogue!

  • @Elenthiriel
    @Elenthiriel 3 ปีที่แล้ว

    man, i always learn a lot with your videos, thank you.
    You are awesome :D

  • @feryadidagci
    @feryadidagci 4 ปีที่แล้ว +2

    What is your opinion on using Unity tooltip attributes? It has an advantage of seeing extra information without needing to swap between code and unity, but also have all the cons you bring in this video.

  • @alekseishuvalov111
    @alekseishuvalov111 4 ปีที่แล้ว +1

    Nice video!, very useful!
    May be it's just me stupid, but took me more than half of video time to get Halloween reference!

  • @RogerValor
    @RogerValor 3 ปีที่แล้ว

    not gonna lie, this changed my mind about trying to do this when it is applicable. i still rather comment first, and delete it later tho. better to delete a comment, than avoid them.

  • @sskenth
    @sskenth 4 ปีที่แล้ว +1

    This gave me chills! Great video, really helpful too :)

  • @-_IT_-
    @-_IT_- 4 ปีที่แล้ว +4

    4:28 > this is not a less than. _weight > 100 would mean if the _weight is greater than 100.

    • @Stopa42
      @Stopa42 4 ปีที่แล้ว +1

      That error only shows how clarifying the encapsulation was.

  • @aknerkan3428
    @aknerkan3428 4 ปีที่แล้ว +2

    Thats what we need!

  • @IronFreee
    @IronFreee 3 ปีที่แล้ว

    Making readable code is great, trying to adapt to the existing code structure too, but comments don't hurt.
    Just some on top of the class to describe its purpose and how to use it, some code sections titles. Some descriptions of what functions return for or where events are fired or listened... because not everyone has the same capacity to make explicit names and events are a pain to track.
    When you come on a big project with a lot of existing code, the usual psychopath dev. team that doesn't speak and no documentation or comments, you know you are in for a good time.

  • @diliupg
    @diliupg 3 ปีที่แล้ว

    Another invaluable video. Thank You!

  • @luissolehonrubia8647
    @luissolehonrubia8647 2 ปีที่แล้ว

    Clean code fellings here.

  • @devinh.9683
    @devinh.9683 3 ปีที่แล้ว

    man this video is amazing, I love the suspense and the cliff hanger and the general story telling way of teaching ideas. This is definitely how school in the future will look like

  • @TheLateAdopter
    @TheLateAdopter 3 ปีที่แล้ว

    This was super entertaining, fun and edicational :) Love the video

  • @rod-abreu
    @rod-abreu 4 ปีที่แล้ว +1

    Hahahaha yeah, of course the last comment had to be in Portuguese, and it's full of crazy and creep stuff in there lol
    Great job Charles, your vids are awesome and funny too.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      haha glad you enjoyed it! :D

    • @rod-abreu
      @rod-abreu 4 ปีที่แล้ว

      ​@@InfallibleCode It's hilarious man, amazing!
      A cool fact is that, since years ago, when I was still in university I noticed that actually creating ways to visualize explanations or create triggers like this, helps a lot understanding and ultimately not forgetting about it later.

  • @gregoryhoward7594
    @gregoryhoward7594 3 ปีที่แล้ว

    😆 NIce. I kind of caught on early, but it is still good.

  • @DoubleM55
    @DoubleM55 3 ปีที่แล้ว

    I have to tell this every time a new junior dev comes to my team. First pull request usually gets rejected due to comments everywhere. Might as well give them link to this video.
    One of the worst case I've seen: (In a class called Customer):
    // Address of a customer
    private String address;
    // Is customer active
    private boolean active;
    And so on. It was so cluttered I barely could tell how many fields there are, and all of it by useless comments.

  • @saltyspacenerd5581
    @saltyspacenerd5581 2 ปีที่แล้ว

    Once again thanks for the great video

  • @theugobosschannel8466
    @theugobosschannel8466 2 ปีที่แล้ว

    This was very helpful

  • @kingXkeith
    @kingXkeith 4 ปีที่แล้ว +3

    Am i only one that have those same youtube recommendations as Barles? Lol

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      haha those are some great recommendations xD

  • @ibra.h
    @ibra.h 3 ปีที่แล้ว +2

    I see DevDuck in the background 👀

  • @redpyre
    @redpyre 4 ปีที่แล้ว +1

    Hey, have a question about zombie code you might be able to answer. Sometimes when I'm working on Unity scripts, I find comments of functions like in the video just appearing usually in latin, sometimes in cuniform, sometimes I don't know the character set. Whenever I try to delete it though, the window changes to a live video of a dark ethereal kind outdoors place, I hear screaming in the distance, and an eldritch creature comes up to the camera and shakes his head 'no'. Any ideas on fixes? Thanks!

  • @Norbingel
    @Norbingel 4 ปีที่แล้ว +2

    might not be the focus of the episode but 1) why refactor into auto properties and 2) why expression bodies?

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +1

      I look at this pattern of development as creating macros that expose the state of your class to itself. If any other part that class needed to know whether or not the player could jump, it would now have a quick reference!

    • @Norbingel
      @Norbingel 4 ปีที่แล้ว +1

      @@InfallibleCode thanks for the response! Already started doing this. I have comments all over the place and it's time for a change! :D

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      Nice! :D

  • @mqsd
    @mqsd 2 ปีที่แล้ว

    Best tutorial ever!

  • @pjhoodsta
    @pjhoodsta 3 ปีที่แล้ว +1

    I been wondering "despite of typing comments, have I read them again and/or understood them properly if I read? there must be better way than typing comments". Thank you. it will reduces my questionable commenting

  • @JuanPablodelaTorre
    @JuanPablodelaTorre 4 ปีที่แล้ว

    Only document your code when you are going to output generated documentation in HTML for external consumption. For everything else, stick to descriptive names.

  • @darkotomic943
    @darkotomic943 3 ปีที่แล้ว

    Good video! Btw, you did not encapsulate isGrounded and the other method.

  • @lecoq_de_lombre
    @lecoq_de_lombre ปีที่แล้ว

    To my future self, start watching from 3:48

  • @dianpratama9507
    @dianpratama9507 2 ปีที่แล้ว

    Well i am an indie game dev. Sometimes i implement new cool features/logic in a game but decide to scrap it for this game. i dont scrap it or comment it, just put it in a different functions/class and dont call them in current project.

  • @papermartin879
    @papermartin879 4 ปีที่แล้ว +5

    what's the "simple enough" % thing over functions?

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +4

      It’s a plug-in for Rider that displayed the cyclomatic complexity of your functions plugins.jetbrains.com/plugin/10395-cyclomaticcomplexity

    • @papermartin879
      @papermartin879 4 ปีที่แล้ว

      @@InfallibleCode thanks

  • @JaskanFactor
    @JaskanFactor 4 ปีที่แล้ว

    Zombie code has its uses
    1. It reminds you what you have already tried
    2. It can be a fallback if much later you find your new solution has a bug.
    I usually create a #region called history , and pack the zombie code in there, inside current context.
    I do not hesitate to delete Zombie code that am sure will never be referred to , usually means everything working tested happy ages ago.
    But without leaving a trail of solutions, for some complex stuff, you could be going round in circles not knowing what you already tried.
    Zombie code does deserve its own place, and its no problem in neat tidy code.
    I am not a supporter of this idea that you only need to make a point once in code.
    Make your intention clear with code, then say the same thing again in your comment, leaving the reader in no doubt as to your intention.
    Hence why am am very much against auto in c++ and var in C#, code is faster to write , takes much longer to understand.
    There is a reason why aviation industry worships redundancy in design.
    Coding does not come naturally to anybody especially on a bad day, that's what repeating yourself and comments are for. They are not for when the going is good.
    777 can fly just fine on one engine, but it has 2.
    If you ever try to stabilise comms between 5G network chip via uart interface on a hard real time system, you'll know what Zombie code is for.

    • @AJ213Probably
      @AJ213Probably 4 ปีที่แล้ว +1

      In this case, this is code from a repo so the zombie code still existed in previous versions of the program.

  • @ryantriyatna4713
    @ryantriyatna4713 3 ปีที่แล้ว +2

    does this take up more memory, because it uses global variables?

  • @MonsterSpooky
    @MonsterSpooky 4 ปีที่แล้ว +6

    5:30 Why do you call it auto properties? Auto properties are { get; set; }

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      This is an auto-property with an expression body getter.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +5

      Hmm looking at Microsoft's documentation now. Maybe "auto-property" isn't the correct terminology, after all. I'm seeing "getter-only property" -> docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

    • @mintesnotmelese6552
      @mintesnotmelese6552 3 ปีที่แล้ว +3

      It's Lamda expression though

  • @greglyons288
    @greglyons288 4 ปีที่แล้ว +1

    That keyboard use at 7:30 is ghastly.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +1

      lol! What's wrong with it?

    • @greglyons288
      @greglyons288 4 ปีที่แล้ว

      @@InfallibleCode
      Both hands.
      One finger peck.
      Another finger peck.
      For ctrl + s.
      Merely two keys away
      from each other.
      The home row misses you.

  • @MohammadFaizanKhanJ
    @MohammadFaizanKhanJ 4 ปีที่แล้ว

    5:48 Just found the expression bodies!

  • @JohnnySix
    @JohnnySix 3 ปีที่แล้ว

    Is your IDE converting C# Lambda => into the actual unicode rightwards double arrow symbol "⇒" ?

  • @Braneloc
    @Braneloc 4 ปีที่แล้ว +1

    Zombie code :)
    Not heard it called that before :)
    I've got a couple of zombie classes, lol. Source control isn't always the best place for unfinished stuff though.

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +2

      I like to occasionally leave TODO comments because most modern IDEs recognize them and have dedicated TODO windows.

    • @Braneloc
      @Braneloc 4 ปีที่แล้ว

      @@InfallibleCode maybe that's worth a try - never really left myself notes in the code, more this almost works remind me to finish it later. Zombification.

  • @dpereirax
    @dpereirax 2 ปีที่แล้ว

    XD good to know about zombie code!

  • @BobrLovr
    @BobrLovr 3 ปีที่แล้ว

    why are you using properties and auto properties for something you could just use fields for? Just using standard private/public fields would even be more performant?

  • @billGHH
    @billGHH 3 ปีที่แล้ว

    Hi Charles / infallible code.
    I have a question regarding some of the code and that is with the =>, is this a way of showing a pointer to a statement ? The reason for bringing this up is I am trying to figure out what the equivalent would be in C++ Visual Studio as I am writing a game engine in C++ / Visual studio, during my spare time to build a game development portfolio.

  • @krisitak
    @krisitak 3 ปีที่แล้ว

    Great video!

  • @halivudestevez2
    @halivudestevez2 2 ปีที่แล้ว

    I get back to some parts of my code after months, and weeks. Useful comments do exist.

  • @umapessoa6051
    @umapessoa6051 4 ปีที่แล้ว +11

    Hey, that comment at 6:53 is in portuguese, are you portuguese or something?

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +5

      Nah I'm actually half-Cuban. The earlier comment is in Spanish :P

    • @paulopatine
      @paulopatine 4 ปีที่แล้ว +2

      I've paused the video to read it all, not gonna lie.

    • @piratesephiroth
      @piratesephiroth 3 ปีที่แล้ว +2

      The text looks like the automated translation of random english sentences taken from horror stories (or just generated to look like that)

  • @lmaopew
    @lmaopew 8 หลายเดือนก่อน

    I sometimes rewrite my methods, hence have zombie code, just in case my new method version doesn't work or is worse. But once i decited for one of these, I delete the other

  • @Lythowastaken
    @Lythowastaken 4 ปีที่แล้ว +2

    I never developed with JetBrain Products but what are the "simple enough" annotations in ur code? Does they count the characters and lines or something in the methods to hint a potential refactor?

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว +2

      That "simple enough" annotation actually comes from a plugin called "Cyclomatic Complexity" plugins.jetbrains.com/plugin/10395-cyclomaticcomplexity

    • @Lythowastaken
      @Lythowastaken 4 ปีที่แล้ว +1

      @@InfallibleCode thanks! There is plugin for VSCode too. Looks promising.

  • @dawidmurray
    @dawidmurray 3 ปีที่แล้ว +2

    As a game programmer, we ultimately aim for fast execution in a game loop. When you start to do optimizations like this, you risk slowing execution by adding function call overhead and breaking away from thinking in a CPU context for fast execution. If you move your code too high level, then you loose low level speed benefits.

    • @JasonStorey
      @JasonStorey 3 ปีที่แล้ว +3

      I recommend you look into the compiling process, how automatic inlining and lowering works.
      Not only does the compiler drastically change your code automatically but deciding against using tools to make code more maintainable and scalable for "fast execution" you end up with projects that are hard to maintain and find bugs in.
      I would happily trade a few ms in my primary game loop for less cyberpunk 2077s. Glorifying performance without a nuanced understanding of pareto principle optimisations and technical depth costs is the cause of a lot of the problems with "game programmer" culture.

    • @liaupikhan
      @liaupikhan 2 ปีที่แล้ว +1

      You will be surprised that compiler does tons of optimization for you. Making a few code for readability is much better than optimization.
      Also premature optimization is bad, don't do it.

  • @downstream0114
    @downstream0114 4 ปีที่แล้ว +2

    Have you got a surge protector?

    • @InfallibleCode
      @InfallibleCode  4 ปีที่แล้ว

      Yup! That's why Barles' computer stayed on xD

  • @TheKr0ckeR
    @TheKr0ckeR 3 ปีที่แล้ว

    Thanks, what's your font using in this IDE?

  • @vinodkumarakula6807
    @vinodkumarakula6807 4 ปีที่แล้ว +2

    The real horror of this episode is when that guy in the ad shouts "STOP WHAT YOU ARE DOING...." :)

  • @RobertoDeMontecarlo
    @RobertoDeMontecarlo 2 ปีที่แล้ว

    Fuuuuu.... love this channel! Great class.

  • @tsukiyomi84
    @tsukiyomi84 4 ปีที่แล้ว

    Expression bodies look interesting, do you have any videos on them and their pros and cons?

    • @BobrLovr
      @BobrLovr 3 ปีที่แล้ว

      it's literally just a different syntax, easier on the eyes, and you have to press a couple less buttons

  • @googleuser4720
    @googleuser4720 3 ปีที่แล้ว

    You know encapsulating code adds a small (almost negligible amount of overhead), but greater than 0 overhead

  • @flamehiro
    @flamehiro ปีที่แล้ว

    No I do what I want!

  • @sonsai10
    @sonsai10 3 ปีที่แล้ว +1

    6:56 it's just random "evil" words in portuguese lol

  • @lifeisgameplayit
    @lifeisgameplayit 2 ปีที่แล้ว

    Amazing work , gold mmmm !

  • @MC4IOSgamer
    @MC4IOSgamer ปีที่แล้ว

    DevDuck in the background!

  • @ageis7122
    @ageis7122 4 ปีที่แล้ว +1

    I was looking for your channel for month but i forgot your name.

  • @mrdankinator4782
    @mrdankinator4782 3 ปีที่แล้ว

    sick pc! where'd u get it from?

  • @RyuRamasama
    @RyuRamasama 4 ปีที่แล้ว

    Honestly I would make assets for the Unity Asset Store but they want you to have your code commented.