|
king_kilr posted:That's create, excecpt how do you format this: code:
code:
|
# ? May 19, 2010 15:18 |
|
|
# ? Jun 4, 2024 23:07 |
|
Janin posted:The entire point of using tabs is so that it'll look different if somebody changes their editor's tab size. Some people like 2-space indentation, some people like 8-space; tabs let them both use whatever size they want. The problem, like king_kilr pointed out, is what happens when you want to align something with the line above it. If his line "var my_crap = ..." itself is indented because it's in a block or something, the only way for that to look right everywhere is for (a) everyone in the world to agree on a tab size, or (b) use spaces on both lines. Although we should move to (a) as soon as possible. 2 spaces for Ruby, 4 spaces for everything else. I HAVE SPOKEN! ^ Ok I guess that works too. Still, spaces are better than tabs because that's what I use.
|
# ? May 19, 2010 15:24 |
|
I've tried using only spaces as an experiment for the last year or so, but ultimately find it annoying. I am going back to the true way namely "tabs for indentation, spaces for alignment."
|
# ? May 19, 2010 15:49 |
|
Flobbster posted:Because then your code doesn't look all retarded if someone uses different tab sizes than you when they view it, and any decent text editor/IDE nowadays will treat a contiguous block of spaces as if it were a tab anyway, so you can't even tell the difference while you're editing. All that would change is that the code is spread out a bit further or comes a bit closer together if they change the tab size. How could that possibly be bad? Either I'm missing something really obvious here or this is just a very stupid argument. Plus, I have yet to find an IDE that actually handles a mix of spaces and tabs properly. Usually when I copy something from code that contains spaces, it will be off by one or two columns and I have to fix everything again manually.
|
# ? May 19, 2010 15:50 |
|
Spaces are better than tabs because vim's auto-indent keeps loving up the case that Janin is describing
|
# ? May 19, 2010 15:51 |
|
Vanadium posted:Spaces are better than tabs because vim's auto-indent keeps loving up the case that Janin is describing This sounds more like emacs is better than vim.
|
# ? May 19, 2010 15:59 |
|
Close the thread before it becomes "Coding argument horrors: relive the silly programming holy wars that make you laugh (or cry)"
|
# ? May 19, 2010 16:07 |
|
No Safe Word posted:Close the thread before it becomes "Coding argument horrors: relive the silly programming holy wars that make you laugh (or cry)" Pretty sure we've already done that 4-5 times in this thread.
|
# ? May 19, 2010 16:29 |
|
Have we done names_with_underscores vs. namesWithCamelCase yet?
|
# ? May 19, 2010 16:40 |
|
mr_jim posted:Have we done names_with_underscores vs. namesWithCamelCase yet? The horror that I see at work all the time is people calling ThisSortOfCasing "camel case with the first letter capitalized".
|
# ? May 19, 2010 16:44 |
|
mr_jim posted:Have we done names_with_underscores vs. namesWithCamelCase yet? That one's easy because there's only one correct answer: use the same conventions as the language and standard library that you're using. Some examples: C++ with STL: underscores C++ with MFC: Ruby: underscores Java: camel case with initial minuscule Objective-C: camel case with initial minuscule C#: camel case with initial majuscule In the event that you're using a combination of a language and library where the conventions differ, (1) the library sucks for doing that, and (2) I don't know, pick one and stick with it.
|
# ? May 19, 2010 16:48 |
|
Smugdog Millionaire posted:Pretty sure we've already done that 4-5 times in this thread.
|
# ? May 19, 2010 16:53 |
|
What if I do not use the standard library?
|
# ? May 19, 2010 16:56 |
|
mr_jim posted:Have we done names_with_underscores vs. namesWithCamelCase yet? I would pay someone a very handsome sum of money if they wrote an add-in for VC that magically 'hid' coding convention inconsistencies when editing a file. One of the things that really puts me off C++ dev are these very inconsistencies. I'm still uncomfortable with "nullptr" in C++0x (at least it isn't "null_ptr"). It's 2010, surely the visual representation of code doesn't need to exactly match the bytes of source-code.
|
# ? May 19, 2010 16:57 |
|
Hoborg posted:I would pay someone a very handsome sum of money if they wrote an add-in for VC that magically 'hid' coding convention inconsistencies when editing a file. One of the things that really puts me off C++ dev are these very inconsistencies. I'm still uncomfortable with "nullptr" in C++0x (at least it isn't "null_ptr"). If you never want to deal with coding conventions again, there's always LabView "Coding horrors: Connection diagrams: straight or curved lines?" Maybe not.
|
# ? May 19, 2010 17:04 |
|
It doesn't seem like it would be that hard for a compiler to convert camelCase and using_underscores to the same representation internally. There is a slight danger of namespace pollution, but given that you only typically see this problem in programs where everything is javaNamedWithRediculousAmountsOfDescriptiveTextOnEveryObject that doesn't seem like it will be a big problem.
|
# ? May 19, 2010 17:06 |
|
Yeah so yesterday I saw some punk kid writing "NULL" so I smacked him on the face and was like "yo don't try to be a hero, that pointer's a ZERO"
|
# ? May 19, 2010 17:07 |
|
jandrese posted:It doesn't seem like it would be that hard for a compiler to convert camelCase and using_underscores to the same representation internally. This may be one of the worst ideas I've ever heard. No it wouldn't be hard, but it would create atrocious coding practices where different groups in an organization would use different representations. Then there's a third group that doesn't actually care either way, and they write in a mix of the two so the code would actually rely on the same variable being called 2 different things. I hate you, and I hope you never write a compiler. It's one thing for something to be convenient, and it's another thing entirely to create convenience at the cost of clarity or good coding practices.
|
# ? May 19, 2010 17:11 |
|
jandrese posted:It doesn't seem like it would be that hard for a compiler to convert camelCase and using_underscores to the same representation internally. I know this gets tossed around a lot in this thread but for crying out loud. You are totally the coding horror.
|
# ? May 19, 2010 17:14 |
|
just make all identifiers uppercase and disallow underscores, and mandate spaces around '=': problem solved Python? Ruby? Throw that poo poo out the window, it's time for a marriage of Bash scripting and FORTRAN 77
|
# ? May 19, 2010 17:15 |
|
Dijkstracula posted:just make all identifiers uppercase and disallow underscores, and mandate spaces around '=': problem solved Weak, JCL for life. Significant whitespace and hard to distinguish characters weed out the scrub tier pretty quickly.
|
# ? May 19, 2010 18:51 |
|
jandrese posted:It doesn't seem like it would be that hard for a compiler to convert camelCase and using_underscores to the same representation internally. Yeah I don't really know how you could follow this thread and not worry about opening up some code with both an_identifier and anIdentifier in it.
|
# ? May 19, 2010 19:49 |
|
I do not understand this stupid debate about code style conventions of tabs vs space when there are auto-format tools for almost all languages.
|
# ? May 19, 2010 19:55 |
|
LockeNess Monster posted:I do not understand this stupid debate about code style conventions of tabs vs space when there are auto-format tools for almost all languages. Yeah I love it when people make commits to projects using their own personal brand of indentation instead of the style chosen for the project. Especially when they reformat the spacing for the whole file. It's hilarious that the stupidest people in "tabs vs. spaces" arguments always end up being in the group of people saying "it doesn't matter".
|
# ? May 19, 2010 20:11 |
|
Avenging Dentist posted:Yeah I love it when people make commits to projects using their own personal brand of indentation instead of the style chosen for the project. Especially when they reformat the spacing for the whole file. It doesn't matter as long as everyone in the project consistently uses one or the other. Pissing your personal indent style over parts of an existing project just to mark your territory is stupid. In fact, having a "unique coding style" at all is pretty stupid.
|
# ? May 19, 2010 20:23 |
|
In a project I'm working on right now, two of my partners are editing the same file, and I think things have been indented at least four different ways between the two of them. I'd honestly think they were trolling if they didn't do this for everything.
|
# ? May 19, 2010 20:28 |
|
GrumpyDoctor posted:Yeah I don't really know how you could follow this thread and not worry about opening up some code with both an_identifier and anIdentifier in it.
|
# ? May 19, 2010 20:49 |
|
You would handle it the same way people do now: Create a drat standard for the organization to follow. However, you don't run into the problem where vendorLibraryA uses one style, and vendor_library_B uses the other, and you're stuck mixing and matching in your code. That's what the original poster was getting on about.
|
# ? May 19, 2010 20:54 |
|
every time this one guy^M edits a file, it's filled with a weird^M mix of DOS and UNIX line endings. Drives me^M crazy, because the proprietary source^M control system we use doesn't support^M whitespace-insensitive diffs, so it becomes^M impossible to see what's changed.^M^M
|
# ? May 19, 2010 21:10 |
|
Janin posted:every time this one guy^M I read those ^Ms as humming at the end of each line.
|
# ? May 19, 2010 21:16 |
|
Avenging Dentist posted:Yeah I love it when people make commits to projects using their own personal brand of indentation instead of the style chosen for the project. Especially when they reformat the spacing for the whole file.
|
# ? May 19, 2010 21:19 |
|
LockeNess Monster posted:share formatting rules files; make everybody autoformat using it before commit, fire people who fail to do this, problem solved That's retarded
|
# ? May 19, 2010 21:19 |
|
Avenging Dentist posted:That's retarded
|
# ? May 19, 2010 21:26 |
|
If it takes any measurable mental effort to write in multiple programming styles, you are an awful programmer. Remembering where to put braces when you are surrounded by "correct" code is not hard. The only thing there's even remotely a need for is setting indent-tabs-mode and c-basic-offset so electric mode doesn't gently caress up your poo poo (or whatever the equivalent is in vim).
|
# ? May 19, 2010 21:35 |
|
Avenging Dentist posted:If it takes any measurable mental effort to write in multiple programming styles, you are an awful programmer. Remembering where to put braces when you are surrounded by "correct" code is not hard. The only thing there's even remotely a need for is setting indent-tabs-mode and c-basic-offset so electric mode doesn't gently caress up your poo poo (or whatever the equivalent is in vim). If it takes you measurable effort to click a few buttons to auto format your poo poo then you are also a bad programmer. If you only have humans formatting the code then there is very good chance that it wont be 100 consistent. Forcing everybody to use auto format tool with shared style before commit is a good solution imho.
|
# ? May 19, 2010 21:47 |
|
Avenging Dentist posted:If it takes any measurable mental effort to write in multiple programming styles, you are an awful programmer. And what you don't get is that if it takes any measurable mental effort to read multiple programming styles, you're also an awful programmer. Once you get that, you see there's no need for all this herding cats poo poo.
|
# ? May 19, 2010 21:48 |
|
LockeNess Monster posted:If you only have humans formatting the code then there is very good chance that it wont be 100 consistent. Forcing everybody to use auto format tool with shared style before commit is a good solution imho. The only autoformatting tool that works correctly all the time is the one that just removes all whitespace. A A 2 3 5 8 K posted:And what you don't get is that if it takes any measurable mental effort to read multiple programming styles, you're also an awful programmer. Once you get that, you see there's no need for all this herding cats poo poo. Yes that is basically true that is why normal people don't try to proselytize their indent style. Avenging Dentist fucked around with this message at 21:56 on May 19, 2010 |
# ? May 19, 2010 21:53 |
|
TRex EaterofCars posted:Weak, JCL for life. Significant whitespace and hard to distinguish characters weed out the scrub tier pretty quickly. Call me a scrub. JCL: Significant whitespace. "Case-sensitive" in the sense that everything has to be in capitals. Line length limit of 80 characters, 2 of which are the "//" which has to be at the beginning of every valid line and 8 of which are mandatory card sequence numbers. Comments aren't delimited, they're just anything you manage to fit in the space left after the end of the statement. I'm pretty sure it can't do loops which means it's not Turing-complete. And whenever you call a JCL procedure, you can also manually override the datasets (input/output streams) used at any labelled line in that procedure. Since every line has to have label, the result is that as soon as your useful procedure becomes public you can never modify the name or function of any line in that procedure without breaking someone else's code.
|
# ? May 19, 2010 22:35 |
|
Colleague at work was using try and catch in C# to bypass an error that occurred if a config file wasn't set up correctly, but wasn't actually doing anything in the catch in order to handle the error, and refused to do anything with it because if the error occurred; the result being that if the config file wasn't set up properly, a drop down box wasn't rendered. It took us two hours to convince him that perhaps making elements of his application silently disappear on the whim of a typo or a mistake was a bad idea, and that maybe an error message informing the user that their config file was not set up correctly would be a good idea. He just didn't seem that bothered and doesn't seem to understand that when people use his programs, that they will not likely have an intricate knowledge of his code and be able to anticipate errors without some kind of prompt. I really don't get some people. Also had some fun burrowing through some code that was outsourced to India, and still doesn't quite work yet; I think that they gave a perl project to some C++ programmers and told them to git 'er done; the number of copy-pastes of code which is probably the internet results in changes in formatting and switches between camelCase and other standards. There also appears to be an apparent avoidance of regular expressions, resulting in one section of code ending up being about 25 lines long when it could have been done in one. There was also a case of an if statement with a bunch of elsifs, two of which were exactly the same condition, so the second condition would never run Anyhow, over: Regarding the indentation argument; I'm primarily a Perl guy thanks to some UNIX-based LDAP systems we've got running, so I've set up my text editor of choice (Notepad++) to render convert my tabs to two spaces; seems to save any arguments regarding tab/spacing mixes, and indentation issues when others view my code. Rohaq fucked around with this message at 01:44 on May 20, 2010 |
# ? May 20, 2010 01:42 |
|
|
# ? Jun 4, 2024 23:07 |
|
Avenging Dentist posted:The only autoformatting tool that works correctly all the time is the one that just removes all whitespace. *cough*>>*cough*
|
# ? May 20, 2010 11:21 |