Docs: Pure Domain Layer

Created on 28 Apr 2020  ·  3Comments  ·  Source: dotnet/docs

@Andrusha26 commented on Tue Apr 28 2020

Is it okay to inherit from INotification, which cause dependency on MediatR lib? How we can avoid it?


Сведения о документе

Не вносите правки в этот раздел. Это необходимо для связывания страницы сайта docs.microsoft.com с вопросом на GitHub.


@srvbpigh commented on Tue Apr 28 2020

Hello, @Andrusha26

Thank you for your feedback.

We are actively reviewing your comments and will get back to you soon.

Kind regards,
Microsoft DOCS International Team

guide - .NET Microservices Area - .NET Architecture Guide product-question

Most helpful comment

Hi @CeciAc,

Well, as usual, that's an absolute "it depends" 😉.

It might be a requirement in some context or just an opinionated decision, so there's no black and white here, IMHO.

How to avoid it? The only way I can think of would be to create your own abstraction, which means more complexity or, at the very least, more code you have to write.

I see MediatR as just another library that I like and use a lot, BTW, because it makes my life as a developer much easier.

For this kind of decisions I compare the business value I have to deliver, with the cost of:

  • Developing my own abstraction.
  • Developing my own implementation.
  • Developing and maintaining the related test cases.
  • Discovering and handling the corner cases.
  • Fixing bugs and adding features (and tests).
  • The opportunity cost of fixing bugs and adding features, That is, what you'd be doing if you weren't fixing bugs and adding features to you library.
  • Document all of the above for the developers that will come after me.

Of course you can create your own abstraction and have an absolutely pure domain layer, you just have to consider the associated costs and risks. If that makes sense, then go for it, the customer will understand the hours dedicated to develop that as a feature.

Hope this helps.

All 3 comments

Hi @CeciAc,

Well, as usual, that's an absolute "it depends" 😉.

It might be a requirement in some context or just an opinionated decision, so there's no black and white here, IMHO.

How to avoid it? The only way I can think of would be to create your own abstraction, which means more complexity or, at the very least, more code you have to write.

I see MediatR as just another library that I like and use a lot, BTW, because it makes my life as a developer much easier.

For this kind of decisions I compare the business value I have to deliver, with the cost of:

  • Developing my own abstraction.
  • Developing my own implementation.
  • Developing and maintaining the related test cases.
  • Discovering and handling the corner cases.
  • Fixing bugs and adding features (and tests).
  • The opportunity cost of fixing bugs and adding features, That is, what you'd be doing if you weren't fixing bugs and adding features to you library.
  • Document all of the above for the developers that will come after me.

Of course you can create your own abstraction and have an absolutely pure domain layer, you just have to consider the associated costs and risks. If that makes sense, then go for it, the customer will understand the hours dedicated to develop that as a feature.

Hope this helps.

Hi @CeciAc,

Well, as usual, that's an absolute "it depends" 😉.

It might be a requirement in some context or just an opinionated decision, so there's no black and white here, IMHO.

How to avoid it? The only way I can think of would be to create your own abstraction, which means more complexity or, at the very least, more code you have to write.

I see MediatR as just another library that I like and use a lot, BTW, because it makes my life as a developer much easier.

For this kind of decisions I compare the business value I have to deliver, with the cost of:

  • Developing my own abstraction.
  • Developing my own implementation.
  • Developing and maintaining the related test cases.
  • Discovering and handling the corner cases.
  • Fixing bugs and adding features (and tests).
  • The opportunity cost of fixing bugs and adding features, That is, what you'd be doing if you weren't fixing bugs and adding features to you library.
  • Document all of the above for the developers that will come after me.

Of course you can create your own abstraction and have an absolutely pure domain layer, you just have to consider the associated costs and risks. If that makes sense, then go for it, the customer will understand the hours dedicated to develop that as a feature.

Hope this helps.

thank you so much, for the response, make sense

Closing this issue as @mvelosop has addressed this. Please feel free to reopen if you have more questions.

Was this page helpful?
0 / 5 - 0 ratings