Tuesday, October 8, 2013

Oracle ADF – Best Practices

  1. Do not use invokeAction in pageDef because will be executed several times. Use instead a task flow with a method call in front. Also, using this approach, we can reuse the page in other task flows.
  2. Do not create view criterias containing the name of the view since the name of the view could be changed and then also, the criteria name should be changed.
  3. Use unbounded tasks only for pages or bounded task flows available as bookmarks.
  4. Do not use unbounded task flows for the following operations: create, update and delete. Should be used only for read operations.
  5. Do not add service methods in the application model that are dependent of the view iterators (default iterators). Use instead standard operations like: CreateWithParams, ExecuteWithParams,  etc.
  6. Create secondary iterators for views in the service methods. Do not use default iterators because are the same used in the view layer.
  7. Do not add HTML in JSF. Use instead styles and/or CSS for available ADF components.
  8. Try to not use the view’s attributes in the WHERE clause for filtering. Use instead default criterias for each view instance from the application model.
  9. Do not use two services layers separately with different database connections to the same database if is not needed. Use instead nested application models.
  10. Always use the scope prefix for any accessed memory variables (requestScope, backingBeanScope, viewScope, pageFlowScope, sessionScope, applicationScope, backingBeanScope).
  11. Put the Cancel operation in af:subform and with immediate=true, in order to ignore the validations of other input fields which have immediate=true.
  12. In the context of fragment based task flows, use viewScope in preference to request scope for a more predictable behavior within the context of the sub-flow that contains the fragments
  13. Task flows should always contain an activity marked as an exception handler. This activity does not have to be a view activity it can be a method or router (our preferred approach) with control flow rules to subsequent activities.
  14. Use SetPropertyListener instead of SetActionListener (was deprecated in 11g).
  15. Do not combine view accessors with data model master-detail because accessor attributes create distinct row sets based on an internal view object other than that from detail.
  16. When a view criteria is applied programmatically in a business method from the application model later the view criteria must be removed.
  17. Try to use data model master-detail only for composite relations.
  18. For performance increase you can tune the view instance from the application model in order to get from DB more than one row once. By default is 1.

No comments:

Post a Comment