In this post I’ll try and give a high level overview of what SA is and what it brings to the development process.
What is SA?
SA is an open source architectural base on top of which you can rapidly build applications leveraging NHibernate. Although the principal UI focus is web applications, specifically ASP.NET MVC, with a little tweaking you can use SA with WPF, Win Forms, WCF & standard ASP.NET applications.
So what does SA actually contain? At the core of the project is an N-Tier solution template which pulls together various open source projects such as NHibernate & Fluent NHibernate and wires them all together in a loosely coupled architecture. The solution template is pulled into a Templify (http://opensource.endjin.com/templify/) package and setting up a new MVC & NHibernate project becomes as easy as deploying the Templify package to a folder on your machine.
Because everything is wired up for us we no longer have to write all the plumbing code which holds the whole application together so we can get straight into creating the actual application. The focus of the development work essentially shifts onto what the user actually wants and sees whilst giving us an architecture which allows us to write maintainable, testable and extendable code.
But what if you don’t want to use MVC? That’s absolutely fine, although you will lose the ability to use the Templify package you can manually set up a project based on SA in an hour or so and still get all the benefits of the architecture.
Do I have to use NHibernate?
SA grew from the excellent NHibernate Best Practices article on code project. As NHibernate moved onto version 2 Billy McCaffery, the articles author, started the SA project to try and provide a simplified and more maintainable architecture while still leveraging the best NHibernate had to offer. Because of the way the project started the data access solution has always been geared towards NHibernate.
Does this mean you are forced to use NHibernate? No absolutely not, with a little work you could plug in any of the popular ORM solutions or you could use a stored procedure based data access layer. Unfortunately by doing this you are likely to lose some of the productivity benefits of SA as you’ll have to wire up the selected data access solution but you’re still left with the same core architecture. If you find yourself using the same data access method time and time again you could split the project and creating a version specific to your selected data access method.
Does it fit every project?
For small projects such as websites with a handful of pages and some small forms SA is probably overkill. The real benefit of using SA starts to come out when you are looking to build larger systems which involve a fair sized domain model and all of the business logic which goes with it.
In my previous employer we used SA for every non trivial project we started. As more SA projects came online we found that because every application had a similar structure developers could quite easily flit between projects and acclimatise to a new project fairly quickly. We found enormous benefits in being able to open up the code of a colleague who was on holiday and to know just how the app was structured and where we should start debugging any issues.
Future versions
Version 2.0 is currently in RTM and is expected to be released in the next couple of months. The roadmap for V3 is underway and there is a committed development team and community behind the project.
As the project grows and moves through iterations the coupling with certain components, including NHibernate, has been loosened. The focus of the project has shifted from providing an NHibernate related architecture to providing an architecture which pulls together some best practice concepts and design patterns. As the project progresses I think we’ll start to see more options supported on the data access front.
Links
The links below are handy if you would like to find out more:
github site – contains the source and the project wiki
SA cookbook on github – examples (recipes) of how to do common tasks using SA
Google groups – mailing and discussion list
Who can help me on github - an open source project which originated out of Conchango (now a part of EMC Consulting) which extends SA
