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

time to read 2 min | 364 words

Continuing my review of http://microsoftnlayerapp.codeplex.com/, an Official Guidance (shows up at: http://msdn.microsoft.com/es-es/architecture/en) which people are expected to read and follow.

This quite annoys me:

image

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:

image

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. (06 Sep 2018) Summary
  2. (05 Sep 2018) When the data hits the disk
  3. (04 Sep 2018) Reading data from disk
  4. (03 Sep 2018) The hash structure
  5. (31 Aug 2018) Working with the file system
  6. (30 Aug 2018) Digging into the C++ impl
  7. (29 Aug 2018) Let’s check these numbers
  8. (28 Aug 2018) Let’s start with managed code
  9. (27 Aug 2018) Reading the paper