Top Banner
59
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Best Practices From Fusion Applications Teams (OpenWorld 2009)
Page 2: Best Practices From Fusion Applications Teams (OpenWorld 2009)

<Insert Picture Here>

Oracle Application Development Framework:

Oracle Fusion Applications Teams' Best Practices

Steve Muench

Oracle ADF Development Team

Page 3: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Best Practices Categories

Applications (Infra)Structure

View/Controller

Task Flows

List of Values (LOV)

Miscellaneous

Services

Performance

Page 4: Best Practices From Fusion Applications Teams (OpenWorld 2009)

APPS (INFRA)STRUCTURE

Page 5: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Fusion Applications: Size of the Effort

~2500 developers, product managers, QA engineers

~ 3500 ADF libraries

“Model” ADF libraries contain ADFbc components (EO/VO/AM)

“UI” ADF libraries contain task flows, page defs, jsff, etc.

~ 200 SAR composites

1:1 between ADF library and JDeveloper project

1:1 between SAR composite and JDeveloper project

~ 40 workspaces ( == applications)

"SUPERWEB" projects aggregate many view/controller

projects into a single web context root via ADF libraries

© 2006 Oracle Corporation – Proprietary and Confidential

Page 6: Best Practices From Fusion Applications Teams (OpenWorld 2009)

BuildFarm

Oracle ADE

ANT(build.xml)

ojdeploy

CustomAutomation

Infrastructure

Continous Integration and the Build Loop

Detect Modification

(Transaction Merge)

CreateLabel

ScheduleBuild

ScheduleLRG Test Run

PublishLabelPublish

Results

Page 7: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Create Build Plan by Extracting Dependency Graph

from JDev Deployment Profile Discovery

© 2006 Oracle Corporation – Proprietary and Confidential

Build.xml

Reference using ANT filesets JWS

EAR WAR JAR

JPR JPR

Execute Profiles in OJDEPLOY

Page 8: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Building and Testing Mechanics

ojdeploy

Enables automating use of JDeveloper deployment profiles

ojserver

Custom enhancements to use ojdeploy in a build farm

Designed to be clusterable for scalability

Centralized build reporting and summary

Dependency Aware JUnit TestRunner

TestRunner modeled after an osgi container

If it runs in JDev, it should be able to run on the test farm

LRG registration in build.xml files

Teams register LRGs to make them visible to the build farm

Page 9: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Fusion Applications: Pillars and Families

CRM HCMFSCM

FinancialsSupply Chain Management

ProjectsProcurement

Page 10: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Cross Pillar Component Sharing Example

CRMRemote VOs

and EOs

CRMRead-OnlyPublic VOs

and EOs

CRM DB HCM DB

ServiceInterface

High-Traffic RefrenceData Replicated

Less FrequentlyRefrenced Data

Accessed and/or UpdatedVia Service Interface

CRM HCM

Page 11: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Service Based Entity Objects (and View Objects)

Page 12: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Model AMs, UI AMs, and Service AMs

Model projects contain core business logic

EOs, VOs for Validations and Lookups, Core "Model" AM

UiModel projects contain VOs needed for task flows

Reference EOs from ADF Library, task flow specific LOV VOs

"UI" AM has UI data model, delegates to (or nests) "Model" AM

Service projects contain VOs needed for services

"Service" AM has service VOs, delegates to (or nests) "Model" AM

"Hungarian" Notation for Components and Strict Package

Naming Standard Simplifies Understanding Structure

Page 13: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Project Categories Used to Tame Complex

Intra/Cross-Team Dependencies

Model / UiModel

Public

Protected

Private

PublicEntity, PublicView [read-only]PublicModel, RemoteModel, PublicService [rw]

ProtectedModel, ProtectedUiModel

Model, UiModel, Service

UI

Public

Private

PublicUi

Ui

Page 14: Best Practices From Fusion Applications Teams (OpenWorld 2009)

VIEW/CONTROLLER

Page 15: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Backing Beans Only When Absolutely Required

Encapsulate all model manipulation code in custom

AM and/or VO methods & invoke them declaratively

Makes your app easier to regression test

UI components with EL-bound properties

can handle many dynamic UI use cases

Router activity can address most dynamic navigation

Only code that belongs in a backing bean is…

Complex, dynamic UI component manipulation

Complex conditional navigation

Even if you require backing bean code, invoke custom

AM or VO methods using action binding

Guarantees uniform error handling

Page 16: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Correct Way to Reference Application Module

from Backing Bean

Page 17: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Wrong Way to Reference Application Module

from Backing Bean (DON'T DO THIS!)

Page 18: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Avoid af:table's Documented Limitations

By Avoiding Mutable Primary Keys

Use sequence-populated "surrogate" key attribute

Supplement with "natural" alternative unique key

User still has impression that they are assigning the key

Reference entity usages' key attributes are not

required to be part of the view row key

Page 19: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Dynamic Regions to Defer Region Processing

Until Actually Displayed to the User

Embedding

Regions Inside

PopUp Windows

whitepaper on

OTN explains

details

Page 20: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Click-to-Edit Tables When Possible

When rows are infrequently edited in a table, set its

editingMode property to clickToEdit

Significantly smaller response, improved performance

Page 21: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Approach for Dislaying AutoRefresh View Object

Data from Shared Application Module in a Table

GRANT CHANGE NOTIFICATION TO <username>

Create view object with AutoRefresh=true

Add instance to App-scope shared application module

Set dataControlUsage to use Shared Config

Use af:poll to periodically visit the server

Override processDatabaseChangeNotification() to note system time of last VO execute query

Simple optimization avoids page refesh if data hasn't changed

Page 22: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

AutoRefresh View Object in Shared Application Module

Page 23: Best Practices From Fusion Applications Teams (OpenWorld 2009)

TASK FLOWS

Page 24: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Bounded Task Flows to Organize Units of Work

Initialize using methodCall activity that invokes built-in

operation or client-exposed custom AM/VO method

Main unit of granularity for ADF Security

Page 25: Best Practices From Fusion Applications Teams (OpenWorld 2009)

InvokeAction Effectively Deprecated

In 10.1.3, page initialization logic was triggered…

InvokeAction in PageDef with properly-configured

Refresh and RefreshCondition

Relied on #{adfFacesContext.postback == false}

In 11g, there is no reliable postback flag for

pageFragment/region use cases

Use task flow methodCall activities instead now

Only use case InvokeAction still works is page

definition for page in an unbounded task flow

Can use #{adfFacesContext.initialRender == true}

Page 26: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Understand Task Flow Transactional Semantics

transaction = requires-transaction

transaction = requires-existing-transaction

data-control-scope = isolated

DeptModuleEmpModule

transaction = requires-transaction

data-control-scope = isolated

Page 27: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Understand Task Flow Transactional Semantics

Use 'No Save Point' = true if savepoint not needed

transaction = requires-transaction

transaction = requires-existing-transaction

data-control-scope = shared

EmpModule

transaction = requires-transaction

data-control-scope = isolated

DeptModule

Page 28: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

Transactional Task Flows

Page 29: Best Practices From Fusion Applications Teams (OpenWorld 2009)

The following is intended to outline our general

product direction. It is intended for information

purposes only, and may not be incorporated into any

contract. It is not a commitment to deliver any

material, code, or functionality, and should not be

relied upon in making purchasing decisions.

The development, release, and timing of any

features or functionality described for Oracle’s

products remains at the sole discretion of Oracle.

Page 30: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Dynamic Tab Pattern – Design Time Template

Page 31: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Dynamic Tab Pattern – Runtime

Page 32: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

Dynamic Tab UI Shell

Page 33: Best Practices From Fusion Applications Teams (OpenWorld 2009)

LIST OF VALULES (LOV)

Page 34: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use LOV Combobox with Smart Filter

LOV avoids initial query when data retrieved

Smart Filter limits data fetched for dropdown

Full query only when user accesses LOV dialog

Page 35: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Configuring

Smart Filter

for LOV Combo

Page 36: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

LOV Combox with Smart Filter

Page 37: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Lookout for "Reference Dname" Antipatterns

Use Case

Allow user to use the lookup field description to find the code

For example, use the Dname to select an employee's Deptno

Best Practice

Add the reference entity usage for the lookup entity (Dept)

Define an LOV on the reference Dname attribute

Updateable entity usage's foreign key (Deptno) attribute

automatically included as a return item

Antipatterns to Avoid

Don't use a transient Dname attribute that accesses a

parameterized view accessor to lookup the description

Why? Causes one additional fetch per row in the result

Don't use a readonly selectOneChoice dropdown list

Why? Fetches all rows in the lookup table to display one

Page 38: Best Practices From Fusion Applications Teams (OpenWorld 2009)

MISCELLANEOUS

Page 39: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use at Least One (Selectively) Required

View Criteria Item

Prevent user from

doing "blind" query

Typically includes

your indexed columns

Page 40: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use a Layer of Framework Extension Classes

EntityImpl

YourOrgEntityImpl

YourAppEntityImpl

Page 41: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Programmatically Modifying View Criteria Before

View Object Query Executes

Override getCriteriaClause(boolean forQuery)

Modify applied view criteria and/or

view criteria items before calling super

Use to Conditionally…

Apply supplementary filtering

Assign view criteria item values

Page 42: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Make Your Code Activation-Safe and

Verify By Testing That It Is

Override the

passivateState() and

activateState()

methods to save and

restore private

member fields or user

session data

Test by disabling

application module

pooling

Page 43: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Datasources

Now work outside

Java EE container

(Tester, JUnit, etc.)

Page 44: Best Practices From Fusion Applications Teams (OpenWorld 2009)

If You Still Decide Not to Use Datasources…

Disable auto-generation of WLS datasource module

Page 45: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Prefer One View Object with Many View Criteria

No longer necessary to create separate VOs

that only differ by WHERE filter

Single, consistent row structure everywhere you use

it, regardless of which criteria are applied

Apply view criteria declaratively when defining view

accessors and AM data model instances

Page 46: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Prefer Declarative SQL Mode View Objects

SELECT list "pruned" at runtime based on data

required on current page

A "wide" VO with joined referenced information gets

"trimmed" to exclude unreferenced tables

"Selected In Query" property determines attributes

which should never be pruned

Page 47: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

Query "Pruning" UsingView Objects with Declarative

SQL Mode

Page 48: Best Practices From Fusion Applications Teams (OpenWorld 2009)

SERVICES

Page 49: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Expose Services for Signifant

Line of Business Objects

Enable all supported operations, typically

find, get, create, update, delete, merge, processXXX

Include only necessary attributes

Use service view object to shape the data

Hide individual attributes from the Service Data Object (SDO)

Target coarse-grained custom operations

Include nested child data using view linked VOs

Automatic if defined by composition (e.g. Headers, Lines)

Manual using custom property on association or view link

SERVICE_PROCESS_CHILDREN=true

Include alternate unique key if appropriate

Define LOVs on reference lookup attributes

Page 50: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Fine-Tuning Service Behavior

FindCriteria on find() method

Control exactly which attributes are returned

Use FetchSize and FetchIndex to "page" through data

ProcessControl on processXXX() method

ReturnMode: Full, Key, None

ExceptionReturnMode: Full, Key, None

Use AttributeList to avoid built-in lookup/apply

Use ServiceFactory to get Proxy

Page 51: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Demonstration

Service Interface

Page 52: Best Practices From Fusion Applications Teams (OpenWorld 2009)

PERFORMANCE

Page 53: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Use Bind Variables

Literal Criteria turned into temp bind variables so you

don't have to create them yourself in view criteria

unless you need to populate their value in a view

accessor.

When you do use bind variables, be aware of the

"Ignore Null Values" setting since null bind variables

will then cause all rows to be queried

Page 54: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Always Consider Setting Appropriate Fetch Size

(Default FetchSize is One [1] Row)

25 good default for VOs used by table in UI

For batch processing can be higher

JDBC allocates memory for fetchSize x memory for one row,

so don't make it arbitrarily large

Can be set declaratively on…

View objects instances in AM data model editor

View accessors

To set fetch size on system-created…

View link accessor view object,

override ViewObjectImpl.createViewLinkAccessorVO()

Association accessor view object,

override EntityImpl.createAssociationAccessorVO()

Page 55: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Other Performance Tips

Use one data control (i.e. root AM) per page

Use nested AMs instead of separate root AMs

Exception for DataControlScope = isolated

Case-Sensitive View Criteria Items Need Indexes

CREATE INDEX idxname ON UPPER(DNAME)

Don't call getRowCount() since it fetches all rows

Use getEstimatedRowCount() Instead

Enable lazy loading of component metadata

jbo.load.components.lazily = true

Avoid Using List Validator for Large Lists

Fetches all rows, use 20 or 30 max

Consider Key Exists validator against view accessor instead

Page 56: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Learn More at OOW and Oracle Develop

Related Sessions and Hands-on Labs:

Oracle JDeveloper and ADF at the Demoground

Moscone West - W-114, W-116, W-109

ADF day at OOW Un-conference

Wed 9:00-5:00 Moscone West – Overlook 1

Win a Wii – visit Oracle Usability pod

In the Oracle Develop lobby

Date Session

Tue 5:30pm Ensuring Reusability in Oracle ADF: Designing for Data Model and Component Reuse

(Golden Gate 3)

Wed 1:00pm ADF Methodology Group Meeting (Moscone West, 3rd Floor, Overlook 1)

Page 57: Best Practices From Fusion Applications Teams (OpenWorld 2009)

<Insert Picture Here>

More Information on Oracle JDeveloper

http://oracle.com/technology/jdev

Tutorials and How-To’s

Samples

Demos

Books and Training

Discussion forum

Blogs

More…

Page 58: Best Practices From Fusion Applications Teams (OpenWorld 2009)

Middleware Lounge

At the Marriott Hotel

Free Amazon Web Services access$35 credit for development time

Daily workshops: “Developing in the Cloud”

Q&A with Amazon representatives and other experts

Internet accessWireless access

SunRay machines also provided

Recharging stations for your phone or laptop

Free food and beverages

Live Twitter feeds and blog updates

Watch keynotes and featured sessions while relaxing, recharging, and checking email

Workshops DailyIn the Middleware Lounge

•Daily, 11:30 AM Introduction to Amazon Web

Services

•Monday 2:00 PM Developing with WebCenter and Oracle Content Management in

Amazon Web Services

•Tuesday 2:00 PM Developing with WebCenter and Oracle Content Management in Amazon Web

Services

•Wednesday 2:15 PM Developing with Oracle SOA Suite in Amazon

Web Services

•Thursday 2:30 PM Developing with Oracle SOA Suite in Amazon

Web Services

Page 59: Best Practices From Fusion Applications Teams (OpenWorld 2009)