|
dwazegek posted:
Every kid knows that false || x equals to x (in a boolean context) He could have mine as well written that line as code:
|
# ¿ Mar 21, 2008 20:08 |
|
|
# ¿ Apr 30, 2024 00:19 |
|
Oh yeah, drat, missed that. That's exactly why you shouldn't try to be clever in your code and just use the most readable and clear code possible (in this case, an if statement)
|
# ¿ Mar 21, 2008 20:15 |
|
Mr. Heavy posted:Never has a single empty method call made me want to hit something so badly. I see someone has been reading Schrödinger's book on programming.
|
# ¿ Mar 22, 2008 13:25 |
|
I agree with nebby that there's almost always a better name for a variable that is returned by a method or function than result. Although I disagree that i is a bad name, because it's almost exclusively used for loop counters and has become a sort of a standard for them. When you see some_collection[i] in a loop, you know what that i stands for. That's for languages like C and such, proper higher level languages shouldn't force you to write boilerplate code .
|
# ¿ Mar 29, 2008 18:00 |
|
zootm posted:Just "apples" would suffice - why bother saying it's a count when it could be nothing else? On the other hand, generally speaking, if "result" is confusing, your method is too complex and you should simplify it.
|
# ¿ Mar 29, 2008 18:18 |
|
such a nice boy posted:What's wrong with it? There's no way I'm going to make the mental effort to try to parse out what that regex does.
|
# ¿ Mar 29, 2008 23:16 |
|
nebby's example looks like it's written in Python and there, the first argument to a method is always the instance itself. So if you havecode:
|
# ¿ Mar 30, 2008 20:52 |
|
Ultimate variable naming schemecode:
|
# ¿ Mar 31, 2008 15:13 |
|
I never found the appeal of those keyboards because I rarely look at my keyboard and when I need to do stuff quickly I rely on vim's command mode or just on keyboard shortcuts in general while in other applications.
|
# ¿ Mar 31, 2008 23:09 |
|
Yeah, that's true. I don't know C# but what's the type of the exception being propagated upwards in that code? Because in Java, for instance, if you just blanket catch exceptions and then just do throw new Exception(), you're losing the info about what kind of exception it was, but if you do something like:code:
|
# ¿ Jul 10, 2008 17:20 |
|
edit: doubelpost
|
# ¿ Jul 10, 2008 17:21 |
|
|
# ¿ Apr 30, 2024 00:19 |
|
Aha, I see, cool. Yeah, like I said, I don't really know C#, I just wanted to know if that piece of code kept the information about the exception.
|
# ¿ Jul 10, 2008 17:44 |