开发者

Designing an MVC (web) application from scratch – What Are the basic (necessary and optional) components I should be aware of?

I’m about to write quite a big web site that will basically be a forum, divided to (many) different subjects and allow users’ score.

I’ll be using MVC, so I (“naively”) asked this question about how to partition the Model portion  of MVC, which is likely to be very large.

Two things I realized from the answers I got:

  1. I really don’t know much about designing software.
  2. There are many ways to implement MVC

So I have now two questions:

  1. (That’s a bit theoretical-) Would you say designing a software is completely deterministic i.e.- For a specific s开发者_StackOverflow中文版et of requirements there is one best design? If not- why?
  2. What are the common components (necessary and optional) of MVC that I should consider in writing my site (resources for beginners would be great)?


Although Java/JSP/Servlet targeted, you may get some useful insights out of this answer. It describes the common patterns to be used in MVC and the approach how to fit them all together. Here's a summary:

  • Front Controller pattern (Mediator pattern) - the controller
  • Strategy pattern - the business actions
  • Abstract factory pattern - to let controller obtain the desired business action.
  • Facade pattern - to abstract the raw HTTP details away.
  • State pattern - to introduce a lifecycle which abstracts gathering of request parameters, validation, conversion, updating model values, etc away.
  • Composite pattern - to create an advanced component tree for the view.


For ASP.Net MVC, a good entry level, free tutorial is the 'MVC 2 Music Store' by Jon Galloway. You can find it here. Note that the current version of ASP.Net MVC is MVC 2.

A more thorough tutorial is the Nerd Dinner tutorial. However the creators are still in the process of updating it to MVC 2. You can check for updates and downloads here.

I would recommend using resources for MVC 2 as there are some significant improvements over the first version. Also MVC 3 is on the horizon and you want to hit the ground running.

I would also recommend keeping an eye on MVC 3 improvements if you're serious about getting up to speed in this space. A good blog to subscribe to is Phil Haack's Haacked. Phil is the project manager for MVC at Microsoft.

In terms of textbooks, the gold standard is Steven Sanderson's 'Pro ASP.Net MVC 2 Framework'. The first review on Amazon is from Scott Guthrie, a Microsoft VP, who raves about the book. He also has a competing book of his own. You can get the ebook from Apress here. Do a google search for Apress promo codes and you may save a few dollars.

Good luck.


Software is definitely not deterministic. Theories in programming are constantly developing and improving, which is what makes the field such a fast-paced and exciting place to work. Also, what may seem like the best approach to a software problem right now could be obsolete in a matter of months by a newer, improved technology.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜