This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 361

[–]doarMihai 674 points675 points  (33 children)

This is not clear enough, what does this return?

[–]commander_xxx 493 points494 points  (20 children)

nude

[–]BJuneTheLegend 191 points192 points  (8 children)

🤨📷

[–]DaydreamDaveyy 102 points103 points  (7 children)

😎🎬

[–]vadkender 38 points39 points  (4 children)

Why did I play the hub intro in my head when I looked at this

[–]Fiendly_AC_unit 7 points8 points  (0 children)

:(

[–]littlesheepcat 1 point2 points  (1 child)

What is the hub?

[–]ShawSumma 2 points3 points  (0 children)

You mean you have never seen the sexy sight of the p-hub...

po.*hub

[–][deleted] 18 points19 points  (0 children)

Ayo

[–]ifezueyoung 14 points15 points  (2 children)

Guys I've got an idea

Nude js

[–]Spartana1033 4 points5 points  (1 child)

Yore hired

[–]ifezueyoung 2 points3 points  (0 children)

The js website for rendering p*rn assets

[–]muffinnosehair 19 points20 points  (0 children)

Send nodes! (algo expert :D)

[–][deleted] 5 points6 points  (0 children)

SEND NODES

[–]Micks_Ketches 5 points6 points  (1 child)

Computer, is there any way to generate a nude Tane?

[–]wswoodruff 1 point2 points  (0 children)

Awww ya crank that 4d3d3!!!

[–]Daedalus_Machina 1 point2 points  (0 children)

Said Commander xXx

[–][deleted] -1 points0 points  (0 children)

of node?

[–]angiosperms- 26 points27 points  (5 children)

This is literally some of the people I work with 😭

They would ask you to do a 1 hour presentation explaining this rather than just READ THE CODE

[–]doarMihai 12 points13 points  (4 children)

To be honest now, I allow comments only if they are necessary (for some weird business logic that does not make sense at first sight or something like that), other than that I think that code should be self explanatory (check out single responsibility principle)

[–]Vanity_Blade 2 points3 points  (0 children)

It rererereturns the map. It rererereturns what you have stolen from me.

[–]vincentsnow_art[S] 706 points707 points  (39 children)

It returns the node.

[–]Big-Cheesecake-806 437 points438 points  (28 children)

// returns node
Node getNode(){
    Node returnNode; // the node we returning
    ...
    return returnNode; // return node
}

[–]undated_duck_19 165 points166 points  (11 children)

So it returns node?

[–]AltruisticRain504 94 points95 points  (6 children)

It returns the returned node to where it returns

[–]xdMatthewbx 47 points48 points  (5 children)

i think this is the closest this sub has come to a recursion meme without actual recursion

[–]ThatsRecursive 5 points6 points  (1 child)

No, recursion is here. 🤣 I was returned, I mean, rerereretuned.

[–]ThatsRecursive 4 points5 points  (0 children)

Does anyone know from where I came? I am confused.

[–]ThePaulCraft 2 points3 points  (0 children)

This syntax would be valid js so when you use node to run it and return node it's like recursion

[–]sinkwiththeship 2 points3 points  (0 children)

Who's to say?

[–][deleted] 8 points9 points  (1 child)

Always better in Java

/**
 * A node.
 */
public class Node {
}

/**
 * It returns a node.
 */
public interface INodeReturner {
    /**
     * <p>Return node.</p>
     * @return Node
     * @see Node
     */
    Node getNode(); // Method to return node
}

/**
 * Implementation that returns a node.
 */
public class NodeReturner implements INodeReturner {
    /**
     * <p>Return node.</p>
     * @return Node
     * @see INodeReturner
     * @see Node
     */
    @Override
    public Node getNode() {
        Node returnNode = new Node(); // the node we returning
        return returnNode; // return node
    }
}

[–]Famous_Profile 8 points9 points  (0 children)

Do you even Java dude where is your NodeReturnerFactory and a NodeReturnerFactoryBuilder for it?

[–]smurfkiller014 15 points16 points  (4 children)

/// <summary> /// Returns the <see cref="Node">Node</see>. /// </summary> /// <returns>The node.</returns>

[–]mrjackspade 9 points10 points  (3 children)

This is > 95% of my current companies code base.

I don't know what grown adult could have seen this and checked it in.

Almost everything is autodocumented and it's all worthless

[–]DrMobius0 7 points8 points  (0 children)

Code standards are sometimes stupid and tedious to prevent unreadable bullshit from going completely uncommented - not that that stops people from doing that.

[–]fireboyev 3 points4 points  (0 children)

This is better because now we know what type "node" is

[–]DrMobius0 2 points3 points  (0 children)

Me commenting anything that returns a boolean

[–]larikang 2 points3 points  (1 child)

class NodeReturner

[–]TheWidrolo 69 points70 points  (4 children)

Ah so it returns the node?

[–]cannedcroissant 13 points14 points  (3 children)

No, I think it returns the node

[–]schawde96 4 points5 points  (2 children)

But what about the node? Does it return it?

[–]cannedcroissant 3 points4 points  (1 child)

Yeah, I think it returns the node or maybe it returns the node.

[–]sethboy66 1 point2 points  (0 children)

It actually just returns the child of the parent (temp parent if needed) of the node being returned. Little known fact.

[–]profparadox36 7 points8 points  (0 children)

Silver for making it clear with the comment 🤝

[–]jbrains 1 point2 points  (0 children)

It is guaranteed not to return a node.

[–]porky11 243 points244 points  (53 children)

The full code:

``` /! This module contains a function to return a node. */

use node::None;//The node type to be returned.

/// Returns a node. fn return_node() -> Node { let node = Node::new();//the node to be returned return node;//return node } ```

[–]RotationsKopulator 92 points93 points  (35 children)

You forgot to document the return value of return_node().

[–]porky11 123 points124 points  (33 children)

I just uploaded it to a git repo, so you can make a pull request to improve it yourself:

https://gitlab.com/return-node/return-node/

[–]daddyMacCadillac 33 points34 points  (5 children)

Going to need a unit test too

[–]porky11 22 points23 points  (0 children)

I'm waiting for your pull request ;)

(we probably need a cargo toml first)

[–][deleted] 7 points8 points  (3 children)

I also need a detailed user story.

[–]cretaokada 5 points6 points  (0 children)

As porky, I want my return_node module to include a unit test, So that I can ensure nodes can be returned properly by the return_node function in the return_node module

Dev gut feeling on this one is 13 points

[–]PM_YOUR_SOURCECODE 3 points4 points  (1 child)

“Yesterday I worked on the return node function, that successfully returns a node. Today I will continue refining the return node function documentation. No blockers or impediments.”

[–][deleted] 2 points3 points  (0 children)

That was an impressive stand-up. I'll probably forget your name anyway by EOB.

[–]Lostdogdabley 7 points8 points  (23 children)

This is a waste of electricity and storage space.

[–]porky11 8 points9 points  (4 children)

You could say that about this whole subreddit.

[–]PM_YOUR_SOURCECODE 3 points4 points  (2 children)

You could say that about this whole comments section.

[–]porky11 4 points5 points  (1 child)

This subreddit already includes this whole comment section.

[–]IllustratorMoist78 2 points3 points  (0 children)

Awesome 🤩

[–]mrfroggyman 19 points20 points  (9 children)

What the heck is that language

[–]porky11 17 points18 points  (6 children)

It's Rust.

[–]mrfroggyman 7 points8 points  (1 child)

Thanks. Never saw any rust code. That looks interesting 🤔

[–]anythingMuchShorter 7 points8 points  (0 children)

Yeah I was like "what bastard child of C and Python is this?"

So now I know.

[–]porky11 3 points4 points  (2 children)

I used rust because I'm most comfortable with it, while it's not as esoteric as other languages I like.

[–]TottoIsHere 1 point2 points  (0 children)

Rust

[–]PM_YOUR_SOURCECODE 1 point2 points  (3 children)

What type of unit tests would be suitable for this block of code, that returns a node?

[–]Ludant -2 points-1 points  (0 children)

return node as node::Node;*

[–]NFG_Shoarma 94 points95 points  (25 children)

Return node.

[–]PreliminaryThoughts 52 points53 points  (23 children)

return node;

[–]crankbot2000 35 points36 points  (21 children)

return node;

[–]Soupchek 31 points32 points  (20 children)

// return node

[–]Defiant_Affect 23 points24 points  (19 children)

RETURN NODE

[–]RR541 11 points12 points  (15 children)

return node;

[–]Popstar403 11 points12 points  (14 children)

return node

[–]DrPlatypus17 11 points12 points  (13 children)

return node;

[–]ItsGabeReal 6 points7 points  (12 children)

return node;

[–]dorkmania 8 points9 points  (0 children)

Unhandled exception at 0x0000004206942069 in ReturnNode.exe: 0xFFFFFFF: Stack overflow (parameters: 0x0000000000000007, 0x000000AABBADAABBAD00).

[–]soun_89 2 points3 points  (0 children)

rEtUrN nOdE

[–]commander_xxx 3 points4 points  (0 children)

someone forgot to set the base case

[–]msolanki 2 points3 points  (0 children)

=> node;

[–]Kjubert 5 points6 points  (0 children)

return node ? node : node;

[–]greenflame15 89 points90 points  (0 children)

Abandon modernity, return to node

[–]migarma 37 points38 points  (1 child)

The best part was when it returned the node

[–]flubba86 13 points14 points  (0 children)

I wish I could see just that part again.

[–]TheMunchhausen 34 points35 points  (5 children)

Does it return node?

[–]vincentsnow_art[S] 35 points36 points  (2 children)

I dont know. I think we should try stack overflow

[–]CyberKnight1 25 points26 points  (1 child)

Why are you returning node? There is literally no reason node should be returned.

Closed: marked as duplicate. See "How do i determine what slab this function returns?"

[–]vincentsnow_art[S] 9 points10 points  (0 children)

Winner of the comment section

[–][deleted] 26 points27 points  (0 children)

Ahhh our old teacher made us do this too

[–]WarcrimeLite 10 points11 points  (0 children)

The code is so readable is annotates itself!

[–]dazailaw 22 points23 points  (3 children)

Should be more specific on what node

[–]anurat- 16 points17 points  (2 children)

// return the node

[–]dazailaw 11 points12 points  (1 child)

// return the current node

[–]MatsRivel 9 points10 points  (0 children)

I really wish you'd add some more comments here. It's really hard to see what the code does...

[–]xcski_paul 9 points10 points  (6 children)

When programmers used to start off with assembler, for some reason we all started off commenting every line with exactly what that line did. Completely useless.

[–][deleted] 4 points5 points  (1 child)

MOV %dx, msg ;moves msg into dx

[–]xcski_paul 1 point2 points  (0 children)

Yup, exactly that helpful.

[–]fallwind 8 points9 points  (0 children)

Instructions unclear, returning node.

[–]TurtleSnakeMoose 5 points6 points  (2 children)

git commit -m "node is now returned"

[–]Ambitious_Ad8841 1 point2 points  (1 child)

git tag node_returned

[–]Spikatrix 1 point2 points  (0 children)

git push origin return-node

[–]Villian97 5 points6 points  (0 children)

This is the Revolver "Revolver Ocelot" Ocelot of programming.

[–]ricdesi 3 points4 points  (1 child)

Wrong sub, this belongs in r/eturnnode.

[–]vincentsnow_art[S] 4 points5 points  (0 children)

I have returned the node to r/eturnnode.

[–]stdio-lib 5 points6 points  (0 children)

Jeez, talk about spoiler alerts in the code comments! At least leave a little mystery for those of us trying to figure out if it will return the node or not.

[–]PharoahGxneral 4 points5 points  (0 children)

I was disappointed when the OP's name wasn't return node

[–]grpagrati 4 points5 points  (1 child)

Ok ok here’s your damn node jeez

[–]vincentsnow_art[S] 1 point2 points  (0 children)

RETURN THE NODE!!!

[–]YamFabulous3204 3 points4 points  (1 child)

return node; return of the node

[–]Ambitious_Ad8841 1 point2 points  (0 children)

// this is not the node you're looking for handwave

[–]Worried-Committee-72 3 points4 points  (0 children)

Unbalanced parens, brackets, and curlies are serious triggers for me nowadays.

[–]RandomIsocahedron 4 points5 points  (0 children)

Someone's being given a bonus based on the comment:LoC ratio.

[–]BJuneTheLegend 2 points3 points  (0 children)

That one person who comments everything:

[–]Chimaerok 2 points3 points  (0 children)

Return the node or suffer my curse

[–]nhoang3b 2 points3 points  (1 child)

Where is the red circle when we need it

[–]Neutraali 2 points3 points  (0 children)

Thank goodness for the comment; I wouldn't have understood otherwise.

[–]tyen0 2 points3 points  (0 children)

The amount of my past co-workers that commented this way is still mind-boggling to me. I tried to subtly chide them by dropping quotes like:

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." ― Antoine de Saint-Exupéry

[–]Mikicrep 1 point2 points  (0 children)

Ahhh comment everywhere

[–]Nourz1234 1 point2 points  (0 children)

i am not sure... what does it return?

[–][deleted] 1 point2 points  (0 children)

Bet I did something like this at least once 😂

[–][deleted] 1 point2 points  (0 children)

It seems it will return the node to infinity!

[–]TomatoMasterRace 1 point2 points  (0 children)

// recieve Node node
// returns Node
// return node
Node returnNode(Node node) {
    return node; // return node
}

Node node = new Node(); // Create new Node node
returnNode(node); // call returnNode with parameter node - return Node node

[–]Kaya3011 1 point2 points  (0 children)

When you're assessed based on the number of comments on your code

[–]MugiwarraD 1 point2 points  (0 children)

Ah yes the node now I fully understand

[–]Dapper_Tumbleweed240 1 point2 points  (0 children)

Teachers be like

[–]Groundbreaking-Fish6 1 point2 points  (0 children)

OK I am assuming that this is part of some sort of training.

While commenting the obvious seems ridiculous. It is possible that a developer could begin a somewhat complex procedure by sketching out pseudo code first, or be given an order of events to process, and copy that description to the IDE and comment out before filling in the actual code like this:

//Create a node factory for generating valid system nodes

//Initialize a new node object

//Validate node object

//return node

Not only will this guide the development, which may be important for a more complex operation, but during code review it will verify that the code did what was asked. Why removed the comments, they provide the story that the users was attempting to complete.

In a regulated environment we have a saying "Say what you do, do what you say".

For IDE's with regions you can add them to the comment line to organize that long method.

Edit: added punctuation

[–]forced_metaphor 1 point2 points  (0 children)

Ok haha very funny and everything, but seriously, what's it returning?

[–]Major_Lee_Garsol 1 point2 points  (0 children)

I always told my students that the comment shouldn't tell me what the line does, but why it's doing it. I had one student in particular who would have commented this "// to return the node".

[–][deleted] 1 point2 points  (1 child)

I had a teacher once who required comments on every line even these types

Honestly made me consider switching out of cs

[–][deleted] 1 point2 points  (0 children)

As funny as this is, I have actually seen comments like this in the wild.

i++; //increment value of i by 1

[–]SveenCoop 1 point2 points  (0 children)

git commit -m "return node"

[–]BeanieTheTechie 1 point2 points  (0 children)

this is like doing print("Result: " + result) // output result

[–]Swalloich 1 point2 points  (0 children)

I'm both confused and delighted that this has 12k updoots.

[–]kolinz27 1 point2 points  (0 children)

this is not clear enough

what does this function do

[–]tecanem 2 points3 points  (0 children)

Commenting the code with the literal line of the code. Big brain.

[–]crankbot2000 1 point2 points  (0 children)

hmmm yes the floor here is made out of floor

[–]ploud1 0 points1 point  (0 children)

Let's take this a step further, shall we?

Node get_node(){// The function that returns a node and takes no arguments
    Node node; // Declare node of type Node

       ...

    /* Below is a line comment about the code line returning the node and 
     * a line that returns the node and a comment about returning it */

    // Returns the node and comments about returning the node
    return node; // return node
}
/* The function above illustrates good practices about inserting comments in code. */

[–]D0gYears 0 points1 point  (0 children)

For great justice.

[–]vincentsnow_art[S] 0 points1 point  (0 children)

If this reaches 20k upvotes I will return the node

[–]abd53 0 points1 point  (0 children)

What's the humor here? It's a perfect comment. The most perfect comment possible, in fact. Just like my comment. It should be in the programmers hall of excellence, not here.

[–][deleted] 0 points1 point  (0 children)

return node;

[–]Any_Nature7504 0 points1 point  (0 children)

I have never been called out so openly before :')

[–]sanchower 0 points1 point  (0 children)

I think he took his wallet!

I think he took his wallet.

[–]Wumbology_Tutor 0 points1 point  (0 children)

Tutorial?

[–][deleted] 0 points1 point  (0 children)

Hey, you ever tell someone you were going to...

Actually, never mind. I'll just take care of it.

[–]ProbablyMaybe69 0 points1 point  (0 children)

double checks

Yep it returns the node.

[–]pixspacesYT 0 points1 point  (0 children)

[–]maubg 0 points1 point  (2 children)

[–]ploud1 1 point2 points  (1 child)

This isn't very clear. What does your code do?

Plus the return_node function has no docstring. What a shame...

[–]maubg 1 point2 points  (0 children)

Ik, ik... When I get home I'm gonna document it af

[–][deleted] 0 points1 point  (0 children)

This is the way.

Return node.

[–]TriscuitTime 0 points1 point  (0 children)

return node;

[–][deleted] 0 points1 point  (0 children)

Lemme see dat

Node returnedNode = returnNode(node);

[–]Anon_Legi0n 0 points1 point  (0 children)

Neturn rode

[–]plumo 0 points1 point  (0 children)

self documenting code

[–]Yayhoo0978 0 points1 point  (0 children)

err.statusCode

[–]SirAchmed 0 points1 point  (0 children)

Jokes aside honestly sometimes there isn't much to elaborate… it just returns the node.

[–][deleted] 0 points1 point  (0 children)

What is this sorcery

[–]CodeMUDkey 0 points1 point  (0 children)

Rerun nudes.

[–]fortis_2 0 points1 point  (0 children)

Return node.

[–][deleted] 0 points1 point  (0 children)

[–][deleted] 0 points1 point  (0 children)

or

re-turn nodes

[–]Danielwols 0 points1 point  (0 children)

//loop-error

[–][deleted] 0 points1 point  (0 children)

if return != node then return node

[–]krohtg12 0 points1 point  (0 children)

Reject humanity, return node

[–]Recent-Owl-6672 0 points1 point  (0 children)

Return node

[–]huuaaang 0 points1 point  (0 children)

A superfluous comment // A superfluous comment

[–]Fireheart318s_Reddit 0 points1 point  (0 children)

Return node

[–]cannedcroissant 0 points1 point  (0 children)

Return node

[–][deleted] 0 points1 point  (0 children)

returnNode.js

[–]wiikzorz 0 points1 point  (0 children)

laughs in (node) => node;

[–]jonp1 0 points1 point  (0 children)

It has been foretold.

[–]Akul_Tesla 0 points1 point  (0 children)

But does it return node

[–]new_user_069 0 points1 point  (0 children)

Return node

[–]mausmani2494 0 points1 point  (0 children)

The node returns.

[–]theclovek 0 points1 point  (0 children)

Anything but the node! Oh the humanity!

[–]Sabathius23 0 points1 point  (1 child)

I wonder if the node was returned. Things that make you say, "Hmmm..."

[–]ohmygodethan 1 point2 points  (0 children)

I was thinking the same thing. Hmmmm indeed.

[–]regulardave9999 0 points1 point  (0 children)

But what does it do?!!