What about adding comments for stuff like JavaDoc to extract? To me it looks bad if some methods have no comment in the documentation at all... it makes me think they have not been thorough documenting the code. When you only get the library, not the source code, this is a bad feeling to have.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
code comments
Collapse
X
-
Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishing -
I get QA emails every morning from my idiot technical lead telling me I have to put in comments, even getters have to be done so..
/**
*
* @return name
*/
public String getName(){
..
..will get me an email every morning until I change it to..
/**
* Returns the name associated with this object.
* @return name
*/
public String getName(){
Now you can see why I never took the extension they offered.Comment
-
Originally posted by DimPrawn View PostQuestion.
Do you write comprehensive code comments, thus making the job much longer (kerrching) but making it much easier for someone else to pickup the code and replace you, or write cryptic comment free code that is quick to write (no contract renewal) but no bugger can pick it up (and get called back in on a new contract)?Comment
-
Originally posted by Spacecadet View Postwhen I started programming I was taught that comments should be comprehensive enough so that if all the code was ripped out and only the comments left then it would be straight forward enough for someone to rewrite the program.
My comments vary from spartan to comprehensive depending on what its for.
I write a lot of migraiton scripts, these get run a limited number of times and usually by myself so no need for comments.
Interfaces which should survive past my contract end date get full comments
-- Headers which include version info
-- test scripts (i write SQL) so that someone debugging it already has a bunch of SQL to test the data with
-- then the body of the T-SQL has numbered comments broken down by section. These are compiled at the top for documentation purposes then repeated on the line above the piece of code they refer to
Anyone who needs to understand the stored procedure only needs to read the header and they could completely rebuild it
When writing the program I usually start with the comments, map out exactly what I want it do to, where and why then build the actual code around that.
Assuming that the code can be quite clearly read without comments (with meaningfull names etc) then don't you agree that the comments are redundant ?
Also, bugs in comments are a lot harder to spot than bugs in the code(because the compiler doesn't help you there), and it's not a functional requirement that all comments are correct so they are more likely than the code to be incorrect.Comment
-
Originally posted by minestrone View PostI get QA emails every morning from my idiot technical lead telling me I have to put in comments, even getters have to be done so..
/**
*
* @return name
*/
public String getName(){
..
..will get me an email every morning until I change it to..
/**
* Returns the name associated with this object.
* @return name
*/
public String getName(){
Now you can see why I never took the extension they offered.
I thought the goal was to write your code so it can be easily read, turning commented sections into their own self describing methods where-ever possible.Comment
-
Originally posted by minestrone View PostI get QA emails every morning from my idiot technical lead telling me I have to put in comments, even getters have to be done so..
/**
*
* @return name
*/
public String getName(){
..
..will get me an email every morning until I change it to..
/**
* Returns the name associated with this object.
* @return name
*/
public String getName(){
Now you can see why I never took the extension they offered.Comment
-
Originally posted by christhecontractor View PostThat's interesting because it's the opposite of the philosophy that the code is self commented by meaningfull variable and function names.
Assuming that the code can be quite clearly read without comments (with meaningfull names etc) then don't you agree that the comments are redundant ?
Also, bugs in comments are a lot harder to spot than bugs in the code(because the compiler doesn't help you there), and it's not a functional requirement that all comments are correct so they are more likely than the code to be incorrect.
Only one slight problem - almost no b*gger writes code like this+50 Xeno Geek Points
Come back Toolpusher, scotspine, Voodooflux.Pogle
As for the rest of you - DILLIGAF
Purveyor of fine quality smut since 2005
CUK Olympic University Challenge Champions 2010/2012Comment
-
Originally posted by christhecontractor View PostThat's interesting because it's the opposite of the philosophy that the code is self commented by meaningfull variable and function names.
Also meaningful function and variable names will only get you so far, at some point you will need to do some fairly complex logic, recursion, loops or string manipulation which need notes
Originally posted by christhecontractor View PostAssuming that the code can be quite clearly read without comments (with meaningfull names etc) then don't you agree that the comments are redundant ?
Originally posted by christhecontractor View PostAlso, bugs in comments are a lot harder to spot than bugs in the code(because the compiler doesn't help you there), and it's not a functional requirement that all comments are correct so they are more likely than the code to be incorrect.
Comments can become out of date very quickly if not maintained with the code, however this doesn't mean that well written comments can't complement a well written program.
The real problems only start when a junior programmer starts work on it and neglects/can't be arsed to maintain the comments, then someone else needs to debuig those changes and junior "i don't need comments" programmer has done half a job.
All it takes is a bit of disciplineCoffee's for closersComment
-
Originally posted by NotAllThere View PostI recall years ago being told of a program written in assembler, that was hugely complicated, and stopped working. The developer responsible was on holiday, and couldn't be reached - no mobile phones in those day. The other programmers tried to work out what it was doing, and how to fix it, but there was only one comment, "BOH", at line 1066. This being the only place commented, it was felt this must be the important part of the code. But they couldn't work it out. They had to resort to some kind of manual workaround.
When the developer returned from holiday - to very black looks - he was asked about the comment.
"Oh", he said, "that's easy. 1066 Battle Of Hastings"."Experience hath shewn, that even under the best forms of government those entrusted with power have, in time, and by slow operations, perverted it into tyranny. "
Thomas JeffersonComment
-
Originally posted by Ruprect View PostIf you're writing a class that long you need to be shot.+50 Xeno Geek Points
Come back Toolpusher, scotspine, Voodooflux.Pogle
As for the rest of you - DILLIGAF
Purveyor of fine quality smut since 2005
CUK Olympic University Challenge Champions 2010/2012Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Umbrella company Rocket Paye says it’s been cloned Today 09:35
- Five tax return mistakes contractors will make any day now… Jan 9 09:27
- Experts you can trust to deliver UK and global solutions tailored to your needs! Jan 8 15:10
- Business & Personal Protection for Contractors Jan 8 13:58
- ‘Four interest rate cuts in 2025’ not echoed by contractor advisers Jan 8 08:24
- ‘Why Should We Hire You?’ How to answer as an IT contractor Jan 7 09:30
- Even IT contractors connect with 'New Year, New Job.' But… Jan 6 09:28
- Which IT contractor skills will be top five in 2025? Jan 2 09:08
- Secondary NI threshold sinking to £5,000: a limited company director’s explainer Dec 24 09:51
- Reeves sets Spring Statement 2025 for March 26th Dec 23 09:18
Comment