This Example App contains implementation examples for various patterns and practices that I use on a daily basis. I use this app to try out changes and explore methods of making my code more cohesive.

Testing

I am using the new features in Visual Studio 2012. MSTest, Fakes, Test On Build.

Domain Driven Design

http://martinfowler.com/tags/domain%20driven%20design.html

* The domain objects should encapsulate behaviour
* It should be easy to change the name of a domain object to match the real language in use (Ubiquitous Language - Eric Evans)

Repository Pattern

Persistence will be handled by repositories. A repository is solely responsible for mapping the storage mechanism to the domain.

* It should be easy to make changes to the underlying storage mechanism, i.e. adding or renaming a column
* It should be reasonably simple to change the underlying storage mechanism itself, i.e. switch from vendor A to vendor B, or switch from ADO.NET to EntityFramework
* A database table should be owned by a single repository

Type Safe Enums

I am using the Type Safe Enum pattern to handle the management of enums that are persisted.

Extension Methods

I am using simple extension methods to make some operations more readable, i.e.

myString.IsNullOrEmpty()

Rather than:

string.IsNullOrEmpty(myString)

Code Contracts

http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

Last edited Sep 26, 2012 at 2:17 PM by Sohnee, version 10