Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Database programming standards

RE: Database programming standards

From: Deen Dayal <deen.dayal_at_dol.state.nj.us>
Date: Thu, 03 Jun 2004 13:40:12 -0400
Message-id: <0HYQ00IF4UF0BQ@revere.dol.state.nj.us>


Leslie,  

That's a very good insight, thanks a bunch for the help; I will check out the book you mentioned.  

At this time I really do not know what model vendor is going to follow (probably MVC), We do not have enough Java application architecture experience to suggest/legislate any one model/frame work. What all we can at this want to do is: put down as many high level obvious standards as possible.  

Thanks you very much for the info

Deen    


From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Leslie Tierstein
Sent: Thursday, June 03, 2004 11:35 AM
To: oracle-l_at_freelists.org
Subject: RE: Database programming standards  

See inline comments, below:

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of deen dayal Sent: Wednesday, June 02, 2004 5:26 PM
To: oracle-l_at_freelists.org
Subject: Database programming standards

> Here is the list of problems I heard from others, do not know how far
> they are true:

> 1) Some Java programs do not close open cursors.

> 2) On the fly SQLs ( no bind variables ) and each SQL is new for
> database causing scalability problems.

True; both examples of sloppy coding. #2 is why we have cursor_sharing = FORCE. These are easy enough to check for and legislate against.

> 3) Applications do not typically make use stored procedures/packages and
> all the SQL are dumped into one huge database class file

Partially true, but too simplistic. There seem to be two approaches to coding Java applications with Oracle DB access:

  1. the javahead approach
  2. the database-centric approach.

(I believe these approaches are discussed in the Dorsey/Koletzke book, JDeveloper Handbook; a new edition is coming out soon, probably in the fall, but if you can get a copy of the first edition, I think this discussion is still there. The book also includes a set of standards for use in Java code that you might find useful, although it is geared heavily toward JDeveloper development.)

In the database-centric approach, the application puts as much intelligence as possible into the database. For example, a java class could be based on an updateable view, with the INSTEAD OF triggers doing a lot of the work. A database-centric approach also has the (obvious to us) advantage that the referential integrity constraints are in the database, so bad data can't be snuck in, either via sloppy code in the java application or via another application. Java programmers are strongly urged not to directly interact with the database, but to (1) use the updateable views and (2) use the equivalent of Designer's TAPI's (Table interfaces), written by the DB group, which encapsulate all DML and return cursors (oops; result sets) to the application.

When I first read about the database-centric approach, I thought this was wishful thinking. But I have actually come across projects where this is being used (especially encapsulating the DML within packaged procedures).

In the javahead approach, the application puts most of the intelligence into the java that runs on the middle tier (via web services, EJBs, Oracle's ADF BC (business components) or whatever. Of course, some intelligence here is required for a good user interface; but putting a lot of things here essentially duplicates what the database can do much better. Except you will probably need to see some connection pooling and caching being done.

One of the key points you need to investigate is what frameworks the developers are using. For example, what Object-Relational mapping tool is the application going to use? Oracle supports (owns) both TopLink and ADF BC. TopLink was developed externally and bought by Oracle, so I don't know how much corporate support it's getting. ADF BC is home grown and, in my experiments, looks pretty powerful. Are they using an MVC pattern? If so, what controller are they using? And so on.

In addition to Dorsey/Koletzke an Oracle center of excellence in Europe has developed JHeadstart, which generates java code from Designer modules. I have read excellent papers on java by people in this group. Don't know if anything is posted on the web, however.

Leslie


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! <http://messenger.yahoo.com/> Messenger



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Thu Jun 03 2004 - 12:37:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US