19

Unnecessary Redundant Comment:

// this get data
public void getData(Data data)
{
.......
}

Why Just Why?

Comments
  • 7
    He just wanted to document how to call this.getData()
  • 12
    Why does the comment not say it is public?!? I am totally confused now and would not be able to use that method properly.
  • 11
    Why the getter method doesn't return data?
  • 1
    @Gxost I don't know... He used void instead
  • 2
    @Gxost reference passed in parameter, I suppose.
  • 6
    Never have I ever seen a getter return void.
  • 0
  • 4
    @Gxost it clearly says in the content that this will get the data, not the caller
  • 1
    @johnmelodyme and you've actually, really, discovered this in some Codebase?
  • 2
    Well, it does get data.
  • 1
    @Ranchonyx agree that void isn't common, but in some languages heavy constructs are better built in place of the given parameter than returning by value 🤓
  • 0
  • 3
    I love that Data type. Isn’t everything basically data?
  • 3
    Useless as f*ck comment
    A void getter
    A Data type

    3 problems in 2 lines
  • 1
    I'd be more concerned not about a comment someone probably forgot to remove but about the fact that a method that's supposed to return data is passed that data as an argument...
  • 1
    Given it returns `void` and accepts a `Data` object as a parameter, I would expect this to set the data... 🤷‍♂️
  • 1
    What if the function gets the data from an api using some parameters inside the Data variable ?
  • 2
    @kiki that reminds me of
    https://javascript.info/ninja-code
    where it says:

    The ideal name for a variable is data. Use it everywhere you can. Indeed, every variable holds data, right?

    …But what to do if data is already taken? Try value, it’s also universal. After all, a variable eventually gets a value.
Add Comment