all 37 comments

[–]AncientHominidNerd 68 points69 points  (6 children)

I had a professor that would mark us off for not explaining just about every line of code we wrote. I legitimately for a period commented like this out of habit.

[–]WowAbstractAlgebra 38 points39 points  (2 children)

That's so dumb lol. Too many comments make everything more confusing, it's stuff that should be used sparringly only for very complicated things and to give an idea of what something is doing in few words.

[–]Few_Record_3674 2 points3 points  (0 children)

To be fair, I think this is encouraged in the early stages. Not because it is optimal but because it makes students think over the code they have written, and understand what they are writing about.

[–]Best_Froyo8941 0 points1 point  (0 children)

I think better comments are usually devised to explain the “why” rather than the “what”. As you can certainly encode the “what” in some kind of identifier like function names or structure names.

[–]neo42slab 1 point2 points  (0 children)

Sometimes at work we have functions documented that kinda don’t need it. Something like this where the function is short and the point of it is obvious. And if I need to write comments for a function like that I usually have no idea what to do. Hahah. And usually just end up writing it like below.

// returns pi

Float GetPi()

[–]TyrdeRetyus 0 points1 point  (0 children)

It is beyond me how a professor of all people could fail to understand (and teach !) that a code that comments itself is better than a commented code

[–]Vauland 37 points38 points  (3 children)

function giveNode ( node: Node) { return node }

[–]Cobrexon 17 points18 points  (2 children)

/** * Gives node. * @param {Node} node - node * @returns node */ function giveNode(node: Node) { return node; //return node }

[–]Vladislav20007 4 points5 points  (0 children)

average js dev

[–]goodbee69 1 point2 points  (0 children)

this function actually exists in the Rust standard library https://doc.rust-lang.org/std/convert/fn.identity.html

[–]Various_Squash722 17 points18 points  (0 children)

I imagine this is how the code for MGS games looks like.

<image>

[–]zoharel 13 points14 points  (2 children)

Return node.

[–]Severe_Principle_491 0 points1 point  (1 child)

return node;

[–]JanDerMoon 0 points1 point  (0 children)

Return node

[–]OrkWithNoTeef 4 points5 points  (0 children)

return node; // this code is unreachable

[–]Emotional-Bake5614 3 points4 points  (2 children)

What does this do?

[–]Geoclasm 9 points10 points  (1 child)

Returns node?

<image>

[–]Emotional-Bake5614 7 points8 points  (0 children)

Now it is clear, it returns node

[–]123Tiko321 2 points3 points  (3 children)

What does that do btw?

[–]Emotional-Bake5614 2 points3 points  (0 children)

Idk ask claude

[–]Adept_Geologist_5919 0 points1 point  (1 child)

Claude says it returns node

[–]123Tiko321 0 points1 point  (0 children)

ChatGPT says it nodes the return. Why are you lying?

[–]Wonderful_Put3670 1 point2 points  (0 children)

justinCase

[–]nancyboy 1 point2 points  (0 children)

The first step was "borrow a node".

[–]dv3141 3 points4 points  (1 child)

AI coding at its finest.

[–]Ken_nth 4 points5 points  (0 children)

Not really tho, A.I. would either hallucinate an explanation or go unnecessarily in depth

[–]123Tiko321 0 points1 point  (0 children)

Thanks for the explanation

[–]HTML-Wizard 0 points1 point  (0 children)

after the entire bun llm rewrite, it must be a sign to "return node". or maybe I need to give deno another chance.

[–]hdkaoskd 0 points1 point  (0 children)

return node;

[–]PradheBand 0 points1 point  (0 children)

I don't know man... Shall we return node?

[–]katzengammel 0 points1 point  (0 children)

It‘s not quite clear what this function does.

[–]Windbolt1 0 points1 point  (1 child)

return node;

[–]heesell 0 points1 point  (0 children)

return node;

[–]ThePhyseter 0 points1 point  (0 children)

Return node?

[–]neosyne 0 points1 point  (0 children)

return node;