5 ms·
Many things in programming are like that. Why do you use CamelCase in JavaScript but underscores_in_ruby? Because everyone else does, and that’s the language’s
by crusso 14y ago
Many things in programming are like that. Why do you use CamelCase in JavaScript but underscores_in_ruby? Because everyone else does, and that’s the language’s "style."
By that logic, driving on the right side of the road in the US vs driving on the left in the UK is "pop culture".
The reasoning in the article didn't improve as I read on...
- ricardobeat 14y agoCamelCasing is not enforced, while driving on the right side is.
- crusso 14y agoI've driven in countries where no traffic laws are enforced. People still pick a side of the road to drive on. And it isn't because it's superficial and fashionable. It's because there are underlying logical reasons for doing what the rest of the herd is doing. Likewise with sticking to coding conventions for a language.
- nickik 14y agoLaws in any given system are a process of Spontaneous order (http://en.wikipedia.org/wiki/Spontaneous_order http://en.wikipedia.org/wiki/Spontaneous_order). The performance of every given actor in the system is inhanced by everybody else adopting the system. Its absolutly normual and good. Thats how our social liver works in general, the state mostly only comes in later and writes stuff down.
- nickik 14y agoLaws in any given system are a process of Spontaneous order (http://en.wikipedia.org/wiki/Spontaneous_order http://en.wikipedia.org/wiki/Spontaneous_order). The performance of every given actor in the system is inhanced by everybody else adopting the system. Its absolutly normual and good. Thats how our social liver works in general, the state mostly only comes in later and writes stuff down.
- papsosouid 14y ago>By that logic, driving on the right side of the road in the US vs driving on the left in the UK is "pop culture". Not at all. I don't drive on the right side because "everyone else does" and "that's the style". I do it because its the law, and because I would be risking my life and the lives of others to do otherwise. Having a function with an underscore in its name isn't breaking any laws, and isn't risking any lives or anything even remotely analogous. It is entirely based on subjective whims.
- pjscott 14y agoYou risk confusing and annoying other people who read your code. It's a non-lethal risk, to be sure, but still a reason to follow the local naming customs.
- papsosouid 14y agoYou risk confusing and annoying other people who read your code if you do follow convention also. I hate camelCase just as much in languages where it is customary as I do any other time. It is just a question of how many people you expect to annoy, which is precisely choosing it by popularity.
- zerostar07 14y agoThere are 2 factors that would keep you from switching styles: inertia, and symmetry. The benefit from keeping the code looking good usually outweighs the gratification of "going on your own". And frankly if you 're changing coding style in your contribution you look like a prick. The OP's point is valid: it's not popularity that leads to standardization it's because of the initial standardization that it is later adopted. Case in point: i don't know any major project that does not follow the style conventions of the framework it's built upon.
- bmelton 14y agoWith Python at least, it's effectively the law, or at least is defined in PEP8. PEP8 is tricky because it's technically a "style guide", but heaven help you if you're trying to get your code into somebody else's repository and aren't abiding its tenets. http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/
- dbh937 14y ago>>>By that logic, driving on the right side of the road in the US vs driving on the left in the UK is "pop culture" Well, if using the definition of pop culture described in this article, pop culture evolves. Where countries drive on the road can be related more to how programming languages define blocks of code. C-like languages use curly braces to define blocks. This can be related to how since medieval times, horses rode on the left side of the road. More modern languages use different ways to define blocks of code. For example, Python uses tabbing and whitespace, Ruby uses the `end` keyword. Continuing to use the traffic analogy, you don't have to use cruise control while driving on a long stretch of highway, but it's a lot easier to, and everyone else does. In the article, raganwald is talking about how coding conventions and techniques evolve over time. The analogy about driving in the UK vs the US is more equivalent to the syntactic rules of the specific language you are working with; it's the law which side of the road to drive on. You'll get penalized if you do otherwise. Using or not using cruise control is your choice, and so are naming conventions in different languages. Conventions evolve, even when the specific "laws" of the languages don't change as quickly, or at all.
- fghh45sdfhr3 14y agoThe article makes some good points, but I think they apply almost equality to both science and engineering, and frankly everything else.
- deleted 14y ago[deleted]