|
Strong Sauce posted:Do you think those programmers ever wonder, "drat I wish there was an easier way to do this. If only there were some sort of thingy that can hold all these similar items!" Funny thing is that in AS2 (which that is written in) the _root variable is essentially an array. He could have written that like this: code:
|
# ? Mar 23, 2012 20:48 |
|
|
# ? May 15, 2024 01:39 |
|
^^^ I'd start with success = false though, much cleaner that way. ^^^moynar posted:The latest software scandal in Norway is a pretty big horror. Reminds me of every time I hear about all the crap software the government has here in Denmark. I guess it's just a perfect storm of wrong specs and terrible consultants. Has there ever in the history of computing been a success story? One day I'll start a consulting firm and sell lovely software to governments. Carthag Tuek fucked around with this message at 20:51 on Mar 23, 2012 |
# ? Mar 23, 2012 20:49 |
|
Carthag posted:^^^ I'd start with success = false though, much cleaner that way. ^^^ I definitely agree with that, but then the for loop would need something like this: code:
Not that it matters since this is a coding horror no matter how you write it.
|
# ? Mar 23, 2012 21:07 |
|
Carthag posted:Reminds me of every time I hear about all the crap software the government has here in Denmark. I guess it's just a perfect storm of wrong specs and terrible consultants. Has there ever in the history of computing been a success story? The tax website in the UK works really well as far as I can tell. Taxes are insanely complicated but it does a much better job than the paper forms of hiding fields which don't need to be filled in, making it impossible to continue if you've omitted critical information, telling you what you've missed, and you can even bounce back and forth in the process and if you change something at step 2 that affects a field you already filled in at step 6 it'll warn you about that too (and even restore what you originally filled in at step 6 when you change it back!). I was actually really pleasantly surprised by the competence on display. I suppose this is the wrong thread for that, though.
|
# ? Mar 23, 2012 21:20 |
|
Strong Sauce posted:Do you think those programmers ever wonder, "drat I wish there was an easier way to do this. If only there were some sort of thingy that can hold all these similar items!" I've never even touched PHP, what's the proper way to do this?
|
# ? Mar 23, 2012 21:21 |
|
yaoi prophet posted:I've never even touched PHP, what's the proper way to do this? The only horror that I can see is that the input fields are being named field_1, field_2, field_3, field_4, et cetera. Though doing this: code:
code:
code:
|
# ? Mar 23, 2012 21:31 |
|
If you name the fields "field[]" PHP will automatically turn them into an array for you.
|
# ? Mar 23, 2012 21:38 |
|
Optimus Prime Ribs posted:I definitely agree with that, but then the for loop would need something like this: Actually I'm not too fond of naming vars "success", I prefer something semantic, it'll also make the code more like sentences. You could do something like this. Granted, it'll keep counting in all cases, but after the first false, lazy evaluation should keep the rest of the loop from taking too much time. code:
|
# ? Mar 23, 2012 21:39 |
|
yaoi prophet posted:I've never even touched PHP, what's the proper way to do this? The problem is that you want fields as an array, so there are two ways to accomplish this. Either have the inputs be named, "field[0], field[1], field[2], field[3]" or do it the easier way if you know that $arr[] = "blah" appends a new element to the end of the array you can do this: code:
And the second part is just part of the pain from the first part, but also what Optimus Prime Ribs said. I think PHP only returns a warning if an element you are referencing doesn't exist in an array so you can just surpress it but it's always good to actually check that an element actually exists using array_key_exists. Strong Sauce fucked around with this message at 21:59 on Mar 23, 2012 |
# ? Mar 23, 2012 21:45 |
|
senrath posted:Those comments make me wonder if it was auto-generated code.
|
# ? Mar 24, 2012 00:05 |
|
Aleksei Vasiliev posted:I'm pretty sure there are IDEs that maintain comments like that automatically. I don't know why anyone thinks it is useful. Agreed. The only time I've ever found notation like that to be useful is with nested namespaces. Sometimes I'll be 2 or 3 namespaces deep and close out back one or two for a declaration or specialization or something. In most other cases, blocks are so small that you can easily see exactly what they correspond to, unless you have some gigantic, several hundred line block of code... in which case you should probably split it up anyway.
|
# ? Mar 24, 2012 00:30 |
|
In one of my first year programming courses we lost marks if we didn't comment each of our closing braces. Needless to say I saw a lot of code:
|
# ? Mar 24, 2012 01:55 |
|
AlsoD posted:In one of my first year programming courses we lost marks if we didn't comment each of our closing braces. Needless to say I saw a lot of Wonder what would have happened if you did this: code:
We had to create a variable instead: code:
code:
|
# ? Mar 24, 2012 02:15 |
|
If you had to deal with all the stupid poo poo mistakes students would make, you'd have those rules too.
|
# ? Mar 24, 2012 02:19 |
|
shrughes posted:If you had to deal with all the stupid poo poo mistakes students would make, you'd have those rules too. That is a fair argument, but I didn't like writing code a way that I wouldn't have normally without being given a reason as to why I should.
|
# ? Mar 24, 2012 02:24 |
|
We asked our contractors to clean up the log files so there wasn't so much junk in it. Their solution? Replace all System.out.println with //System.out.println The problem with this is a few if statements were written like this: code:
|
# ? Mar 24, 2012 02:39 |
|
moynar posted:If I hadn't paid for it as a taxpayer I would be laughing pretty hard right now. If it makes you feel better we're (uk, london) about to roll out new software for ambulance dispatch. The last time people died. It's pretty likely to happen again http://www.computerworlduk.com/news/public-sector/3346117/london-outsources-999-fire-control-service/ http://en.wikipedia.org/wiki/London_Ambulance_Service#2011_CAD_failure
|
# ? Mar 24, 2012 02:40 |
|
Optimus Prime Ribs posted:And a different professor would take off marks if we didn't use curly braces with if statements that only had one line in them: I like him, seeing if statements without curly braces makes me angry because it's always an if statement I want to add a line to and then I need to add them anyway. Also it just looks plain wrong when braces are in the language.
|
# ? Mar 24, 2012 05:03 |
|
baquerd posted:I like him, seeing if statements without curly braces makes me angry because it's always an if statement I want to add a line to and then I need to add them anyway. Also it just looks plain wrong when braces are in the language. Sorry, but you are a spergy little baby.
|
# ? Mar 24, 2012 06:07 |
|
Aleksei Vasiliev posted:I'm pretty sure there are IDEs that maintain comments like that automatically. I don't know why anyone thinks it is useful. The most popular Flash decompiler inserts comments like that, and also uses that exact indentation style and unnecessary _root reference, so I'm going to guess that that's where that came from.
|
# ? Mar 24, 2012 06:27 |
|
This is relatively minor compared to stuff I've seen in other AMXModX, but indicative of the code you get from the AMXModX community. It's been a while since I've written Pawn, but I'm pretty sure I remember a != operator (considering it's been used multiple times in this plugin). Since this is Pawn, I don't expect this to be optimized away, not that performance is the issue here.code:
|
# ? Mar 24, 2012 07:55 |
|
I don't know if I'd care if that was the only thing 'wrong' with the code.
|
# ? Mar 24, 2012 09:34 |
|
That Turkey Story posted:Sorry, but you are a spergy little baby. "you have a different preferred style than I do? You are an autistic child."
|
# ? Mar 24, 2012 14:50 |
|
No, feeling strongly one way or another about it is retarded.
|
# ? Mar 24, 2012 14:55 |
|
Dicky B posted:No, feeling strongly one way or another about it is retarded. I like consistency in my code, I don't think that's a crime. Anyways, I let my autoformatter do the sperging for me.
|
# ? Mar 24, 2012 16:14 |
|
Dicky B posted:No, feeling strongly one way or another about it is retarded. Exactly this. If you are sperging out over little subjective stuff then I don't know what to say.
|
# ? Mar 24, 2012 16:18 |
|
That Turkey Story posted:Exactly this. If you are sperging out over little subjective stuff then I don't know what to say. Come on, I bet you have at least one little thing that doesn't effect functionality that you greater prefer. Braces style? White space? Variable or function name convention? I'd go as far to say that if you don't have something like that you're weird.
|
# ? Mar 24, 2012 16:27 |
|
baquerd posted:Come on, I bet you have at least one little thing that doesn't effect functionality that you greater prefer. Braces style? White space? Variable or function name convention? Sure I'm consistent in my personal work with my preferred style, but I'm not going to get angry when I have to work with different coding conventions.
|
# ? Mar 24, 2012 16:33 |
|
An excerpt from Ledorf's Opus Number 4code:
|
# ? Mar 24, 2012 16:33 |
|
baquerd posted:Come on, I bet you have at least one little thing that doesn't effect functionality that you greater prefer. Braces style? White space? Variable or function name convention? I have personal preferences, but if I'm working with code I didn't write, I'll follow their convention. Basically I don't care all that much as long as it's consistant.
|
# ? Mar 24, 2012 16:38 |
|
Look Around You posted:I have personal preferences, but if I'm working with code I didn't write, I'll follow their convention. I just install StyleCop and do what it tells me to do. Get everyone else to use it, no more formatting issues.
|
# ? Mar 24, 2012 19:13 |
|
baquerd posted:Come on, I bet you have at least one little thing that doesn't effect functionality that you greater prefer. Braces style? White space? Variable or function name convention? Everyone has their preferred way to write code. But why should I be penalised for not conforming to the professor's preference?
|
# ? Mar 24, 2012 21:39 |
|
Optimus Prime Ribs posted:Everyone has their preferred way to write code. If you let them, 90% of the students will turn in something that is entirely unreadable and has to be reformatted before grading. If you penalize only completely retarded formatting and accept anything vaguely sane, you'll waste a bunch of time arguing with students who think that zero whitespace anywhere is ideal. If you set a single required formatting standard and take points off for anything else, there is no ambiguity and when students whine about losing points for failing to follow simple instructions you can just tell them to actually read the assignment next time.
|
# ? Mar 24, 2012 21:50 |
|
Optimus Prime Ribs posted:Everyone has their preferred way to write code. It's not the biggest deal in the world, but the professor does have a point. You or some other dev might comment out or flat out delete the if statement, while forgetting about the bool gonnaLoseMarks = true;. code:
edit: Actually, depending on language it could make an even bigger mess if bool gonnaLoseMarks = true; was commented out instead. Something like code:
pigdog fucked around with this message at 22:04 on Mar 24, 2012 |
# ? Mar 24, 2012 21:56 |
|
I've never understood this argument because: - If you understand the syntax of the language then you will never make that mistake. - If you don't understand the syntax of the language then making that mistake and learning from it is beneficial
|
# ? Mar 24, 2012 22:12 |
|
Optimus Prime Ribs posted:Everyone has their preferred way to write code. In the real world, whether open source or commercial, you'll generally be expected to conform to the existing style of any large body of code to which you contribute. Doing otherwise is aggressively antisocial. I suggest you get used to it.
|
# ? Mar 24, 2012 22:29 |
|
Dicky B posted:I've never understood this argument because: It's about making it more difficult to accidentally gently caress up. And introducing a bug that doesn't get noticed immediately may be eventually "beneficial" from a "learning" perspective, but code is usually supposed to actually do something correctly before it's supposed to be a teaching tool.
|
# ? Mar 24, 2012 23:36 |
|
Coding standards really help reading other people's code if you are working in a large team. Less time lost figuring out where this guy is putting his members.
|
# ? Mar 24, 2012 23:38 |
|
It's way too easy to convertcode:
code:
Braces are good, even for single statements.
|
# ? Mar 24, 2012 23:57 |
|
|
# ? May 15, 2024 01:39 |
|
feedmegin posted:In the real world, whether open source or commercial, you'll generally be expected to conform to the existing style of any large body of code to which you contribute. Doing otherwise is aggressively antisocial. I suggest you get used to it. Admittedly I had not thought of that perspective when I made my post, but I don't think my frustration over the situation is entirely unreasonable. For what it's worth if I am writing code for a project that is not entirely my own I completely conform to the style of said project.
|
# ? Mar 25, 2012 00:14 |