|
code:
|
# ? May 18, 2013 05:39 |
|
|
# ? May 16, 2024 18:17 |
|
cliffy posted:
apparently this is basically how python iteration works if what i read is true shaggar was right!?
|
# ? May 18, 2013 05:50 |
|
JewKiller 3000 posted:modern programming languages (not java, definitely not any p-lang)
|
# ? May 18, 2013 05:53 |
|
Cold on a Cob posted:you're avoiding my main point and a few of my side points. I don't really think I am avoiding your points, though. "expense" is language-dependent, and reeks of premature optimization in any case. "non-obvious" - there's nothing that's non-obvious about exceptions, especially if they're documented / in the interface. yes that is more work. checked exceptions do solve exactly the ambiguity that you're complaining about, when everything needs to be nailed down. also I think this argument has driven me towards checked exceptions / shaggarism, which is a terrible feeling, but there you go. there is no need to call python exceptions something else when they work in the exact same way as every other language's exceptions. generating custom exceptions is super trivial & we do it all the time at my work. Python code:
honesty time: I think this argument has turned into "exceptions are fine to use for a lot of thing in Python!" "no they're terrible to use except for really rare cases in C#!" "no they're fine in Python!" "no they're terrible in C#!" so maybe we should switch to mocking jewkiller 3k instead of continuing? idk.
|
# ? May 18, 2013 06:28 |
|
couple years ago I did a huge ~10,000 line java project in uni with 12 other guys and we abused the loving hell out of exceptions. every file had at least a couple try-catch blocks. it was atrocious and the prof rightly called us out on it
|
# ? May 18, 2013 06:33 |
|
PleasingFungus posted:I think this argument has turned into "exceptions are fine to use for a lot of thing in Python!" "no they're terrible to use except for really rare cases in C#!" "no they're fine in Python!" "no they're terrible in C#!" *high pitched voice* python coders code like thiiisssssss and *low pitched voice* c# coders code like thiiisssssss Cold on a Cob fucked around with this message at 12:56 on May 18, 2013 |
# ? May 18, 2013 12:52 |
|
i had to edit that because all the black developers i know use c# and all the python coders i know are skinny white dudes with high pitched nasally voices
|
# ? May 18, 2013 12:58 |
|
you guys comment as you go, or just spew a whole bunch of lines out and comment anything non obvious?
|
# ? May 18, 2013 13:05 |
|
i comment non obvious stuff (why not what)
|
# ? May 18, 2013 13:20 |
|
its funny because even in C# you still need to handle the exception when you open a file that doesn't exist, because someone could have deleted it after you checked for it but before you actually opened it
|
# ? May 18, 2013 14:03 |
|
Cold on a Cob posted:*high pitched voice* python coders code like thiiisssssss and *low pitched voice* c# coders code like thiiisssssss
|
# ? May 18, 2013 17:01 |
|
Jabor posted:its funny because even in C# you still need to handle the exception when you open a file that doesn't exist, because someone could have deleted it after you checked for it but before you actually opened it fun CJ knowledge: when using MS programs to edit files, they delete and recreate the file when u change one line in butts.docx so u gotta have delete permissions on the directory to edit, not just edit
|
# ? May 18, 2013 17:08 |
|
yeah saving a file involves like a dozen steps of deleting, recreating, temp files. its a mess
|
# ? May 18, 2013 17:52 |
|
how about a true life terrible programmer story found a painful bug in production yesterday written by a "senior developer" coworker code:
i hope this post makes you a better program shalom
|
# ? May 18, 2013 18:08 |
|
lol
|
# ? May 18, 2013 18:30 |
|
shoulda used =====
|
# ? May 18, 2013 20:01 |
|
cliffy posted:
never allow people to omit braces on for/if statements
|
# ? May 18, 2013 23:43 |
|
prefect posted:never allow people to omit braces on for/if statements real talk
|
# ? May 19, 2013 05:20 |
|
I leave out braces on for/ifs whenever I get the chance (when I'm using languages with braces) I hate the sight of them code:
it's almost elegant
|
# ? May 19, 2013 05:43 |
|
prefect posted:never allow people to omit braces on for/if statements holy crap lois I didn't even notice that im gonna go lie down forever
|
# ? May 19, 2013 06:06 |
|
PleasingFungus posted:I leave out braces on for/ifs whenever I get the chance (when I'm using languages with braces) braces aside, please never have a nonsdescriptive variable name, particularly one that is just one letter. What the gently caress is U? Whatever it is, it could be called something meaningful. We use modern technology that has at the very least local symbol autocomplete, presumable (if not, change the technology you use) and also minfiers/JIT compilers so there is no excuse to have a nondescriptive short variabe name, particularly in that context.
|
# ? May 19, 2013 06:41 |
|
Ronald Raiden posted:braces aside, please never have a nonsdescriptive variable name, particularly one that is just one letter. What the gently caress is U? Whatever it is, it could be called something meaningful. U is U(niverse/al); it's where the shameful globals live, all my poor design decisions come to roost in one place I'm not aware of any way to have actual globals in this language, so I dumped them into a class as static members & referenced them by as short a name as possible the good news is, it's a personal project which literally no one else will ever touch (unless some maniac decides to mess around with it after I open-source it, in which case, good luck!) so
|
# ? May 19, 2013 07:02 |
|
Don't use global variables, problem solved.
|
# ? May 19, 2013 07:04 |
|
Doc Block posted:Don't use global variables, problem solved. use singletons intead
|
# ? May 19, 2013 09:41 |
|
use monads. monads are a thing, right?
|
# ? May 19, 2013 11:16 |
|
yo leaving out braces is fine as long as you indent
|
# ? May 19, 2013 13:30 |
|
Jabor posted:its funny because even in C# you still need to handle the exception when you open a file that doesn't exist, because someone could have deleted it after you checked for it but before you actually opened it that's every programming environment never check to see if something will work, do something and check to see if it failed
|
# ? May 19, 2013 13:41 |
|
Cocoa Crispies posted:check to see if something will work, do something and check to see if it failed (though i guess if ur lucky enough to be using a language where exceptions aren't expensive as gently caress u can skip the first part)
|
# ? May 19, 2013 13:50 |
|
no but seriuosly the answer is, and always is, understand your tools and how they work and code what makes sense in the moment if you're processing 10 million files per day and they are always there and only one day two years ago a file was missing because some idiot cj deleted it from under your job, sure don't check in advance because it's wasted cycles conversely if you're converting 10 million strings per day into numbers and roughly 1% of them won't convert and when they don't you put in a -1, use something like tryparse or isnumeric assuming it's faster than exception handling with the tools you use
|
# ? May 19, 2013 13:57 |
|
or just don't sweat the small stuff because you're probably already coding in some horrible slow plang anyways
|
# ? May 19, 2013 14:30 |
|
ruby is neither slow nor horrible
|
# ? May 19, 2013 14:31 |
|
LOL wrong
|
# ? May 19, 2013 14:42 |
|
prefect posted:never allow people to omit braces on for/if statements but but but K&R!!!
|
# ? May 19, 2013 15:45 |
|
Cold on a Cob posted:yo leaving out braces is fine as long as you indent Yeah I think it looks better this way tbh. When I see braces I think multiple statements.
|
# ? May 19, 2013 17:45 |
polpotpi posted:ruby is neither slow nor horrible Doc Block posted:LOL wrong
|
|
# ? May 19, 2013 18:05 |
|
Ericadia posted:Yeah I think it looks better this way tbh. When I see braces I think multiple statements. What happens when you add a statement but forget to add the braces?
|
# ? May 19, 2013 19:06 |
|
Doc Block posted:What happens when you add a statement but forget to add the braces? I'm not sure what other compilers do but using LLVM/clang with sublime text spits out "expected } before 'else'" for if statements. I get your point though, avoid the failure in the first place
|
# ? May 19, 2013 19:58 |
|
Doc Block posted:What happens when you add a statement but forget to add the braces? same as when u accidentally use assignment instead of checking for equality in an if statement: poo poo breaks because terrible programmer wasn't careful (i'm being nice b/c this is a safe zone for terrible programmers)
|
# ? May 20, 2013 04:10 |
|
spent an afternoon tracking down a bugge that was due 2 not practicing good code re-use lesson learned
|
# ? May 20, 2013 05:36 |
|
|
# ? May 16, 2024 18:17 |
AWWNAW posted:how about a true life terrible programmer story who loving cares
|
|
# ? May 20, 2013 13:53 |