The State of the Stack
About a year ago, I started this blog. In the first post I stated these goals:
I want all the code I write to be under automated test. This is currently only a goal though, not a reality. Understanding how to best deal with external interfaces, in particular the database and UI, represents an ongoing learning process. To do the job properly, you need to have capability across the whole stack...so I choose, for now at least, to focus on: Windows, IIS, SQL Server, C#,Asp.netAsp.mvc and JavaScript/JQuery.
During the year I worked on a project, building an application in Mvc from scratch. Mvc was a real pleasure to work with, and surprisingly didn't take long to pick up. There's normally quite a painful learning curve with a new framework, but Mvc was OK.
On the testing side the big break through for me was the repository pattern. Using repositories tames the database interface, and makes the model unit testable. In general applying the Dependency Inversion-Dependency Injection (DiDi) pattern to all external interfaces, ensures the model is never directly bound to an external interface, and allows substitution of the interface during testing.
Once you get to injecting dependencies for external interfaces, the natural progression is to inject dependencies for all objects, which in turn leads to a dependency injection tool. We used StructureMap, which seems to do everything you need and is reasonably well documented. I would recommend it to others, though I have no experience of its competitors.
The guys at work are committed to a Data Layer, built with code-gen and for data objects and CRUD stored procedures. I think this approach is pants. The killer problem for me is no caching. I tried out Fluent NHibernate. The Fluent mapping stuff works very well, and you get lazy loading and caching out of the box. Understanding how to set it up took a bit of a while.
The other area I've spent time on is the client: Html, Css, Javascript and JQuery. I'm still quite beginner at JavaScript. It's a fascinating language, seemingly requiring skill and discipline to write well, but allowing great flexibility and creativity.
So this where I'm up to on the architecture of a web based application using Asp.mvc:
And these are the posts I've written about the various bits of the stack:
Html and Css
- CSS Selectors
- CSS Enlightenment
- CSS Block verses Inline
- CSS Simple Form
- XHTML - What’s that all about?
- Browser Differences
- CSS Shorthand Properties
Javascript and jQuery
Web Layer
Model
- Simple Repository Pattern
- Unit Testing with the Repository Pattern
- Active Record verses Repository
- Unit Testing with Email
- Dependency Inversion and the Repository Pattern