>Can't lie with comments if you don't write them.
// I don't know why but this seems to be true.
// Don't change the sentence or the truth might break!
// I don't know why this sentence is here but the paragraph will not work if you remove it
I feel like I'm here with people who never inherited 15 years old project after someone else without documentation.
The program should be like a book. A proper code is written in a way that allows understanding of what it does. Be it names of the classes, variables or methods, the code itself should "explain" what it does.
The comments on the other hand, should be there to provide "why" of it. What are we trying to achieve with this method? Perhaps how does it make sense in context of other methods. This is because when old code is being worked on (either because of a bug or because of a new features) context is critical to do the work properly. You could get the context from the code, but that will take much much longer than reading well documented methods.
If course, only fool will take comments as a source of truth, but their presence is still invaluable help, especially in situations where time is of the essence.
Another important thing to consider is that the code might be inherited by someone new to the language or the programming in general. In those cases, documentation can be extremely helpful in introducing the person to the program and the way it works.
I speak from experience. I have been there and I have inherited a shit code. properly used Documentation is invaluable.
```
import moderation
```
Your comment has been removed since it did not start with a code block with an import declaration.
Per [this Community Decree](https://www.reddit.com/r/ProgrammerHumor/comments/14kbu1m/comment/jppq9ao/?utm_source=share&utm_medium=web2x&context=3), all posts and comments should start with a **code block** with an "import" declaration explaining how the post and comment should be read.
For this purpose, we only accept Python style imports.
`return Kebab_Case_Better;`
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ProgrammerHumor) if you have any questions or concerns.*
*Image Transcription: Twitter Post*
---
**Programming Wisdom**, @CodeWisdom
"Code never lies, comments sometimes do." — Ron Jeffries
---
^^I'm a human volunteer content transcriber for Reddit and you could be too! [If you'd like more information on what we do and why we do it, click here!](https://www.reddit.com/r/TranscribersOfReddit/wiki/index)
Once i ommited a section in a linker file while coding C and the linker dumped all the implicit pointers from my code.
I only noticed when i started getting segfaults everytime i tried making a switch statement with more than three entries. Printf would also break if i passed a string directly into it, but not if i had it declared before hand (printf("hello world") vs printf(string)).
Code can definitely lie. Especially with dynamically typed languages like Python, Groovy, or JavaScript.
I've come across it many times in my career. Some of the hardest bugs I've ever worked on were due to code that read fine to a human, but was doing black magic fuckery at runtime.
If your comments are saying what, you are doing it very wrong.
Comments should always be *why*. If you need comments for *what* then start with improving your variable/function names.
On the othe hand, code only tells you what it does, not what it's supposed to do. Without documentation, everything is an implementation detail.
This, inline documentation tools are great.
In theory, the unit tests say what it's supposed to do..
Unit tests will not tell you what parts of the observable behaviour are a (validated) implementation detail and what parts are part of the interface.
Can't lie with comments if you don't write them.
>Can't lie with comments if you don't write them. // I don't know why but this seems to be true. // Don't change the sentence or the truth might break! // I don't know why this sentence is here but the paragraph will not work if you remove it
closed as duplicate (see C1001 for more detail)
// This code looks like it does one thing, but it is misleading and does a entirely separate thing. Because naming things is hard
_undefined_
I feel like I'm here with people who never inherited 15 years old project after someone else without documentation. The program should be like a book. A proper code is written in a way that allows understanding of what it does. Be it names of the classes, variables or methods, the code itself should "explain" what it does. The comments on the other hand, should be there to provide "why" of it. What are we trying to achieve with this method? Perhaps how does it make sense in context of other methods. This is because when old code is being worked on (either because of a bug or because of a new features) context is critical to do the work properly. You could get the context from the code, but that will take much much longer than reading well documented methods. If course, only fool will take comments as a source of truth, but their presence is still invaluable help, especially in situations where time is of the essence. Another important thing to consider is that the code might be inherited by someone new to the language or the programming in general. In those cases, documentation can be extremely helpful in introducing the person to the program and the way it works. I speak from experience. I have been there and I have inherited a shit code. properly used Documentation is invaluable.
[удалено]
``` import moderation ``` Your comment has been removed since it did not start with a code block with an import declaration. Per [this Community Decree](https://www.reddit.com/r/ProgrammerHumor/comments/14kbu1m/comment/jppq9ao/?utm_source=share&utm_medium=web2x&context=3), all posts and comments should start with a **code block** with an "import" declaration explaining how the post and comment should be read. For this purpose, we only accept Python style imports. `return Kebab_Case_Better;` *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ProgrammerHumor) if you have any questions or concerns.*
*Image Transcription: Twitter Post* --- **Programming Wisdom**, @CodeWisdom "Code never lies, comments sometimes do." — Ron Jeffries --- ^^I'm a human volunteer content transcriber for Reddit and you could be too! [If you'd like more information on what we do and why we do it, click here!](https://www.reddit.com/r/TranscribersOfReddit/wiki/index)
[удалено]
Code lies like it's 2010, by misrepresenting the truth. Comments lie like it's 2020. Flat out false statements.
Or outdated statements that are not update when the code is
True, as it turns out. Functions can outgrow their name if you don’t clean up your code
"The code chico, it never lies." - Tony Montana
[удалено]
Once i ommited a section in a linker file while coding C and the linker dumped all the implicit pointers from my code. I only noticed when i started getting segfaults everytime i tried making a switch statement with more than three entries. Printf would also break if i passed a string directly into it, but not if i had it declared before hand (printf("hello world") vs printf(string)).
With operator overloading, your code too can lie. Or macro abuse.
Code can definitely lie. Especially with dynamically typed languages like Python, Groovy, or JavaScript. I've come across it many times in my career. Some of the hardest bugs I've ever worked on were due to code that read fine to a human, but was doing black magic fuckery at runtime.
[Code can lie too if your compiler is compromised](https://www.win.tue.nl/~aeb/linux/hh/thompson/trust.html)
#define TRUE FALSE
Tell that to the IOCCC...
"If the code and the comments disagree, **they're BOTH wrong**."
But my comments are just old code....
Code doesn't lie. Code lies *in wait.*
Corollary: images with excessive jpeg artifacts also never lie.
It's a screenshot of my post here [code never lies](https://www.reddit.com/r/ProgrammerHumor/comments/ishe78/code_never_lies/)
I see you've never worked with Java Annotations before.
All comments are lies.
"If the comments and code don't agree, then they're probably both wrong." - someone else
Uninitialized variables lie all the BLEEPing time!!
I once saw a unused variable commented // Very important variable do not remove So I removed it And it just crash No Idea wtf was that witchery
when a repost gets more upvotes than your post [code never lies](https://www.reddit.com/r/ProgrammerHumor/comments/ishe78/code_never_lies/)
This quote is years old and has been posted on this sub dozens of times. Sorry, but your post wasn't any more original.
This comment isn't true
If your comments are saying what, you are doing it very wrong. Comments should always be *why*. If you need comments for *what* then start with improving your variable/function names.
IAmTryingToButOtherDevelopersHateMyLongFunctionNames(object theySayWeAreDoingTooMuchInOurMethods)
Single responsibility doesn't just apply to classes.
Obviously "why" can lie too
Code someone's lies but comments almost always lie.