Hacker News new | past | comments | ask | show | jobs | submit login

I don't think the language gets to decide the coding style. Only the programmer gets to do that.

Especially if you program in multiple language it can be jarring to switch styles for each language.




I change keyboard layouts depending on (natural) language, though that's just personal preference.

I think that flexibility of style has been getting less and less favor recently : a lot of languages are starting to "force" some elements (such as indentation) , and go has done the most intelligent thing ever and ships with a formatter so that there's only 1 "right" way to write things.

Formatting issues is the source of so much bike-shedding, despite that it really shouldn't be much of a productivity sink in 99.9% of situations.


Sure, but a lot of languages are so closely related to their "standard library" that you adopt the style of the "standard library"

Take C# and the BCL. C# is a language but you'd be hard pressed to avoid using the BCL in any meaningful C# program.

    String.Format("Hello {0}", stringVariable);
All (nearly all?) the function names in the BCL are UpperCamelCase, and a lot of C# code follows that as a convention.

Repeat for class names, interfaces prefixed with I, public properties etc.


Python adopted a styleguide and I don't think I've seen any modern Python using camel case since. If anyone was to use camel case, they would be presumed to be a beginner.

http://www.python.org/dev/peps/pep-0008/


That's a good point, and I run into that problem myself. I prefer camelCaseNames over names_with_underscores in just about any language. When I write Ruby code for myself I sometimes use camelCaseNames just because I like them better.

But if I'm writing code for someone else I try to follow the language's conventions if possible. Especially if it's a library that will be combined with other libraries and application code that does follow native conventions.

After all, it's also jarring to write code in one language that has to use multiple styles because it integrates libraries that weren't consistent with the common language conventions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: