Nathan M. Andelin wrote:

From: "Hans Boldt" <boldt@xxxxxxxxxx>
Applications written using a framework like J2EE (among others)
naturally fit into an MVC framework, since different tools are used
for each component.


I wouldn't agree that J2EE applications naturally fit into an MVC design
pattern.  Consider the following Servlet example from Sun's tutorial:

import java.io.*;
import javax.servlet.*;
public class SampleServlet implements Servlet {
  private ServletConfig config;

  public void init (ServletConfig config)
    throws ServletException {
    this.config = config;
  }

public void destroy() {} // do nothing

  public ServletConfig getServletConfig() {
    return config;
  }

  public String getServletInfo() {
    return "A Simple Servlet";
  }

  public void service (ServletRequest req,
    ServletResponse res
  ) throws ServletException, IOException  {
    res.setContentType( "text/html" );
    PrintWriter out = res.getWriter();
    out.println( "<html>" );
    out.println( "<head>" );
    out.println( "<title>A Sample Servlet</title>" );
    out.println( "</head>" );
    out.println( "<body>" );
    out.println( "<h1>A Sample Servlet</h1>" );
    out.println( "</body>" );
    out.println( "</html>" );
    out.close();
  }
}

In a more complex example, database I/O logic might have also been embedded
in the service method along with the UI logic.

Similarly, one might find UI control and DB I/O logic embedded in a JSP
page.

My point is that J2EE, like ILE CGI, leaves it up to the programmer to
implement MVC design.  CGIDEV2 and other ILE frameworks support MVC design
just as much as J2EE does, through HTML templates, and the ability to place
DB I/O logic in ILE modules separate from control logic.

At least we both agree that MVC design is very important ;-)


Touche! (I *knew* I left something out of my rant!) OK, maybe MVC and J2EE aren't that natural a fit since you can still put everything into the "Controller" if you really wanted.


Sure, there's always the possibility of well designed RPG-CGI apps and poorly designed J2EE apps. But it still takes much more discipline to implement an MVC design in a RPG-CGI or workstation DDS environment than it does in a more advanced framework. In J2EE (for instance), at least you have different technologies for each of the pieces. And so the pieces fall much more naturally into the appropriate places when servlets, JSP's, and beans are used.

Cheers! Hans



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.