77
Does C# (or any other languages) have an official style guide like python has pep8?
(programming.dev)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Most languages with "official" formatting guidelines are due to limitations of the compiler/interpreter. Mixing whitespace in Python (or older Fortran) is a great way to error out massively.
For the more modern compiled languages, there is no need. But there still tend to be popular formats from companies like Google
You say this, but C# does have official code style conventions. It's not about the compiler at all but about ensuring a relatively homogeneous coding style across the ecosystem, so a .NET dev can work on different projects without needing to refamiliarize.
If indentation and newline policies prevent developers from migrating from one project to another then either your developer suck or your language does.
That said, C# is somewhat special in that it is both a language and a corporate flag by Microsoft. Similar to how Google pushes to have their style guides made public so that other projects will adopt them. Which has less to do about making it so that one developer can bounce between projects (because they should be able to anyway) but to instead push Google as the goal everyone aspires to and emulates.
There's a lot more than indentation and newline policies. The default editorconfig is a few hundred lines. But there's also no reason not to standardize indentation and newline policies.
Standardizing within a project or even a company is important.
Standardizing across an industry or language is not
Feel free to point out a disadvantage. As a .NET dev I appreciate the semblance of consistency. Different codebases differ enough already, it's just easier on the eyes when everyone is using the same basic conventions.