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

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


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Java Notes

Separating UI from Logic

One of the most important ideas in organizing programs is to separate the user interface (GUI, presentation, view and controller, ...) from the logic (model, engine, ...). There are two really good reasons for this.
  1. The resulting program is conceptually simpler, and this means it is easier to work on, extend, refactor, understand, maintain, etc.
  2. A different user interface or logic model can be added without affecting the other. For example, imagine that we've written a game, eg Connect4, and separated the graphical user interface from the underlying game logic. Why would we want to replace the GUI?
    • Maybe you want the program to run on a PDA or phone, which use a related, but different, Java graphical user interface, Java 2 Micro Edition. The new GUI can be written without concern for its affect on the logic model, which can very likely remain the same.
    • Perhaps you want to set up a Connect4 server so that the game could be played over the web, but use only one master copy of the logic on your server. There will be no GUI in this case; a server program like Tomcat or PHP will call on the (unchanged) logic module and build the appropriate web page to send back to the user.
    • A good reason to replace the logic is when you've written a new version that plays better or more efficiently.
    • It's hard to see why you might want to replace the GUI with a text mode interface for a game, but you might want to do this if you want a program to run as a Unix batch program.
Ask programming questions?

 

 

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

 

 
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.

[an error occurred while processing this directive]