4 ms·
That looks like noise to me. There is almost four times more code dedicated to comments than useful code. If you write unit tests it would cover/explain all the
by nahname 13y ago
That looks like noise to me. There is almost four times more code dedicated to comments than useful code. If you write unit tests it would cover/explain all these cases. I don't see the point.
- moron4hire 13y agoI agree. It would work a lot better of the function were called something like "stringRepeat" or "duplicateText" or something other than "multiplex", because that's really not what multiplexing means. Then, rename that one parameter from "count" to "repetitions" and the function is almost completely self-explanatory. Not to mention, it probably doesn't deserve to exist at all. "text * count" is simple enough that it should probably be inlined.
- nahname 13y agoComments are generally superfluous, sometimes incorrect and often used to explain away bad code.
- moron4hire 13y agoYes. I consider comments to be part of the code, and thus in need of being maintained as much as the code. The more code you write, the higher probability of defects to be written. As comments have absolutely automated 0 checking applied to them, defects in them are all but ensured.
- collyw 13y agoDepends on the comments. I had to go and fix someone else's scripts, with comments like: #open files and read contents #loop through list No idea what was in the file, or why the contents were being read. What was the purpose of the loop. Commenting on those things would have saved me a lot of time. (It took me a week to fix something that should have taken a day, if it had been coded better in the first place.) (To put it into context, it was a previous workers code which interacted with the database I had written. When I changed some things in my code, her code stopped working. I didn't know how exactly her code worked, or the nature of the files that it was reading from the system, but I did know what working right would be. I am sure this is not an uncommon situation.)