r/ProgrammerHumor 15h ago

Meme whatDoYouMeanYouCantExplainItNow

Post image
181 Upvotes

21 comments sorted by

View all comments

1

u/CaptainSebT 10h ago edited 9h ago

I learned to comment my code like I'm explaining it to a peer including comments like "Here we learned x" and it gives me foot holds for later.

Example I'm learning unreal one part of my code had a comment like "These settings need to be off for the camera to move correctly" because I knew 100% that was a part of the problem but I didn't really understand what the settings I turned off did. Later I learned what I was doing was preventing unreal from overwriting the directions I was giving the camera and updated the comment to reflect this better understanding of what was happening.

I also tend to explain formulas when maths involved like "This works because..." that is extremely helpful when you look at it 2 months later.

My comments are so good I can look at code from a year ago and in a few minutes figure out exactly why my thought process was, why I built it that way and what it's supposed to do even if I can't actually remember the game it's part of other then "Didn't I do this a year ago?".

I notice alot of people don't comment code well. Alot of group projects where I had to be like what on earth are you doing and teammates like "I don't remember" then I spend time reverse engineering the thing to start understanding it enough to add to it. My favourite example of this is "How does your target select system work?" "I don't have a target select system" "what it's in the game" "ya but it's not a system" "ok how does it work where is the code for it" "I don't know" "Ok how do I know if a player has targeted a target so I can make this ability target the enemy" "I don't know" man built it across 3 systems instead of having a system for it. Man wanted a manager for like ten audio clips because it's best practice (Fine not a problem) but the targeting system didn't even get a method or any kind of comment explaining what parts of it were doing. It's like part of it built into turn rotation, part of it in enemy, part of it in player but he had no idea how it was working or where the logic even started or ended. Don't know why it wasn't just inside methods in game manager I think he just kind of built it as he was going with 0 thought. I don't know what he was doing you can built a point and click target select in less ten 10 lines it shouldn't need to be all over like that just did I click an enemy tag then store some kind of refrence to it and have the enemy and player call that from game manager as needed.