Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2006, 08:31 AM
Authorized User
 
Join Date: Jun 2006
Location: BANGALORE, Karnatak, India.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ajit
Default Role of interface

Why it is recommonded, not to give direct access to servlet from a class that connected to database. Interface is used in between. Can anybody tell me, What are the advantages of using a interface as interface between any class and other layers.

Ajit
__________________
Ajit
  #2 (permalink)  
Old July 1st, 2006, 08:15 PM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you talking about an interface as used in Java (similar to an "abstract class"), or as used to separate display and business logic? If you mean the former, your question is very confusing. Are you talking about the JDBC interfaces used to abstract the implementation details of different databases? Or the facades used in Tomcat to hide the implementation details of handling a request, e.g. the HttpServletRequest interface?

If you mean the latter, the advantage is just what I said: seperation of display and business logic. If your database schema changes, you don't want to be required to change your display logic. Nor do you want to modify your servlets that delete or insert rows -- it would be nice if the APIs they relied on stayed exactly the same. Basically, best practice is to seperate the View logic, the Controlling logic (servlets), and the Model (your database). This is the Model View Controller (MVC) design pattern and it's very popular with Java web application development.

Jon Emerson
http://www.jonemerson.net/
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with sitemap and role hertendreef ASP.NET 2.0 Basics 6 June 21st, 2007 05:22 PM
Membership and Role Management frosty ASP.NET 2.0 Basics 1 July 18th, 2006 12:46 AM
Problem with Edit Role Clarke76 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 January 17th, 2005 01:15 PM
Why can't i create a role? allanhu BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 25th, 2004 05:48 PM
Role Count Walden SQL Server 2000 1 June 9th, 2003 12:19 PM



All times are GMT -4. The time now is 03:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.