Skip to content

Commit

Permalink
Updated Articles
Browse files Browse the repository at this point in the history
  • Loading branch information
garywoodfine committed May 3, 2021
1 parent 38545ce commit de92175
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Adapter/README.md
Expand Up @@ -9,6 +9,10 @@ The Adapter design pattern is a structural pattern that allows incompatible inte

This is essentially a physical implementation of the Adapter pattern. [Head First Design Patterns](https://amzn.to/3tSqSVo "Head First Design Patterns: Building Extensible and Maintainable Object-Oriented Software") provides a really good succinct definition of the Adapter Pattern.

> The Adapter pattern allows you to provide an object instance to a client that has a dependency on an interface that your instance does not implement. An Adapter class is created that fulfils the expected interface of the client but that implements the methods of the interface by delegating to different methods of another object.
>
> [Adaptive Code: Agile coding with design patterns and SOLID principles]()
### Two types of Adapters.

There are typically two kinds of of adapters:
Expand Down
12 changes: 10 additions & 2 deletions Mediator/README.md
@@ -1,9 +1,9 @@
## The Mediator Pattern


The Mediator Pattern one of the Behavioral Patterns defined by the Gang of Four in [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/2PdkTck )
The Mediator Pattern one of the *Behavioral Patterns* defined by the Gang of Four in [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/2PdkTck )

Mediator pattern is used to reduce communication complexity between multiple objects or classes. This pattern provides a mediator class which normally handles all the communications between different classes and supports easy maintenance of the code by loose coupling.
Mediator pattern is used to reduce communication complexity between multiple objects or classes. The pattern provides a mediator class which handles all the communications between different classes and supports easy maintenance of the code by loose coupling.

A mediator sits between method callers and receivers creating a configurable layer of abstraction that determines how callers and receivers get wired up.

Expand All @@ -21,4 +21,12 @@ Fortunately, in C# Jimmy Bogard, of [Automapper](https://github.com/AutoMapper/A

I prefer to use MediatR as my implementation of choice of the Mediator Pattern, because of its ease of use and versatility. I also learned alot about code by reading the MediatR source code. It is well worth cloning the repository and spending sometime just going through the implementation, it will provide one with a good sense of how to implement the pattern and also an appreciation of some of the finer points of the C# language.

### Why use the Mediator pattern
When working with Domain Classes where multiple functions are used to modify state and implement domain rules it usually becomes difficult to debug, extend and review the implementation. Often business rule functions implement multiple sub-rules that are repeatedly required elsewhere in the domain. This may lead to Multiple layers of complex abstraction required to share functionality or multiple strategies from several developers advocating different patterns and practices.

A common challenge in a codebase, is dealing with the constant flux of ever changing domain requirements and business rules.

Typically software software start out as simple CRUD applications, but gradually evolve to become complex as more rules and changes are introduced.



0 comments on commit de92175

Please sign in to comment.