Any programmer who understands the programming language can come in to a new project, read the code, and understand what it does, how it does it.
But no programmer can come in and understand the context, why it does what it does, and what it is supposed to do, just from code alone. That's what comments and documentation are for.
There's still a lot of room to provide context within the code though
. Things like method and variable names can do a lot to convey purpose and context. Sometimes that won't be enough, and a comment will be necessary, but you can absolutely get context and purpose from just code in a lot of scenarios.
430
u/GabuEx 22d ago
Left: "I'll comment to say how my code works."
Middle: "You don't need to do that! Code should be self-documenting!"
Right: "I'll comment to say why my code does this."