 |
|
 |
Cheers. I went back a few pages before posting but not far enough!
Kevin
|
|
|
|
 |
|
 |
Try thread view; they're on the same page.
|
|
|
|
 |
|
 |
Didn't even know about that! You learn something new every day.
Kevin
|
|
|
|
 |
|
 |
Just what the world needs, another ALGOL based multi-paradigm, imperative, functional, generic, object-oriented language.
Can't we all just settle on COBOL and be done with it?
------------------------------------
In science, 'fact' can only mean 'confirmed to such a degree that it would be perverse to withhold provisional assent.' I suppose that apples might start to rise tomorrow, but the possibility does not merit equal time in physics classrooms. Stephen J Gould
|
|
|
|
 |
|
 |
I can see you've already blown my lunchtime reading for today
Looks interesting, thanks for the link!
|
|
|
|
 |
|
 |
Go is only part of it's name. The rest of it is rather obscene, and biologically very tricky, except for those who are very, very blessed.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
The Go page tells us it's only supported on the Mac OS and Linux. I can't help feeling like they forgot something...
|
|
|
|
 |
|
 |
Heh. Love the Pascal assignment operator!
/ravi
|
|
|
|
 |
|
 |
A programmingcommenting question.
I have been writing commentaries above a related line of code, like this:
Init();
However, I have seen a big sample of code written by one of my professors recently. The commentaries was placed below a line.
Init();
Sincerely, I have found it very clear and understable. Did anybody encounter such approach to commenting code? Is it recommended?
Greetings - Jacek
|
|
|
|
 |
|
 |
If it's a small comment, you could even do this:
Init();
|
|
|
|
 |
|
 |
Some people can't see with wood from the trees
|
|
|
|
 |
|
 |
Or even better, rename the function so you don't need the comment.
|
|
|
|
 |
|
 |
That's right.
The old 'self documenting code' joke is not always a joke.
Take time and space to make variable names mean something.
Make the method name be really indicative of what it does.
I use long, descriptive variable and method names, and my experience is that they are more likely to stay up to date than the comments are, and less likely to be re-used in an inappropriate manner. 'int i;' will get used/reused on demand, but 'int windowIdx; will generally only be used for the index of a window, into a list of windows.
But comments are required where the code can not be made easy to understand, because it is actually very complex algorithm, it has been optimized, or for some other reason obfuscated.
Silver member by constant and unflinching longevity.
|
|
|
|
 |
|
 |
above
Humans read downwards and we want to know what you intend to do (comment) before we read what you are doing (code).
|
|
|
|
 |
|
 |
Above or on the same line, but never below.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
 |
|
 |
Comments below the line of code?
Sure, if you're the sort of person who wears their underpants on top of their trousers.
"People who don't like their beliefs being laughed at shouldn't have such funny beliefs." ~ Anon
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
Currently reading: 'The Greatest Show on Earth', by Richard Dawkins.
|
|
|
|
 |
|
 |
You think he's Superman?
//L
|
|
|
|
 |
|
 |
Wait a minute, is there some problem with that?
Silver member by constant and unflinching longevity.
|
|
|
|
 |
|
 |
Above.
When reading code it helps you to understand what the following line does.
If you fail to plan, you plan to fail!
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
 |
|
 |
Above are the Comments for human.
Below may be for the machine.
|
|
|
|
 |
|
 |
Above for intention, behind for details.
In-Method comments should show the intention of the block they are commenting on (instead of repeating what the code says). A reader of the code should be able to skim over the coments to understand the structure of the code. In virtually all cultures title and abstract go before the actual content. Code should be no different.
path = GetDefaultPath();
if (!path.Exists()) path = GetDefaultPathV1();
...
Personally, I love the idea that Raymond spends his nights posting bad regexs to mailing lists under the pseudonym of Jane Smith. He'd be like a super hero, only more nerdy and less useful. [Trevel] | FoldWithUs! | sighist | µLaunch - program launcher for server core and hyper-v server
|
|
|
|
 |
|
 |
Generally, comments have always been written above or on the same line as the code. My objection to having comments below the relevant code is that it would be awkward if it was consistant:
Init();
is fine, butprivate MyClass[] GetMyClassInstances(int count, bool why, string whathaveyou...)
{
... body of long function
}
is just asking for trouble!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
 |
|
 |
Hahahaha... Totally agree!!!
Comments above or on the same line (if it's a very simple comment)...
Edit:
And what about useless comments???... Have you ever wrote those???... Like:
// Check if a > b
if (a > b)
{
(...)
}
Hahahaha... It seems too stupid, but I must confess I've done it a couple of times...
modified on Thursday, November 12, 2009 6:49 AM
|
|
|
|
 |
|
 |
The position of useless comments shouldn't really matter.
|
|
|
|
 |
|
 |
Yes, it does matter. They should be positioned in the recycle bin.
|
|
|
|
 |