|
very posted:Don't you know the virtue of avoid magic numbers in your code? Are you being sarcastic? Please please please be being sarcastic. const int THREE = 3; is just as bad as using 3 everywhere. It should be const int NUM_CHOICES = 3; or whatever 3 represents.
|
# ¿ Mar 21, 2008 16:31 |
|
|
# ¿ Apr 27, 2024 18:10 |
|
such a nice boy posted:What's wrong with that code? Is it just that The way I see it - what if _b is == 0? Run-time error.
|
# ¿ Mar 24, 2008 16:59 |
|
DaTroof posted:Haha. Somehow that reminded me of an ecommerce site I saw at a development firm that eventually went belly up. I think I've been blocking it from my conscious memory for the past few years. Whenever I feel insecure about my programming skills, there's always a story like this to make me think, "At least I'm not completely retarded."
|
# ¿ Mar 25, 2008 14:56 |
|
rotor posted:yep. to my way of thinkin', there are times when code duplication is just fine, considering the alternatives. So basically he wanted subroutines? I'm not an expert bash scripter(I just use it for automating things I do all the time) but from what I understand, couldn't he just write out separate shell files containing the code block he glommed and just call those? Or does using source give the functions access to lexical variables? That's actually really, really genius in a way.
|
# ¿ Mar 27, 2008 22:43 |
|
Triple Tech posted:These things, as Perl programmer, piss me off: See, I wrote code:
|
# ¿ Apr 4, 2008 14:34 |
|
Triple Tech posted:As written, that is an improper use of map, philosophically. Hmm, maybe I'm misreading this. What about code:
|
# ¿ Apr 4, 2008 17:12 |
|
Triple Tech posted:If this_returns_an_array contains no side effects to the variables submitted, then both of those do nothing. They're void context. In the first one, the fact that it returns something doesn't even matter. You can't capture the output of a loop when it's written like that. In the second scenario, you're just missing the left side of the assignment. my @array = that expression. It's returning an array for each element in the elements list, and then jamming all of that into one long array, and then that array isn't going anywhere. Again, void context. Yea, I wrote it wrong I meant that they did have side effects on the variable being passed in.
|
# ¿ Apr 7, 2008 14:23 |
|
heeen posted:I'd guess the latter involves a division which is a rather lengthy operation, whereas the former is just bit juggling. (num & 1)==0 is correct. What he posted in his example is incorrect. code:
|
# ¿ Jun 3, 2008 15:36 |
|
IcePotato posted:from the forum bug reporting thread The amount of downtime was pretty ridiculous. We have sites that get 30,000 requests per minute and don't allow that to happen. Then again, this is just a pretty small website ran by a handful of people and not a company.
|
# ¿ Jun 6, 2008 17:54 |
|
Who would have thought that this code would have resulted in issues?code:
|
# ¿ Jun 10, 2008 21:31 |
|
MrMoo posted:It leans more towards retarded than unreadable, quite a few people skip using unless but it's a bit sill considering the post-conditional check. Well it makes it unreadable because I pared it down a little. There are big ol' chunks of code inside those if-else blocks that you have to read to... then you realize the code in the else block won't do anything because the second line is "return if the condition that got me here is still false". If not user.. try harder to get the user!
|
# ¿ Jun 10, 2008 21:59 |
|
Randomosity posted:I want to kill the people whose code I now maintain. And wtf is an 'appaplexy' An application-induced apoplexy.
|
# ¿ Jun 17, 2008 22:20 |
|
Zaasakokwaan posted:When I was a Junior Programmer, this was always my biggest pet peeve. The former is so natural I could never understand why it wasn't supported more. Wouldn't that kill the English readability of something like: code:
code:
|
# ¿ Aug 27, 2008 15:52 |
|
KaeseEs posted:Done making GBS threads on the thread, here's a classic from php land, quoted from elsewhere: I'm curious, just because I'm not a good C coder - what's the proper way to check for overflow?
|
# ¿ Sep 2, 2008 19:48 |
|
Just ran across this while adding on some functionality to a project...code:
So that line grabs the user's third-party ID from the CGI request. Nothing weird, but then 20 lines below that in the same method... code:
|
# ¿ Sep 8, 2008 18:40 |
|
Jethro posted:I don't know much Perl, but doesn't the my in front of $id and $user hide those variables within the scope of the if statement? So if you were commenting this, it might go something like: Yeah, it does redefine $id lexically but it's still ridiculous and unmaintainable because at one point $id refers to the third-party ID then in the same method they change it lexically to point to our ID. And they already have an instance of the user - they call get_user_id() on the currently instantiated user, then grab him again.
|
# ¿ Sep 8, 2008 20:15 |
|
Roseo posted:I'm not a great programmer, but at least I know enough to not do this: code:
Who wants to go golfing?
|
# ¿ Oct 8, 2008 22:01 |
|
|
# ¿ Apr 27, 2024 18:10 |
|
da keebsta knicca posted:Also if any of you have never experienced Coldfusion it is best language if you really enjoy typing. who the gently caress in the history of computing thought, "ah, yes, xml is a decent markup language for organizing data... let's make code out of it"
|
# ¿ Nov 26, 2008 21:30 |