Sei sulla pagina 1di 8

Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J.

IMRAN

Coding Standards for Oracle Forms 6.0


1 Development Standard (Oracle Forms 6.0)
1.1 Purpose
The purpose of this document is to serve as standards for the development of applications
in Oracle Forms 6.0.

1.2 Scope
The scope of this document is restricted to the design and development in Oracle Forms
6.0. The standards are generic. In case the client requires different set of standards to be
followed or when any exception is encountered, this may be overridden.

1.3 Intended Audience


Developers and Reviewers in Oracle Forms 6.0.

1.4 Definitions, acronyms and abbreviations


Abbreviation Description
VER Version

1.5. Reference
Oracle Forms 6.0 Manuals.

1.6. Description
1.7 Standards
1.7.1 Object Naming Conventions
The typical naming convention for Forms objects is to prefix the name of the object
based on the type of the object.
Forms Object Naming Standard
Form Description <Project>_<Module>_frm_<frm_name>
Report Description <Project>_<Module>_rpt _<rpt_name>
Form ID <Project>_<Module>_F<0010/0020>
Report ID <Project>_<Module>_R<0010/0020>
Form Procedure fpr_<name>

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

Form Function ffn_<name>


Form Package fpk_<name>
Form Trigger ftrg_<User defined trigger name>
Library <Project>_<Module>_lib_<lib_name>
Library Procedure lpr_<name>
Library Function lfn_<name>
Library Package lpk_<name>
Block blk_<name>
Canvas can_<name>
Tab Page tpg_<name>
Window win_<name>
Menu men_<name>
Alert alt_<name>
LOV lov_<name>
Editor fd_<name>
Object Groups og_<name>
Parameter par_<name>
Parameter List parlst_<name>
Property Classes cl_<name>
Record Groups rcg_<name>
Radio Groups rdg_<name>
Radio Button rb_<name>
Visual Attributes vatr_<name>
Push Button pb_<name>
Chart Item cht_<name>
OLE 2 Item ole_<name>
VBX Item vbx_<name>

The naming standards for other items like Text Item, Display Item, Check Box,
Radio Groups and Image Items will depend upon the corresponding database field
names, if any. For non-database field items the following naming standards
should be used.
Forms Object Naming Standard
Text Item txt_<name>
Display Item dis_<name>
Check Box cb_<name>
Radio Group rg_<name>
Image Item img_<name>
List Item lst_<name>

For other significant details such as Font name, Font Size of all objects refers to GUI
Standards.

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

1.7.2 Variable Naming Convention


A variable name will consist of 3 parts. Format will be xy_<name>
First part (x) in a variable will be i, o, io, l depending upon the type of variable.
Variable Type Part(x)
In I
Out O
InOut Io
Local L

Second part (y) will denote the variable datatype as described below
Scalar
Data Type Part(y)
Char C
Varchar2 V
Number N
Date D
Float F
Long L
Double Db
Rowid Rid
Boolean B
Form parameter Fp
Report parameter Rp
Compost
Data Type Part(y)
Record Rec
Table Tbl
Reference
Data Type Part(y)
Cursor Cur
Example Variable Description
iv_name In variable datatype as VARCHAR2
ov_name out variable datatype as VARCHAR2
iov_name InOut variable datatype as VARCHAR2
ln_name Local variable datatype as NUMBER

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

For counters or very general variables above convention may not be used.
Example
cnt for counter
i,j,k in loop counters
pos for finding position
x in cursor for loop

1.7.3 Constants
Declare constant in UPPER CASE only.
Datatype_name
Datatype convention used here as in variables.

Examples:
DECLARE I_NAME INT = 442
DECLARE F_NAME FLOAT = 3.142

1.7.4 Indenting
All statements following the control flow statements, viz.
IF..ELSIF..ELSE..END IF, FOR, WHILE, LOOP..END LOOP, should be indented by 3
space stop.
Example:
OPEN c1;
LOOP
FETCH c1 INTO f1, f2;
EXIT WHEN c1%NOTFOUND;
IF f1 > f2 THEN
f3 := f1;
ELSE
f3 := f2;
END IF;
-----------------------------
-----------------------------

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

END LOOP;

1.7.5 Commenting
In case of a program unit or a function being coded the commenting must include
functionality, parameters being passed, parameter being returned and log of unit creation
and subsequent updates.
The following is an example of Header Comment Block that should be placed at the
beginning of all program units

/**
--
--
-- Purpose : To update the leave balances of an employee
--
-- Parameters :
--
-- Sno. Name Description In/Out/Inout Type
-- 1 empcode Employee code In number
-- 2 leavecode Leave code In Varchar2
-- 3 noleave No of leave In Varchar2
--
-- Returns : none
--
-- Log :
--
-- Sno. Date Developer’s name Activity
-- 1 10/10/95 ABC Creation
-- 2 05/11/95 XYZ Additional code for exception handler.
-- 3 23/09/1999 CCC Modification

-- Global Variables : Global.abc

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

-- Tables Accessed : setup_mst


**/

1.7.6 SQL-PLUS
 All SQL-PLUS keywords to be written in UPPER CASE only.
Example:
SELECT, FROM, WHERE, AND, INTO, IF, ELSE etc.
 Objects name to be written in lower case only.
SELECT col1, col2, col3 FROM table_name
WHERE cond1 AND
cond2 OR
cond3;
INSERT INTO table_name (col1, col2, col3….)
VALUES (val1,val2,val3………);
 Leave one space after comma.
Example:
INSERT INTO table_name (col1, col2, col3….)
VALUES (val1,val2,val3………);
 When comma is the last character on a line put it on that line rather than skipping to
next line and putting it.
 Try to put column names in vertical orientation.
 Join operators ‘AND’, ‘OR’ should be in the end or beginning of line.
 Leave no space on either side of the parenthesis when appearing in SQL statements.
 Leave a space on each side of the conditional operator.
Example:
col1 = val1 AND
col2 < val2
 In case of nested loops, comment the end of the loops.
Example:
IF (condition1) THEN
------------------------

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

------------------------
IF (condition2) THEN
----------------------
----------------------
END IF; /* end of “clue to condition 1” */
-------------------
-----------------
END IF; /* end of “clue to condition 2” */

1.8 Guidelines
1.8.1 Visual Attributes
For applications to be ported on more than one platform use named visual attributes or
default visual attribute settings. It will be much simpler to modify a single named visual
attribute definition than to modify the custom attributes of all objects.

1.8.2 Property Classes


Inherit all of objects you are creating from class_template. Keep the latest copy of
class_template(.fmb and .fmx both) in your working directory. Property class defines a
list of properties and their settings that may be inherited by the objects, which helps in
making global changes to application quickly.

1.8.3 Object Groups


Define an object group when you want to package related objects for copying or
referencing to other modules in single operation.

1.8.4 Library
Create libraries of program units that are called from many modules (instead of defining
them in every module) and attach the library with the module in which it is referred.

1.9 Template Form


Always create new form via template form – templet_form. Keep latest copy of
templet_form in your working directory. Template form has a standard format including
headers, logos, sysdate, module name, screen title, form id and user id, which helps in
making forms format consistent throughout the application.

Confidential to KIMM TECH


Coding Standards for Oracle Forms 6.0 KIMM TECH/04-10-2010/J. IMRAN

1.10 General
 If a procedure is small enough and is being repeatedly called from within a loop
then include the code within the loop to make it work faster than calling it.
 If the above mention is being called from multiple location Then keep this
procedure separate to enhance maintainability.
 Erase all the global variables that are not required.
 Modularize the script by splitting into functions, wherever possible, to optimize the
performance and to help enhance maintainability.
 Headers should be provided before each function or procedure. The header should
describe what the code is for, and also specify the steps the function or procedure is
following.

Confidential to KIMM TECH

Potrebbero piacerti anche