Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

Interfaces, DI/IoC, unit testing

$
0
0
So I know about these things however recently I keep thinking FAR too deep into things and I am now a little confused myself. I wonder if someone can help me untangle myself.

in your n-Tier design, for the sake of argument lets use this:

UI
BLL
DAL
Common (which contains entities/DTO's)

Why would you want to use interfaces between the UI, BLL and DAL?
I understand it from a Factory design pattern POV (point of view) where it can return an interface, depending on the parameters/configuration it will create a different concrete type - thats cool.

But other than that, why would you want to use interfaces here and how is it beneficial?

What about things like unit testing and mocking? you can easily using mocking to mock concrete classes rather than the interface itself and use that for unit testing. So why would you want to use interfaces for unit testing?

Finally, about DI/IoC - how is this beneficial? Isnt it the same as kind of like a factory pattern where depending on the IoC config, it will return you an instance of the specified concrete class in a certain assembly?

Arguments/debates please! I am a little confused within myself about this. Too many options and I know there is no one size fits all but would be good to have a discssion about this and why use x or y instead of z, the pros and cons about it.

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>