ReviewMicrosoft N Layer App Sample, Part III–Abstraction is as abstraction does

time to read 2 min | 364 words

Continuing my review of, an Official Guidance (shows up at: which people are expected to read and follow.

This quite annoys me:


Why is it annoying?

Because of the author note, it implies that you can switch the implementation to something else. Except that you really can’t.

Take a look at the actual interface, what does it means TraceStop, TraceStart, TraceStartLogicalOperation, TraceStopLogicalOperation? Well, they are all about expose functionality that exists only for the System.Diagnostics stuff.

Too add to the gravity of the situation, there is no where in the code that is even using those methods!

And there there is the actual usage of the trace manager:

No, before that, even, there is the actual name. ITraceManager? Because ILogger or something like that wasn’t important enough? What, pray, does implementer of this interface are going to manage? There is no managing, so there shouldn’t be a manager.

And there there is the actual usage of the trace manager:


Well, let us imagine that we wanted to read the logs of this application. We can’t, because the application, while having a log, is actively hiding important information. Namely, the full exception (including all the inner exceptions and stack trace).

But we will ignore that as well, and say that we want to move to log4net. Guess what, you can’t! Well, you can if you want to get a flat log, but one of the most important features of the log4net is the idea of loggers, that you can dispatch some messages based on their origin to different location (for example, color them differently when writing to the console).

You can’t do that, there is no way of saying what the origin is of anything here.

I’ll touch the “IoC” stuff in a future post, I think that this is enough for now.

More posts in "Review" series:

  1. (20 Jun 2017) Summary
  2. (19 Jun 2017) Part III
  3. (16 Jun 2017) Part II
  4. (15 Jun 2017) Part I