Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, July 17, 2012

ADF Anti Patterns

I was looking into some of the anti patterns followed by developers while build applications for the enterprise World. I came across one of the useful doc in this direction by ADF-EMG group at https://sites.google.com/site/oracleemg/adf/files

I would still like to summarize the covered anti-patterns here for a quick review:

1. Do not use Composite Primary Keys. Better to use sequences as single attribute primary keys.
2. Do not set Read Permissions on Entity Object. Better to prevent the view access to such pages.
3. Do not mark associations as Composite better to handle it by marking foreign key as not null.
4. Do no call Application Module from inside Entity Object code.
5. Do not call Application Module from inside View Object code that can be found using View Accessors.
6. Do not call setter method of an attribute from the getter method of another attribute.
7. Do not use FacesContext or any other View Layer code in the model layer.

Some, of these might sound quite obvious but developers do ignore these quite often. Most of these anti-patterns usually hints for avoiding either due to performance reasons or due to breaking the standard Object Oriented design principles one of those guides as "Do not invoke anything from the outer layer in any of the inner layers". Another supporting theory is called as 'Onion Architecture'

3 comments:

Unknown said...

Can you please also put why its anti-pattern ..Composite Key is the best way to handle Master-Detail relationship.

JustasG said...

Those are good ones, once you have more experience, you already know what practices cost more instead of paying back later :)

I recommend ADF beginners reading those how-not-to's.

Unknown said...

Well using Composite Key is the anti-pattern for the scenarios like creating pk based LOVs for UI etc. Please refer the link again as I intend to not to copy paste what is already documented.