- Home /
Why does the C# scripting libraries not conform to .NET naming convensions?
As a person new to Unity, but a seasoned .NET developer, I find it highly annoying that the library was not written to look like everything else provided by .NET.
.NET has had extensive documentation on naming guidelines since its introduction: http://msdn.microsoft.com/en-us/library/ms229042(v=vs.110).aspx
I'm curious as to why it was designed this way? And I assume someone internal would have to answer the question :)
As an example, it seems all public properties are lower cased, which mono.net and ms.net do not do.
Additionally, on the Renderer class, they have the isVisible property, and the enabled property which seems inconsistent. Why not name it isEnabled?
This is a predo$$anonymous$$antly community forum, so you're unlikely to find an answer to a question that requires "someone internal". However, can you give specific examples of a na$$anonymous$$g convention that Unity uses that you find so annoying? I can't say there's anything that I've ever noticed.
Also, Unity doesn't use .NET as such (and it certainly isn't "provided by" .NET) - it uses $$anonymous$$ono - a cross-platform, implementation of C# and the CLR.
Granted, but $$anonymous$$ono's implementation of .NET uses the same na$$anonymous$$g conventions. So Unity deviates from that too.
I'm adding some examples in the question.
Answer by Owen-Reynolds · Apr 29, 2014 at 10:25 PM
Game programmers tend to come from a much more eclectic background than .NET programmers. Many have used one of: LUA to write WorldOfWarCraft AddOns, or a various python-like in blender/Max/Gimp, or Ogre's C++(?), or Torque's Bash-like language, or one of the many versions of Flash-script. I'd guess many Unity C# programmers don't even "think in" C#.
Having consistent naming isn't as helpful to people who aren't used to it and don't expect it (and weren't aware that there's an official phrase for "try to pick names people will understand.")
For the non-OP, C# is sort-of microsoft's language, and microsoft is a big world. There are older, well-paid professionals who have never used a non-microsoft product. In the corporate world, you work 9 to 5; and if you follow all the programming rules, you can't get into too much trouble. The OP isn't nuts -- just has a different background.
Enabled
is writable: dog.enabled=true
looks better to me than dog.isEnable=true
. Whereas isVisible
is read-only.
Answer by Jeff-Kesselman · Apr 29, 2014 at 07:52 PM
Because the C# naming conventions are really poor and limited.
Basically, they make everything public the same capitalization, which robs you of a lot of visual information.
There are a lot of good things in C#, but MSFT really dropped the ball on the naming conventions.
Regardless of your opinion, that is the standard way things in .NET are named. $$anonymous$$ono is a .NET implementation, and follows that standard. I personally don't find the convention poor, I find it very readable and descriptive. They've opted for descriptive names over meta-marking with capitols or symbols, which I love.
:)
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer
Admob code question 1 Answer
C# How to Detect Edges of a Collider 0 Answers