BinaryByter
There is self-documented code
depending on how fucked up the thing you do is
Mat
That's the only way to have a proper documentation. Good code and good tests/examples through BDD
Dima
I always laugh at people who say “you don’t need documentation for a well-written code” > the most terrible lies of all time
I_Interface
code can do this as well
cmon, make a fast refactoring without documentation
BinaryByter
code can do this as well
I doubt that yoi have written asm so far then
klimi
BinaryByter
I doubt that yoi have written asm so far then
and yes - it applies to higher level code
Wim
For people claiming you don't need comments, we should create a C/C++ Hobbyist group, for te ones that do understand why, create a C/C++ Pro group
Wim
Where?
Wim
😂 The AskMe group?
klimi
its private
BinaryByter
joel
it's easier to understand code when there are comments
Wim
Oh now I know why that group often is so silent 😂
joel
only the person who developed the code can understand code w/0 comments
Raul
Then that person has written bad code
Wim
only the person who developed the code can understand code w/0 comments
And often fucks up when needing to work on it later because he forgot half of it
I_Interface
guys, not all of us writing a good and readable code, better for u if another man will write comments for code
Anonymous
only the person who developed the code can understand code w/0 comments
Yaa, for others its gonna take a lot time to understand the code. So it's better to write comments, and in exams and places it's mandatory to write comments😂
Raul
int add(int a, int b) { return a + b; } int main() { int x = 1; int y = 2; int z = add(x,y); std::cout << z << std::endl; }
Raul
What isn't readable about that?
BinaryByter
here to those who say that comments are bad. wim, look away, dunt wanna cringe ya out 😝
I_Interface
What isn't readable about that?
too much space for a simple func
klimi
too much space for a simple func
yeah find only bad things
klimi
whatever
klimi
have fun guys...
BinaryByter
Still, you're taking over a bit of my style 😉
I dont see why you'd think that 😂😂😂😂😂😂
joel
it's because this code is short so u dont see it
Anonymous
yeah find only bad things
Find a problem, problem finer
Anonymous
Comment as necessary
BinaryByter
Anonymous
But don't flood with comments
BinaryByter
joel
good variable names, my friend. Use them
my point is comments are important
Anonymous
But languages like assembly must need well documentation
Wim
i can agree with you
Then again, they won't harm anyone so if it has use, don't wine about it
Raul
it's because this code is short so u dont see it
writing good codes, means beginning habits of writing good code. Write good variable names. int add is very straight forward rather than int doSomethingWithTheseVariables
joel
whether good var names or not
Anonymous
good variable names, my friend. Use them
Just check the programming used for windows. It contains more 1000 k of lines of code, even if u have good variable name it's difficult to understand what's happening and leads to confusion🤷‍♂
BinaryByter
joel
😂😂
Raul
Comments are useful if you have convoluted, or rather confusing implementations.
Anonymous
Code don't lie , but comments do
BinaryByter
Anonymous
yes, but not always
Yes not always, like one we saw above
BinaryByter
yea
Raul
Right, but if you are doing something with a variable, does it really kill you to do something like std::vector<int> modifiedVector = modifyVector(modifiedVector); or is it better to do: std::vector<int> x = func2(x); Then have to comment what x and what func2 do?
Anonymous
Don't just copy paste, learn something;
This one doesn't even need a single comment to understand, but flooded with comments to make the copy paster understand what's going on
Anonymous
Anonymous
Conclusion, Big and complex prg require comments Simple prg doesn't....
joel
even if it takes 100 years and i come back to the code i'll understand what it means
Anonymous
PIE
Apple pie or ?
Raul
So you would rather add: /* this function modifies a vector by rotating the elements positions by 1 */ void func2(std::vector<int> &x) rather than actually state what the function does? That is bad coding practice. Naming is key to writing good, readable, code.
Raul
I would rather write: void rotateVecBy1(std::vector<int> &toRotate)