Java Naming Conventions for Sample Project
Java package naming
-      com.company.project – project-wide package prefix. Should not be used directly. 
-      com.company.project.web – web client package prefix 
   
 
Common packages
-      com.company.project.commons – project-wide common classes, including exceptions 
-      com.company.project.commons.util – project-wide gnerial purpose utilities. 
-      com.company.project.commons.persistence – common classes retaled to server side persistence (Persistence API 1.0) 
-      com.company.project.commons.ws – WebService related utilities. 
   
 
Sub-system packages
-      com.company.project.<subsystem>.<component> - may contain exceptions 
-      domain – contains interfaces, classes and enums related to subsystem's domain model representation. 
-      persistence – persistnt entities should be placed here. EJB 2.1 beans too. 
-      component – session beans (EJB3) with CRUD logic (managers over persistence tier) 
-      util – various service utilities, e.g. DTO assemblers and helpers 
-      business – Session beans with complex logic. These classes deals with component layer and may use persistence entities POJOs as Data Transfer Objects (DTO) with lazy loading within a transaction. 
-      util – various service utilities, e.g. DTO assemblers and helpers 
-      facade – Contains service facades. Serice facades are POJOs (preferrable) or EJB3 session beans which may access business and component layer beans. -          jaxws – contains JAXWS service implementations. -              skeletons – contains generated JAXWS interfaces 
 
-              
-          axis – contains AXIS service facade implementations -              skeletons – contains axis generated skeletons 
 
-              
-          util – various service utilities, e.g. DTO assemblers and helpers 
 
-          
-      client – contains (web) service clients -          jaxws – contains JAXWS service client. -              stubs – contains jaxws generated sstubs 
 
-              
-          axis – contains AXIS service client. -              stubs – contains axis generated stubs 
 
-              
 
-          
   
 
Java class naming
Following conventions should be applied to class naming:
-      Persistent entity should have an «Entity» suffix 
-      Session beans should have an interface and implementation: FooManager and FooManagerBean 
-      WebServices session bean implementation should be named with suffix FooPortImpl. If it's a session bean – FooPortBean. 
-      Factories should have a «Factory» suffix 
-      We use the following names for the parts of an entity / session bean: 
-      Enterprise bean class: <name>Bean 
-      Local home interface: <name>Home 
-      Local interface: <name>. 
-      Accessor methods of an enterprise bean class should be grouped by field 
-      ... 
   
 
   
 
   
 
   
 
No comments:
Post a Comment