views:

184

answers:

2

Why is the Process class part of the Diagnostics namespace?

This is a part of design of the BCL that kept me wondering for some time now. I find it kind of counter-intuitive, I fail to see the connection between Process and for instance the Debug and Trace classes.

+7  A: 

The process class doesn't just represent a single process. It has a ton of information about the running processes on the computer. This info can be used to find problems or just get general information about your system state.

you can see the diagnostics namespace description here: http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx

and the process class description here: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

Scott M.
Yes, good point. I am aware of the info functions but tend to see Process mostly as the vehicles for .Start().
Henk Holterman
Is this a satisfactory reason to have it tucked away in the diagnostics namespace? After all the Process class allows you to instance new processes and to access the Standard Input, Output and Error streams. These are hardly diagnostic functions.
AnthonyWJones
imo the answer below gives a more complete and thought out reasoning, and it makes more sense. The process class has a lot of diagnostic functions, and the designers didn't want to split the class over more than one namespace.
Scott M.
+8  A: 

Well, according to the documentation, "The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters." So I guess by definition it fits. :-)

But yes, it does seem a bit like an overloading of terms by putting it next to things a bit more obviously diagnostics-related (tracing, performance counters).

Still, I would say that the Process class is as much about monitoring running processes as it is about starting new ones. Monitoring is generally accepted as a diagnostic activity. Furthermore, it might be less intuitive to most programmers if the framework had split up functionality pertaining to the same item in separate namespaces. So I can see the logic of including it here.

bobbymcr