Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2006, 08:31 AM
Authorized User
 
Join Date: Jun 2006
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
 
Old July 1st, 2006, 08:15 PM
Friend of Wrox
 
Join Date: Jan 2006
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/





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.