Search code examples
wpfdesign-patternsprismanti-patternsprism-4

Why does Prism encourage use of the Service Locator anti-pattern?


As I move from MVC to doing some WPF with Prism, I buy a Prism book and once again i'm shocked to still see the Service Locator which is a known anti-pattern. I have read the books like Dependency Injection in .NET and Mark Seemann thoroughly goes through WHY Service Locator is an Anti-Pattern.

I am simply trying to help be an evangelist of best patterns and practices and would like to know who is NOT getting the memo that some of these patterns are actually bad.


Solution

  • There certainly is a balance between Science and Art. Patterns are discovered not intentionally invented. Some languages lend themselves to be subject to more software engineering principles. There certainly is a lot of room for discussion on this. I think that you are right to question the use of something, but I am not sure if you will find your answer as your other question you mentioned shows that the "VERY" well known folks seems to disagree with each other.

    I need more clarification on the matter in needed and the context in which it is used. Overall I think the use of these "anti-pattern" should be analyzed. Singleton I read is bad, but we all know it has a purpose.