In this article Billy McCafferty presents S#arp Architecture, an ASP.NET MVC architectural framework meant to leverage current best practices in architecting ASP.NET web applications by providing a project code template which uses Domain-Driven Design techniques and has built-in support for NHibernate, Castle Windsor and SQLite.
Read: A Fusion of Proven Ideas: A Look Behind S#arp Architecture
McCafferty starts with a review of current trends in web applications architecture design: abstracted infrastructure, loose coupling, TDD and DDD. He outlines some of the lessons learned by the software community as the foundation for S#arp Architecture.
S#arp Architecture offers a project code template which uses the following frameworks and techniques:
- The Separated Interface pattern, in conjunction with the Dependency Injection pattern, for removing concrete dependencies on a data access layer from the domain and controller logic;
- The Repository pattern, for encapsulating data access concerns within discrete classes adhering to the Single Responsibility Principle;
- The Model-View-Controller pattern, realized with ASP.NET MVC, for introducing a clean separation of concerns between the view and controller logic;
- NHibernate, and its Fluent NHibernate extension, for removing the need to develop and maintain low level data storage and retrieval coding while keeping the domain in blissful ignorance of the persistence mechanism;
- Common Service Locator, with a default of Castle Windsor, to provide a loosely coupled means of interacting with the developers preferred IoC container;
- SQLite in-memory database for running behavior-driven tests versus those that emphasize integration with a persistent database;
- Visual Studio Templates and T4 Toolbox to generate project infrastructure and common CRUD scaffolding for each domain object to remove hours of redundant and tedious coding.
S#arp Architecture is currently an RC2 release targeted at ASP.NET MVC (RC2) web applications and uses NHibernate 2.0.1. A final release is to come soon.