The thing is that the codes aren't that general. They always refer to something very specific. Its just that most people assume the specific thing is parts. Meanwhile the very specific thing is some reading from a circuit. The engine's computer can't "see" parts - all it can do is send and receive electrical signals. Really getting it is a matter of knowing exactly how a particular system under question works so that you can take into account all of the things that might generate a particular code - and even the conditions under which the code is generated.
Factory service manuals have complete info about this kind of thing - they specify the conditions under which a code is set (the actual conditions as programmed into the computer logic, as in "if this, and that, but not this..."). Then they include complete trouble shooting steps to pinpoint the actual issue. I'll be the most common first step is inspection of wiring and harnesses & voltage/continuity checks.
Many people, including those in the auto industry, don't understand the codes and do misinterpret their meaning. As such, throwing parts is probably the most common approach to codes. Its just that its the basic approach for those who don't really understand what is going on. However, I will say that there can be instances where the diagnostic procedures, while correct, may be so time consuming that an educated guess could be smarter than paying for the diagnostic time.