'''Note 2004 this page extended to include matters not necessarily related to JavaPlatform''' How should we design good Web applications? In ServletDesign a few people advocate ModelViewController. Should this pattern be applied to Web applications generally? -- FabianLeGayBrereton ---- I don't really see the applicability of ModelViewController to Web applications. I can see the attraction in separating the view from the model, but that's about it. I certainly don't see any need for ObserverPattern, CompositePattern, StrategyPattern or any of the other patterns associated with ModelViewController. I'm probably missing something. Perhaps it's particularly useful in relation to ServletDesign, which I'm not familiar with. My experience with Web applications has been in the MicrosoftWay. I use the FacadePattern. I have a script for each of the functional areas of the Web site, this is where the HTML lives. Each script interacts with the model through a facade. -- FabianLeGayBrereton I see the applicability of ModelViewController. It's one reason why I started JavaServerFoundationClasses. -- TimTaylor ("T''''''oolMan") ---- Perhaps your experience has not been wide enough. For example, I have seen the StrategyPattern applied in a Web application just recently. We needed to be able to format a page in either HTML or plain text. A perfect example of a strategy! Also, we foresaw the need to format the page in XML in the future -- another strategy! With regard to the ModelViewController pattern -- the notion of ServletDesign (especially when combined with JSPs) is greatly different from the MicrosoftWay. In this architecture (promoted by Sun and IBM): * JavaServerPages represent the view. They should be almost entirely HTML, using the tag and the tag to display dynamic information from the model. Simple HTML code generation is OK too, but should be abstracted into a JSP superclass whenever possible. * Servlets represent the controller. They direct the "flow" of the application, taking input from the user and interacting with the model to process information. Servlets are responsible for choosing which JSP (view) to display next. * ''In the MicrosoftWay ASPs fulfill both of the above roles in the architecture. Now I'm interested in how I might separate the view and controller using ASPs - does anyone have a suggestion? -- Fabian.'' * ''Without the ability to forward a request to another page, you are left with HTTP redirect, which is ugly. My best practice: each page is a controller. Model is implemented as included files that declare functions (FunctionalProgramming in VBScript is fun!). Each view is a file that defines a single (public) function. So, each page becomes a set of includes, and decision logic to determine which model actions to invoke, and then which view to invoke. Avoiding global variables requires a lot of discipline. Oh, for the elegance of Struts... http://jakarta.apache.org/struts/ '' -- HansGerwitz * ''Several MVC techniques exist in the PHP world -- with an underlying architecture very similar to ASP. Maybe the most common way is to have forms point to the controller, which is usually a page with one big code block (no markup). That page then does any processing, and includes the view, setting global variables to pass information and state. There is certainly nothing keeping you from doing MVC in ASP or PHP, even though that is not the most immediately intuitive way to work with those systems. In light frameworks like these, it is up to you to introduce your own standards and systems to organize your software. '' -- IanBicking After more Wiki, I now am thoroughly confused about whether I should have used PresentationAbstractionControl terminology. * JavaBeans and EnterpriseJavaBeans provide the model. The guts of the application are held here in the domain-specific logic of the beans. These are reusable and should be portable to applications written using other UI technologies (like JavaSwing). -- KyleBrown ''This discussion helped a lot. I was trying to figure out where M, V, and C were in my MicrosoftFrontPage pages. Thanks!'' ---- '''WikiPages on WebApplicationDesign specifics''' These include: * DontPutGuidsInUrls ---- '''WebApplicationDesign resources''' Forums where web design people gather, share, discuss, trade and form communities. Add your forums to the below list and let us grow together! *Web Design Forums (http://www.online-web-design-course.com/forum/) ---- See http://virtualschool.edu/wap for downloadable software and articles about WAP, the Web application architecture described in the May 2001 Dr. Dobbs' Journal article. -- BradCox See also WebsitePatterns, WebFormMethodologies CategoryWebDesign