开发者

Starting a C# class name with a lower-case letter

I'd like some best-practice advice regarding naming a C# class that interacts with an iSeries web service. I'm thinking either iSeriesServiceProxy or ISeriesServiceProxy, but each have their (probably obvious) problems. The former violates "Class names should start with a capital letter", while the latter looks like an interface. I could just dream up another name for this class, but this is the one that feels right. Which (if either) is the correct ch开发者_开发技巧oice?


Choose a name based on the function of the web service, not the technology it uses.


I believe that you should decide for the class name that communicates best what's behind the class. So even if it would be "right" to name it ISeriesServiceProxy, I would not choose this name and rather use ServiceProxyForISeries or similar. This will lead to less confusion with your collegues!


There isn't really a 'correct' answer here - personally, I would capitalise the first letter of the class regardless of whether it starts with an 'I' or not. If you're not keen on that, I'd drop the lower case 'i' from the start of the class name so it's just called 'SeriesServiceProxy'.


"iSeries" as in the descendant of the old AS/400 series? That shouldn't be part of the name at all. You are agnostic to the machine the service is running on. The question is, what is the service doing? That's where you should find inspiration for a properly capitalized name.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜