What styles of code design does the Github audience prefer?

    Spaces or tabs? Double or single quotes? Open braces from a new line or in the "Egyptian" style? Around these source code agreements, holy wars constantly rage. However, few people decide to argue that if you work in a team, you need to write as it was in the team, or at least reformat your code in the accepted style before committing. In the end, if some style had an absolutely decisive advantage over another, then there would be no disputes, so perhaps the wisest decision is to make it like everyone else.

    And how do everyone do it? On the website sideeffect.krGithub commits statistics for several months for JavaScript, Ruby, Scala, C #, Java and Python. For each language, several typical disagreements in the design of the code are highlighted, and it is calculated which option the community is inclined to.

    In the most popular holivar, “spaces versus tabs,” spaces won a decisive victory. Most tab lovers remain in the Java camp - 24.6%. Least of all - among Scala programmers - 3.3%. But in some other issues there is no consensus. So, those who like to use uppercase to name constants in Java are only 3% more than half, and C # writers use three different styles for constants (caps, Pascal style and whatever) with almost equal frequency. Supporters of double and single quotes in JavaScript were almost equally divided.

    Some conventions are opposite for different languages. So, the vast majority (86%) of C # programmers open a curly brace on a new line. In Java, the opposite is true - only 19.8% adhere to such an agreement. The rest use the "Egyptian" style.

    This project was created for the GitHub Data Challenge II competition for the analysis and visualization of open GitHub data, its code is published on the Github under the MIT license, so that you can add new languages ​​and new conventions for the design of the code there.

    Also popular now: