3

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 choice?

Richard
  • 43
  • 1
  • 5

4 Answers4

7

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

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • That's a good point, but the function of the web service I am using is to send data to an iSeries server. The actual name of the service begins with "iSeries". Am I stuck or just missing something obvious? – Richard Jan 17 '11 at 14:03
  • @Richard - You can name your classes anything you want. If the service provides weather information, I would call it `WeatherService` regardless of what the actual service proxies are called. – Oded Jan 17 '11 at 14:11
1

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!

Philipp
  • 11,549
  • 8
  • 66
  • 126
0

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'.

Dave
  • 3,581
  • 1
  • 22
  • 25
-1

"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.

jason
  • 236,483
  • 35
  • 423
  • 525
  • It's not that the service is running on an iSeries (yes, newer(ish) name for an AS/400, I believe the new(est) name is System I or something), it's that the service talks to an iSeries server. – Richard Jan 17 '11 at 14:08
  • Okay, but what is it talking to the server for? Almost surely the specific server-type doesn't matter (imagine it's payroll processing and the backend service is on an iSeries but it was on an AS/400; the correct name is `PayrollService`, not `AS400Service` or `AS400PayrollService` or `ISeriesService` or `ISeriesPayrollService`). Take the name from what the service is doing, not what is doing the service. – jason Jan 17 '11 at 14:30