views:

276

answers:

2

In response to an answer posted by Marc Gravell and his suggestion via email, I was wondering:

What choices do people make when deciding on their architecture for a new project?


This question could serve as a decent reference point for links/ideas/suggestions/architecture decisions, anything really that is of interest when deciding the best way to approach a new solution.

I am currently working on an ASP.NET MVC application - mainly as a exercise to increase my experience of the new framework - that works with an ExtJs front end passing Json objects between the layers.

Testability is very important so my .NET layer uses interfaces to define contracts and consists of a service layer, which handles data validation and application logic, which in turn interacts with a repository layer that just handles the data persistence and retrieval. All allowing me to test quite thoroughly.

I have a custom model hierarchy that is based on the database, however, it is not related to any ORM (I am using LinqToSql at present) tool tying it to a particular platform. My repositories return my custom models and not their own database structures, which will hopefully allow me to develop different repository implementations in the future without too many problems.

Another reason for this approach was that I am working with a legacy database that has some interesting design choices and cannot change the structure too much at present, so I wanted a bit more control over the resultant models.


All this may seem completely wrong to some of you so tell me what you think ;)

+2  A: 

It sounds like you are on the right track. Personally, in the current incarnations, I would always choose MVC over web forms. Web forms abstracts too much from the underlying model and I find it is usually more trouble than it is worth. Only if you can safely predict that you can stick tight to the model web forms was designed to handle, work within the out-of-the-box pattern, and do not care much about testability, would I recommend web forms.

The only other scenario where web forms might make sense is if you have a team of people highly ingrained with this technology and want to keep inline with existing application stacks. Even then, for the growth of your developers and long-term product maintenance (post transition), I still recommend MVC if you can swing it.

That said, Microsoft will probably continue to support the web forms model for some time and eventually the two models will probably become easier and easier to plug and play or interchange with one another (based on conversations I have had with a couple of the ASP.NET team's program managers).

A: 

while enticing at first, for me, webforms become difficult to manage as the application grows. with mvc, relationships are more natural and consistent with ideals.

zsharp