|
astr0man posted:If it's obvious what your code is doing it doesn't need comments. In this case if your function was named handle_butts() or something it wouldn't need any additional explanation. shouldnt that be called fondle_butts();
|
# ? Oct 15, 2014 07:07 |
|
|
# ? May 17, 2024 02:15 |
|
Visual basic in Excel code:
|
# ? Oct 15, 2014 11:22 |
|
ErIog posted:This is why I name all of my functions like "handle_butts_returns_false_if_butthandle_invalid_true_if_butthandling_successful_takes_single_butthandler_or_array_of_butthandles(ButtHandle butthandle = false, Array butthandles = [])" "Array of butthandles" is now my new favourite collective noun variant for "colleague".
|
# ? Oct 15, 2014 11:48 |
|
Good comments.
|
# ? Oct 15, 2014 13:55 |
|
Subjunctive posted:People who use the word "kernel" outside of actual privileged-operating-system-code are usually trying to excuse cleverness that doesn't pay for itself, or otherwise indulge their illusions of Kernighan-ness. Beware. Or they're CUDA developers. quote:2.1. Kernels NVIDIA couldn't stop themselves from using the word that means "privileged OS code" everywhere else to name "random program that runs on the GPU". Paul MaudDib fucked around with this message at 16:17 on Oct 15, 2014 |
# ? Oct 15, 2014 16:11 |
|
It's more than likely based on the mathematical interpretation of the word kernel so it's not that much of a horror.
|
# ? Oct 15, 2014 16:32 |
|
Paul MaudDib posted:Or they're CUDA developers. Well, in graphics the term "kernel" goes back a long way as the core operation repeated as part of a filter or convolution or whatever. They get a pass.
|
# ? Oct 15, 2014 16:33 |
|
In the beginning I saw nice things (though why would you repeat SPEC in each line). Then I've gotten to hilarious part of DELIBERATE SPEC VIOLATION. Then I've gotten to the part where developer started arguing on what happens, and what should be happening (probably due to no spec regarding given thing) and just vents his frustration. vvv Nubbin! canis minor fucked around with this message at 17:00 on Oct 15, 2014 |
# ? Oct 15, 2014 16:50 |
|
Subjunctive posted:Well, in graphics the term "kernel" goes back a long way as the core operation repeated as part of a filter or convolution or whatever. They get a pass. Shaders. Filters. Mappers. Sanders.
|
# ? Oct 15, 2014 16:58 |
|
Nah, that's from the Roslyn source code, which has to maintain spec violations that were present in the original C# compiler as to not introduce breaking changes. I like the coding-to-spec style with literal sections of the spec copied out, in combination with extensive documentation and reasoning as to why certain code parts have to violate it. If you check other files you'll also see examples of comments intended for outside consumption.
|
# ? Oct 15, 2014 17:01 |
|
There has just got to be a formal, universal solution to this question of communication between humans.
|
# ? Oct 15, 2014 17:48 |
|
Hughlander posted:The last time I was paid to write C the compiler wouldn't complain about, but would ignore any part of an identifier after 8 letters. ratbert90 posted:Wow, that compiler must have been horribly lovely. In 1985 or so, all C compilers were that lovely.
|
# ? Oct 15, 2014 18:16 |
|
astr0man posted:If it's obvious what your code is doing it doesn't need comments. In this case if your function was named handle_butts() or something it wouldn't need any additional explanation. Fortunately there was an accurate and detailed method comment that explained what it actually did, so I didn't have to reverse-engineer it like I would have if its author had subscribed to the opinions of some posters in this thread of horrors.
|
# ? Oct 15, 2014 19:16 |
|
Soricidus posted:This very day, I was briefly stumped by a bug caused by a method called getValidPositions not, in fact, returning a collection of valid positions. Seems that method should just be called getPositions. Or, apparently, "getValidPositionsExceptSometimesNotReadTheCommentsToSeeWhyNot" ... but how do you know the comment is accurate if you don't check the code?
|
# ? Oct 15, 2014 19:54 |
|
Progressive JPEG posted:I think of comments as justification for why a given piece of code needs to exist, and of commit messages as justification for why that code needs to be changed. Otherwise why does it need to exist? This is pretty close to my approach. An example paraphrased from one of my projects: code:
|
# ? Oct 15, 2014 21:00 |
|
These were shared with me today:code:
code:
|
# ? Oct 16, 2014 21:47 |
|
Since that looks like PHP, I'm gonna hazard a guess that strlen checks the length of the string "0" and returns 1?
|
# ? Oct 17, 2014 01:47 |
|
itskage posted:These were shared with me today: Does this person have a (mostly) JS background?
|
# ? Oct 17, 2014 04:22 |
|
I think I found a coding horror in .NET while debugging a stack overflow with FluorineFx and Amf3 serialization. The overflow happens when it attempts to serialize the instance for the AMF return object. Is there actually a reason for this? Why would you want a copy of the exception in a collection inside of the exception? code:
Xanthalan fucked around with this message at 04:52 on Oct 17, 2014 |
# ? Oct 17, 2014 04:50 |
|
Are there other paths that might collect multiple exceptions in this._errors?
|
# ? Oct 17, 2014 05:08 |
|
If there's multiple configuration errors, it's nice to be able to report all of them at once rather than just the first one. Of course, if it's anything like the .NET codebases I've worked on that did similar things, there's zero places that actually have more than one exception in Errors and none of the code which handles the exceptions would do anything useful with them even if there were.
|
# ? Oct 17, 2014 05:13 |
|
Plorkyeran posted:If there's multiple configuration errors, it's nice to be able to report all of them at once rather than just the first one. Of course, if it's anything like the .NET codebases I've worked on that did similar things, there's zero places that actually have more than one exception in Errors and none of the code which handles the exceptions would do anything useful with them even if there were. Which is what it appears to be doing in exactly 3 places in everything I have gac'ed. All of which look like they are outputting the exception messages and stack traces to something. Subjunctive posted:Are there other paths that might collect multiple exceptions in this._errors? I guess it does have a purpose. It looks like the first ConfigurationErrorsException that gets thrown gets passed around a bit and then new ones are added to it as they happen.
|
# ? Oct 17, 2014 05:24 |
|
Subjunctive posted:People who use the word "kernel" outside of actual privileged-operating-system-code are usually trying to excuse cleverness that doesn't pay for itself, or otherwise indulge their illusions of Kernighan-ness. Beware. or are referring to the analysis term, or popcorn
|
# ? Oct 17, 2014 11:24 |
|
code:
|
# ? Oct 17, 2014 16:18 |
|
NFX posted:
All other issues aside, that single comment is absolutely amazing in how much it misses the point.
|
# ? Oct 17, 2014 17:14 |
|
Why would you need comments just look at the descriptive function names, it is self-documenting!
|
# ? Oct 17, 2014 17:21 |
|
pokeyman posted:Why would you need comments just look at the descriptive function names, it is self-documenting! Well, based on that code, self-documenting code and comments are both useless, so I guess we should use neither
|
# ? Oct 17, 2014 17:35 |
|
Paul MaudDib posted:NVIDIA couldn't stop themselves from using the word that means "privileged OS code" everywhere else to name "random program that runs on the GPU". Coding horrors: posts that make you laugh (or cry)
|
# ? Oct 17, 2014 18:55 |
|
Paul MaudDib posted:Or they're CUDA developers. Is this post serious?
|
# ? Oct 17, 2014 20:00 |
|
Oh no, the cancer has spread to signal processing textbooks!
|
# ? Oct 17, 2014 20:21 |
|
Blotto Skorzany posted:Oh no, the cancer has spread to signal processing textbooks! This entry is correct and accurate. Unless you're trolling, in which case I'll use the kernel method of eating popcorn.
|
# ? Oct 17, 2014 20:32 |
|
I hope you've got butter and salt.
|
# ? Oct 17, 2014 20:33 |
|
When code is "on the cob," formerly ring0,
|
# ? Oct 17, 2014 21:10 |
|
To be fair, there is a ton of overloading of terms across computing, and if you've never taken a college algorithms class or read some graphics literature then you could easily have avoided other definitions of "kernel".JawnV6 posted:When code is "on the cob," formerly ring0,
|
# ? Oct 17, 2014 22:13 |
|
JawnV6 posted:When code is "on the cob," formerly ring0, loving
|
# ? Oct 17, 2014 22:39 |
|
Blotto Skorzany posted:Oh no, the cancer has spread to signal processing textbooks! I guess I don't see how we got from "a square matrix used to convolve an image" to "an arbitrary program executed on a GPGPU processor". One refers to data processed by a program (fixed pipeline or no), the other refers to the program itself. The convolution operation is the same no matter what matrix you feed it. I guess it's not a horror since different kernels do different things, but it's not quite the same thing. You're basically calling a matrix a function because different matrixes produce different results when you stick them inside some other operation. Except in this case it's the other way around, the term "kernel" in the convolution sense was there first, and later appropriated. Unless it comes out of GPGPU originally being a hack of the FF pipeline. Did people write GPGPU programs using convolution kernels rendering onto a bitmap or something like that? I know they did with shaders... Paul MaudDib fucked around with this message at 02:21 on Oct 18, 2014 |
# ? Oct 18, 2014 01:54 |
|
Paul MaudDib posted:I guess I don't see how we got from "a square matrix used to convolve an image" to "an arbitrary program executed on a GPGPU processor". Like many words, the word 'kernel' has different meanings depending on context. In image processing, a kernel is basically any operation that gets applied to an entire image or stack of images. CUDA is using the term 'kernel' in the image processing context.
|
# ? Oct 18, 2014 03:10 |
|
"'Cause you know sometimes words have two meanings." — Led Zeppelin
|
# ? Oct 18, 2014 05:26 |
|
The GPU concept is called a kernel because it is the core, most important part of a vectorized loop. These kernel operations are looped down and around an image just like kernels of corn are looped down and around the cob. And sometimes the kernel inside these loops is even a convolution kernel. It works in multiple ways!
|
# ? Oct 18, 2014 06:23 |
|
|
# ? May 17, 2024 02:15 |
|
Coding horrors: It is a corn analogy
|
# ? Oct 18, 2014 08:50 |