views:

114

answers:

4

I am going to start a project of my own, which will be ASP.NET MVC + Fluent NHibernate. I want to use test-first approach as much as I can. So, where exactly do I start from? Database schema? Domain model? Mapping domain model classes to the database?

+3  A: 

Start from the domain model (or a higher level just below the UI). Then when you have driven the design of the domain model with TDD, then you will know that what the database schema needs to be like. It's better to postpone introducing a database to the system, because dealing with database schema migration will add some overhead to the development. And that will also lead to a better design, because then the domain model will be better decoupled from the database layer.

Esko Luontola
+2  A: 

Requirements gathering.

AaronLS
+1  A: 

Start with a mock/prototype (e.g. Balsamiq Mocks) of the application, then writre the views, mocking controllers as you go along, then write the controller logic, mocking the DAO/Repositorys along the way. By the time you start writing your DAO/Repositories, you'll have a good idea of your your required domain objects. Knock those out and use Fluent Nhibernate to build your database.

At least that's they way I'm trying to do things.

Jaimal Chohan
+1  A: 

I recommend you S#arp Architecture Project that uses best practices combining:

  • NHibernate
  • FluentNhibernate
  • TDD / DDD with model firts approach with Sqlite database for unit testing
  • Mocking
  • Repository pattern

You can also install S#arp arch. template for Visual Studio IDE.

dario