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
-
I don't write comment blocks often - but when i do, they contain URLs and explanations which don't make good function names.
You can do both: Pull out the code in its own function and comment it. -
Hazarth95062ypublic void weNeedToDoThisAsAWorkaroundForTheThirdPartyServicesRetardedImplementationOfOAuth(Credentials creds) {...}
Yep, this works for me, thanks for the tip -
Always avoid comments by either extracting code into methods with descriptive names or storing intermediate results in variables with descriptive names.
-
I've been working in the jenkinsfile lately with groovy. I'm not a Java dev. I've found it helpful to have a bunch of small, well named functions, and a bunch of comments. Especially when I'm connecting to the local shell and passing bash commands
-
@Hazarth
weNeedToDoThis -- why write that? You are calling this method, so you obviously need this
asAWorkaround -- it's okay, but could be compacted without losing meaning: 'workaround'. Although I'd skip that part completely
forTheThirdPartyServices -- too many unnecessary words that do not add any value. Name the party, as the w/around is speciffic to it. 'fb'
implementationOfOauth -- might come as a surprise to you, but we are always dealing with implementations.. Why mention that explicitly? 'oauth' should be enough
fbOauth() or fbOauthHack() should be enough. Concise, provides the same info as yours [and more as it mentions the 3rd party] and as a bonus - short. If you have to explain WHY [not WHAT] you need the hack - jot it down in the javadocs, esp when it's a public method -
Hazarth95062y@netikras I mean I was joking, I only used "ThirdParty" because I wasn't currently angry at any of them, didn't wanna throw shade :D
write comment above block of code
or pull block of code out into method and work the comment into method name
question