Tuesday, November 12, 2013

ADF Naming Standards and Best Practices

Naming Standards are very important to organize the code, especially when you are working with large scale applications. Below are the naming conventions based on JUST my past experience


Business Components

  Entity                                  - Suffix with 'EO' - example : EmployeeEO
  Updateable View Object      - Suffix with 'VO' - example : EmployeeVO
  Programmatic View Object  - Suffix with 'TRVO' example : EmployeeTRVO
  ReadOnly View Object        -  Suffix with 'ROVO' example : EmployeeROVO
  List of Values View Object  -  Suffix with 'LOV' example : GenderLOV
  View Link                            - Suffix with 'VL' example : EmployeeDepartmentVL
   Association                         - Suffix with 'Assoc' Example : EmployeeDepartmentAssoc
  View Accessor                    - Suffix with 'VA' Example :  EmployeeNameVA
  Application Module               - Suffix with 'Service' example : EmployeeService

Packaging

Entities                            :     com.<application>.<project>.model.entities
Updateable View Object :     com.<application>.<project>.model.queries    
Application Module         :      com.<application>.<project>.model.services           
Programmatic View Object :     com.<application>.<project>.model.trvo
View Link                          :    com.<application>.<project>.model.vl
Association                        :    com.<application>.<project>.model.assoc
Read only View Object      :    com.<application>.<project>.model.readonly

Application Naming 
- Giver proper name to application , For eg : EmployeeMgmt, CustomerMgmt, VendorMgmt, etc.. The name of the application should be meaningful with respect to the functionality

Project Naming
 - Give meaningful name to each project you create in any application
 - Model Project :
   Example : EmployeeModel, CustomerModel,VendorModel - All the model projects suffix with 'Model'
- View Controller Project : 
 Example : EmployeeUI, CustomerUI, VendorUI - This project holds all the User Interface related components such as .jsff, jspx, xml, etc..

- Web Service Projects
 Example : EmployeeWSService, CustomerWSService, VendorWSService - All these projects contains the web services related.

- Web Service Proxies
Example : EmployeeWSProxies, VendorWSProxies, CustomerWSProxies - All these projects contains the web service proxy related files.

- JSP Pages

Example : create-employee.jspx, edit-employee-job-details.jspx - Give meaningful name, all lower case , better if seperated by '-'

- Page Fragments (.jsff)
Same as JSP Pages

- Task Flow
- Meaningful name separated by '-' and prefix with config.xml
   Ex : create-employee-config.xml , edit-employee-job-details-config.xml

Backing Bean

- Give meaningful name such as 'EmployeeBean', 'CustomerBean', 'VendorBean' etc.
- Package : com.fm.helloworld.view.backing.EmployeeBean
- Every bean class must implement java.io.Serializable interface.
- Try to avoid binding any ADF UI components to Backing beans

Best Practices
- Define entry and exit log messages as shown below

import java.util.logging.Level;
import java.util.logging.Logger;

// Define below at class level

private static final String CLAZZ_NAME = EmpServiceImpl.class.getName();
private static final Logger _logger = Logger.getLogger(CLAZZ_NAME);

 public void runPublication()
  {
    String methodName = "runPublication()";
    _logger.entering(CLAZZ_NAME, methodName);
    _logger.exiting(CLAZZ_NAME, methodName);
  }
// Log Exceptions as below
      _logger.logp(Level.FINEST, CLAZZ_NAME, methodName,

                   message.toString(), pException);
// Log Information messages as below
              _logger.logp(Level.FINEST, CLAZZ_NAME, lMethodName,
                           " Invoking  updateRates() CORBA Call: Data List Size " +
                           newDataList.size());
Follow this link for better performance tips and best practices : http://fortunefusionminds.blogspot.com/2011/12/performance-tuning-tips-with-adf-web.html


  

1 comment:

  1. Are you looking to make money from your websites/blogs by popup advertisments?
    If so, have you considered using Clicksor?

    ReplyDelete