I write from time to time.
Views expressed are my own and may not represent the opinions of any entity with which I have been, am now, or will be affiliated.
The idea is to make verbose code, it’s the main difference I observe in programmers relative to their experience level.
Novices tend to make messy complex code riddled with or needing comments & experienced programmers make simple/short code that uses sane naming and formatting so comments become pointless.
Correct if I’m wrong please, I feel like I would need that lesson. :D
Good names help make it easier to understand what the code is doing compared to using variables like a and b and method names like my_func1 but it doesn't explain things like "why you wrote the code", "how it's intended to be used", etc.
Some devs might end up with this idea that as long as they write clean beautiful verbose code, comments won't be needed.
I would have to disagree, intent and why' can be conveyed.
It requires extra thought tho, which is what the quote is trying to encourage.
It's not meant to be taken literally.
Take fx.
// I'm gonna assume this is the unix cat command maybe?// I have no idea what data is.. this could be anything.functioncat(data){...}// Gonna assume this returns a Cat embedded in the inputfunctiongetCat(from){...}// Gonna assume this generate's a new cat from the inputfunctiongenerateCat(from){...}// My comments make sense here btw. :)// Since i am actually commenting' on my' thoughts.// Not what is going on in the code.
The intent is conveyed using verbs and subjects.
This communicates the message or intent shorter, usually meaning better.
The subjects i should know what is based on context and documentation.
The quote "If I had more time, I would have written a shorter letter." - Someone
Fully encompasses the idea.
I'l flip through you article now, thank you for taking the time to write it. :)
// Edit, ps, worth noting, with types, the verbosity and intent here could be much improved.
"Good code doesn't need comments"
Could you explain a bit more your thought?
Writing code is like making a joke. It's bad if you need to explain.
If a joke was used as the basis for entire industries, I'd sure as heck want a explanation.
Tell me about it.
Good code shouldn't need a code to describe what it's doing, but it certainly benefits from intent-comments ("why").
That is good advice. I should be able to look at the function names and variables and get a good idea of what is happening without comments.
Wait, what? why is that bad advice? :)
The idea is to make verbose code, it’s the main difference I observe in programmers relative to their experience level.
Novices tend to make messy complex code riddled with or needing comments & experienced programmers make simple/short code that uses sane naming and formatting so comments become pointless.
Correct if I’m wrong please, I feel like I would need that lesson. :D
Good names help make it easier to understand what the code is doing compared to using variables like
a
andb
and method names likemy_func1
but it doesn't explain things like "why you wrote the code", "how it's intended to be used", etc.Some devs might end up with this idea that as long as they write clean beautiful verbose code, comments won't be needed.
I've written a post about comments to clarify my position on comments.
I would have to disagree, intent and why' can be conveyed.
It requires extra thought tho, which is what the quote is trying to encourage.
It's not meant to be taken literally.
Take fx.
The intent is conveyed using verbs and subjects.
This communicates the message or intent shorter, usually meaning better.
The subjects i should know what is based on context and documentation.
The quote "If I had more time, I would have written a shorter letter." - Someone
Fully encompasses the idea.
I'l flip through you article now, thank you for taking the time to write it. :)
// Edit, ps, worth noting, with types, the verbosity and intent here could be much improved.
Woah! One of the worse advices I have seen on this thread a nightmare even for junior devs/admins haha!