Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
gustash24518yI usually do it in the end because I'm lazy. Unless I'm doing something crazy and I know I won't remember what it's for later. In that case, I comment as I code
-
zshh38538yIt depends. Try to write code which explains itself.
When ever I do put comments in my code I do it right away and then delete if I delete that piece of code as well. -
I believe it's better to do it at the end, after you have fully optimized the block of code.
-
One nice little trick I've been doing is using log lines explaining what each stage is doing. You'll need to be mindful of their levels (usually they end up at DEBUG level) but it means your app has a big old audit trail of what it is doing, should anything go wrong, and you've got descriptive lines of text throughout the code.
That and try to write your code so it's more like a sentence. English prose are easy to read. -
ZeroCubed18yWith so many projects having deadlines shifted late in the game, I comment as I go - you never know if the business willI give you the time to comment before you go live and get shuffled to another task. I tend to find PMs will cut timelines the closer we get to release to please the client.
I may take a ++minute each block up front to complete a project, but it has saved huge amounts of time down the track and given me some breathing room on the other side. -
Messer418yWe (1000+ devs on same code base) usually don't comment much. The comments you run into are similar to:
if(foo && specialCase) {
resetUser () //my_name&project - need to clear all user settings to avoid corrupt userContextObject if application will return from suspended state with same user before timing out against some but not all sub-systems (jira wsxp-1148)
}
Then during next chill period we go through the important core/engine files and see where most divergences/diffs are between projects and try to rewrite that in a better way.
Related Rants
I've always found commenting my code tedious, is it better to comment as I code or wait until its stable and then comment all in one go at the end?
undefined
comments
java