You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/01/15 16:07:38 UTC

DO NOT REPLY [Bug 16108] New: - Newbie FAQ - Why is ActionForm a base class rather than an interface?

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16108

Newbie FAQ - Why is ActionForm a base class rather than an interface?

           Summary: Newbie FAQ - Why is ActionForm a base class rather than
                    an interface?
           Product: Struts
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Documentation
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: edgar@blue-moose.net


Thanks to Craig...I hope I have sanitized this one enough.

The MVC design pattern is very simple to understand.  It is much more difficult 
to live with.  You just need this little bit of Business Logic in the View 
logic or you need just that little bit of View logic in the Business tier and 
pretty soon you have a real mess. 

By making the ActionForm a class it is taking advantage of the single 
inheritance restriction of Java to it makes it more difficult for people to do 
things that they should not do. 

ActionForms implemented as interfaces encourage making the property types match 
the underlying Business tier instead of Strings, which violated one of the 
primary purposes for ActionForms in the first place (the ability to reproduce 
invalid input, which is a fundamental user expectation).  

ActionForms as an interface would also encourage using existing DAO objects as 
ActionForms by adding �implements ActionForm� to the class.  This is against 
the MVC design pattern goal of separation of the View and Business logic.

Since the goal of struts is to enforce separation of the View and Business 
logic, it just makes more sense for Struts to own the ActionForm.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>