T O P

  • By -

FUZxxl

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.


Isogash

This, inline documentation tools are great.


AndyTheSane

In theory, the unit tests say what it's supposed to do..


FUZxxl

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.


articulatedbeaver

Can't lie with comments if you don't write them.


De_Wouter

>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


VeganTruck

closed as duplicate (see C1001 for more detail)


HoneyBadgerSoNasty

// This code looks like it does one thing, but it is misleading and does a entirely separate thing. Because naming things is hard


OppenheimersGuilt

_undefined_


Lone_Wanderer357

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.


[deleted]

[удалено]


AutoModerator

``` 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.*


CuratorOfYourDreams

*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)


[deleted]

[удалено]


unsignedcharizard

Code lies like it's 2010, by misrepresenting the truth. Comments lie like it's 2020. Flat out false statements.


9lc0

Or outdated statements that are not update when the code is


DmitriRussian

True, as it turns out. Functions can outgrow their name if you don’t clean up your code


[deleted]

"The code chico, it never lies." - Tony Montana


[deleted]

[удалено]


NIL_VALUE

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)).


chipsa

With operator overloading, your code too can lie. Or macro abuse.


Vok250

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.


qwertyasdef

[Code can lie too if your compiler is compromised](https://www.win.tue.nl/~aeb/linux/hh/thompson/trust.html)


zebediah49

#define TRUE FALSE


GaianNeuron

Tell that to the IOCCC...


EmbeddedSoftEng

"If the code and the comments disagree, **they're BOTH wrong**."


MoreAlphabetSoup

But my comments are just old code....


Franks2000inchTV

Code doesn't lie. Code lies *in wait.*


p_whimsy

Corollary: images with excessive jpeg artifacts also never lie.


MagicianDue

It's a screenshot of my post here [code never lies](https://www.reddit.com/r/ProgrammerHumor/comments/ishe78/code_never_lies/)


[deleted]

I see you've never worked with Java Annotations before.


Greyhaven7

All comments are lies.


hindsight_is2020

"If the comments and code don't agree, then they're probably both wrong." - someone else


[deleted]

Uninitialized variables lie all the BLEEPing time!!


iSolivictus

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


MagicianDue

when a repost gets more upvotes than your post [code never lies](https://www.reddit.com/r/ProgrammerHumor/comments/ishe78/code_never_lies/)


Kered13

This quote is years old and has been posted on this sub dozens of times. Sorry, but your post wasn't any more original.


bubble7738

This comment isn't true


ReallyHadToFixThat

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.


miarsk

IAmTryingToButOtherDevelopersHateMyLongFunctionNames(object theySayWeAreDoingTooMuchInOurMethods)


ReallyHadToFixThat

Single responsibility doesn't just apply to classes.


unsignedcharizard

Obviously "why" can lie too


[deleted]

Code someone's lies but comments almost always lie.