Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

king_kilr posted:

That's create, excecpt how do you format this:

code:
var my_crap = func_call(foo,
                        bar)

code:
var my_crap = func_call(foo,bar)
For a case which actually involves mixing tabs and spaces:

code:
var my_func = function(some_long_param_name,
                       another_long_param_name)
{
<tab>return butts (some_long_param_name,
<tab>              another_long_param_name,
<tab>              "dongs");
}

Adbot
ADBOT LOVES YOU

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

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.

If your editor treats a block of spaces like tabs, that's the horror.

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. :v:

BigRedDot
Mar 6, 2008

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."

Fehler
Dec 14, 2004

.

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.
I really don't get this argument at all. How would my code look retarded when someone has different tab sizes? How is it a disadvantage that people can choose how far apart they want my indentation to be?

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.

Vanadium
Jan 8, 2005

Spaces are better than tabs because vim's auto-indent keeps loving up the case that Janin is describing :ohdear:

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

Vanadium posted:

Spaces are better than tabs because vim's auto-indent keeps loving up the case that Janin is describing :ohdear:

This sounds more like emacs is better than vim.

No Safe Word
Feb 26, 2005

Close the thread before it becomes "Coding argument horrors: relive the silly programming holy wars that make you laugh (or cry)"

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

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.

mr_jim
Oct 30, 2006

OUT OF THE DARK

Have we done names_with_underscores vs. namesWithCamelCase yet?

POKEMAN SAM
Jul 8, 2004

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".

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

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: slit wrists camel case
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.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

Smugdog Millionaire posted:

Pretty sure we've already done that 4-5 times in this thread.
And it gets stupider every time.

Vanadium
Jan 8, 2005

What if I do not use the standard library? :smug:

Hoborg
Oct 19, 2006

by T. Mascis

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.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

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").

It's 2010, surely the visual representation of code doesn't need to exactly match the bytes of source-code.

If you never want to deal with coding conventions again, there's always LabView :v:

"Coding horrors: Connection diagrams: straight or curved lines?"

Maybe not.

jandrese
Apr 3, 2007

by Tiny Fistpump
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.

Painless
Jan 9, 2005

Turn ons: frogs, small mammals, piles of compost
Turn offs: large birds, pitchforks
See you at the beach!
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"

ErIog
Jul 11, 2001

:nsacloud:

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.

jonjonaug
Mar 26, 2010

by Lowtax

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.

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.

I know this gets tossed around a lot in this thread but for crying out loud. You are totally the coding horror.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

just make all identifiers uppercase and disallow underscores, and mandate spaces around '=': problem solved :pseudo:

Python? Ruby? Throw that poo poo out the window, it's time for a marriage of Bash scripting and FORTRAN 77 :f5:

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Dijkstracula posted:

just make all identifiers uppercase and disallow underscores, and mandate spaces around '=': problem solved :pseudo:

Python? Ruby? Throw that poo poo out the window, it's time for a marriage of Bash scripting and FORTRAN 77 :f5:

Weak, JCL for life. Significant whitespace and hard to distinguish characters weed out the scrub tier pretty quickly.

raminasi
Jan 25, 2005

a last drink with no ice

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.

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.

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.

Crazy RRRussian
Mar 5, 2010

by Fistgrrl
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.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

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".

mr_jim
Oct 30, 2006

OUT OF THE DARK

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'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".

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.

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
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.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

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.
Obviously you would have the source control system normalize them and convert to the desired format on checkout like many do with newlines :v:

jandrese
Apr 3, 2007

by Tiny Fistpump
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.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
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

mr_jim
Oct 30, 2006

OUT OF THE DARK

Janin posted:

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

I read those ^Ms as humming at the end of each line.

Crazy RRRussian
Mar 5, 2010

by Fistgrrl

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'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".
share formatting rules files; make everybody autoformat using it before commit, fire people who fail to do this, problem solved

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

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

Crazy RRRussian
Mar 5, 2010

by Fistgrrl

Avenging Dentist posted:

That's retarded
And wasting your time worrying about formatting rules instead of actually programming is very smart indeed. Without auto formatting you would still likely end up with inconsistent style, while consistent use of auto format will make sure you have good looking code and not mess up diffs between revisions.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
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).

Crazy RRRussian
Mar 5, 2010

by Fistgrrl

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.

A A 2 3 5 8 K
Nov 24, 2003
Illiteracy... what does that word even mean?

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.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

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

qntm
Jun 17, 2009

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.

Rohaq
Aug 11, 2006
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. :ughh:

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 :bravo:

Anyhow, :goonsay: 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

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

Avenging Dentist posted:

The only autoformatting tool that works correctly all the time is the one that just removes all whitespace.

*cough*>>*cough*

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply