开发者

.NET naming standard for class names with Roman numerals

I am working on a new project that involves government funding. As such we will have objects (classes, properties, methods) that reference government legislation which have names like Title II, Title IV-A, Title IX, Title XVI, etc.

We are following the Microsoft guidelines for names but Pascal/camel casing for those does not read nicely to my eyes at this point. With Pascal casing, I get classes named TitleIi, TitleIva, TitleIx TitleXvi. Camel casing gives me variables with titleIi, titleIva, titleIx, titleXvi.

Another option would be to use arabic 开发者_如何学Cnumbers instead of the Roman numerals. That gives me Title2, Title4 which reads better but gives the impression that we have multiple instances of something (for example, AddressLine1 and AddressLine2).

I'm looking for suggestions on this.


I suggest you do what is most readable in your code base. If camel casing is causing legibility issues, then don't follow that guideline in this instance.

They are only guidelines, not rules.


At the end of the day naming conventions are just that - "conventions".

In your example I would use title_IV_A or Title_IV_A - you'll be saving yourself a headache and making life easier on yourself.


I'd just ignore the guidelines and name the classes TitleII, TitleIV_A etc. (note that you may need to replace the "-" by "_").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜