Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

[an error occurred while processing this directive]

Java Notes

GUI Structural Patterns

Structuring the program - Separating the Model

In all ways of structuring a GUI program, there is one vitally important issue -- separating the code which is the essence of the problem from the user interface. This logical part is variously referred to as the model, business logic, abstraction, or document. This code must not refer to the user interface directly -- it will interact with the user interface code by returning values or invoking listeners.

Motivation. There are two compelling reasons for this separation.

  1. Lower complexity -- Programs end up being less complex and therefore easier (cheaper) to modify. For the smallest programs this may not be obvious, but the benefits show up very quickly as a program grows. This is not an advantage only in large programs.
  2. Interface Flexibility -- This allows changes to the user interface, eg, moving from Swing to SWT, or to a web interface. You should be able to use your basic logic code (if applicable) with the following interfaces.
    • GUI interface. And it should be easy to change between Swing, SWT, XML based GUI, etc.
    • Command line interface - yes, some Unix sysadmins might want to run it that way.
    • Web based interface.

Well-Known Patterns

MVC - Model-View-Controller Pattern
This classic pattern is widely used, altho the Presentation-Document pattern below is a more common (because it's simpler) choice for small programs.
  • The View component presents the output and may interact with the Model to do so.
  • The Controller component accepts user input. It typically interacts with both the View and Model.
  • The Model implements the logic, and knows nothing about the interface.
Presentation-Document Pattern
This pattern is perhaps the best choice for small GUI applications.
  • The Presentation contains all user interface code (the View and Controller).
  • The Document is the logic, model, etc.
PAC - Presentation-Abstraction-Control Pattern
This is the application of stepwise refinement to GUIs. Parts of the GUI are each implemented as in MVC, and these parts are put together using MVC. This is basically a recursively applied MVC model. It would only be used for complicated GUIs.
  • The Abstraction corresponds to the Model in MVC.
  • The PAC pattern has a hierarchy of agents, each structured in the PAC model.

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (
post your own) View All Comments Latest 10 Comments:
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.