Cross-language coding standards?

I am looking for advice on conventions. The main languages ​​that I use in frequency order are C #, JavaScript and ActionScript. They are all based on ECMA languages, so for the most part, the syntax is interchangeable. What I would like to do is standardize the way code is written.

I looked at documents on coding standards and found some of them by various authors, including Microsoft, Adobe, Doug Crockford, and the authors of various books that I own. A significant part of the individual standards is identical. For example, do not use capitalization to distinguish between object identifiers. Good, that sounds good.

However, they are different in different ways, primarily for me in naming conventions. For example, using underscores in private property names or camel shells against the Pascal case for method names.

C # recommendations tend to differ from each other than ActionScript and JavaScript are made with each other, which makes it difficult for me, as this is more languages ​​and more code written. There is also the problem of automatic formatting in the IDE (for example, placing opening curly braces in functions in JavaScript against C #).

Any advice on how you could approach this issue? Any big pitfalls I don’t see? I understand that I can be pedantic, and that I am lucky to work in an environment where I do not need to conform to another standard. I hope to get some performance improvements and more readable code. Thanks.

+3
source share
5 answers

Idioms that make sense in C # will not necessarily make sense in Javascript (and vice versa), despite the fact that both use braces and semicolons.

- , Microsoft # , , jQuery Javascript. ( Pascal , #, "" , , JSON), .

+7

, , , , . , , .

Delphi #, .

+6

,

Microsoft #: camelCase ( - UpperCase). ( , / ).

, Microsoft; IMO : Microsoft, (, "" ) Microsoft (, "" ) .

, ++, , ( , UpperCase).

, / ; , - #, , SO, , .

0

, : . , , 5 , . .

, , (PHP, Java, Ruby), , , - , (, BASH).

But in fact, this is what you (and the rest of your team) agree. You do not get performance from a certain set of coding standards; you get productivity by having the same standards as the people you work with. If you want to release a full Hungarian camel case with an underline on top: more power for you, just make sure the whole team does this;)

0
source

Source: https://habr.com/ru/post/1717739/


All Articles