Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Coding Style as a Failure of Language Design (mozillazine.org)
2 points by mgunes on July 27, 2010 | hide | past | favorite | 1 comment



I think one of the bigger cases of "forced inconsistency" is with inheritance. Unfortunately, if you have a class with methods like fooBar() that inherits from something that uses a different convention, e.g. to implement STL methods like max_size(), then you will have 2 conventions in the same class.

And yet, what's interesting is that naming inconsistency seems to be a C++ problem. You could argue that it is just as technically possible to do weird name inheritance in Objective-C, and yet it doesn't happen; the conventions of Cocoa are somehow applied consistently enough, and followed by developers to the letter.

The funny thing about Objective-C is that you see a different kind of style problem; indentation and alignment tend to vary a lot more between code snippets than they do in C++.

I'm not sure that automated enforcement after the fact is the answer, because the scanner might be pretty easily fooled (or worse, it may refuse to let you do something you know you want).

IDEs might be the closest thing to "enforcement", since they try to make it easy to create new code snippets, and those will naturally follow a certain style. At some point, if one is used to these tools, it may be simpler to follow the rules than not follow them. On the other hand, I generally hate IDEs, and I enforce my style by myself. :)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: