I am trying to make my code understandable to future readers.
I've always had problems with how to write comments in if if comments to make it the most understandable.
It may seem trivial, but this is what has always bothered me
Here is an example:
if ( !$request ) { $request = $_SERVER['REQUEST_URI']; }
Somehow I can think of commenting on it
// If request doesn't exist if ( !$request ) { // Set request to current request_uri $request = $_SERVER['REQUEST_URI']; } // Check for a request if ( !$request ) { $request = $_SERVER['REQUEST_URI']; } // Request doesn't exist if ( !$request ) { // Set request $request = $_SERVER['REQUEST_URI']; }
Not the best example, but the way I see him is the endless ways of saying it.
I have never worked on a team, so I do not have much experience in other people reading my code.
What are your impressions of the best way to use the word to make it available to future coders.
language-agnostic comments
Galen
source share