![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
C# Coding Standard
I wanted to know if anyone knows the C# Coding Standard from idesign and what one thinks of them.
I think they are kind of pushy on some things. I also don't agree with their member variables having a name that starts with m_ . Underscores are not for OOP, this of course is my personal opinion, but I don't see any underscores in the API either. I also don't agree that many assertions should be made, like it says: using System.Diagnostics;
object GetObject()
{...}
object someObject = GetObject();
Debug.Assert(someObject != null);if(someObject != null); instead of Debug.Assert(). I come from a C/C++, Java background so C# is easy, but can someone tell me if I should use the internal keyword and when I should use it instead of private or protected? One last English question: Under "Naming Conventions and Style", #24 it says: Quote:
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
OK, let's see... my advice: take what ya like, and disregard or make up new rules when you don't like something. The best coding standards are ones you write yourself.
|
|
|
|
|
|
#3 | ||||
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 211
Rep Power: 4
![]() |
Quote:
If private/protected variables are all given an m_ followed by a descriptive name you can use names for function arguments freely without having to worry that one might already be in use. It also prevents accidental masking of what should be standard names. This is the only place I use the '_' and IMO helps re-enforce OOP principles. Quote:
Quote:
Quote:
... it's all the same though.-MBirchmeier |
||||
|
|
|
|
|
#4 | ||
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 4
![]() |
Quote:
Quote:
You can also use "protected internal" which is like internal but also allows access in any classes derived from the classes containing the internal data or methods. |
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|