0

これは、クラスの命名に関する単なる質問です。DAO とその Hibernate 実装に名前を付けるための「標準」(または最も受け入れられている) アプローチを知りたいです。

それはすべきですか?

  • HibenateDOMAINDAO
  • DOMAINDAOHibernate
  • HibernateDAODOMAIN

個人的には、当然 HibernateDOMAINDao を好みますが、DOMAINDAOHibernate を好む同僚と、これについて少し議論を交わしました。

4

2 に答える 2

4

私は通常、名前空間を好みます。

何かのようなもの

com.something.proyect.dao.Dao //Generic Dao Interface
com.something.proyect.dao.DomainDao // DomainDao Interface
com.something.proyect.dao.hibernate.HibernateBaseDao // Base Hibernate Impl
com.something.proyect.dao.hibernate.DomainDaoImpl // Hibernate Domain Dao Impl
com.something.proyect.dao.jdbc.JdbcBaseDao // JDBC Base impl
com.something.proyect.dao.jdbc.DomainDaoImpl // JDBC Domain DAo Impl
com.something.proyect.dao.anotherorm.AnotherOrmBaseDaoImpl

そうすれば、休止状態にあるものはすべて休止状態であり、クラスに休止状態を追加する必要がないことがわかります。

于 2012-09-25T03:48:22.710 に答える
1

Daoの略語はDataAccessObjectであることがわかっているので、 Daoを使用するデザインパターンです。つまり、休止状態に関連するだけでなく、任意のプログラミング言語で使用できます(私が知っているように)。

com.orm.dao.GenericDao // Generic Interface which uses every interface in the Dao layer,This has common methods like create,delete,update etc

com.orm.dao.DomainDao // Extended from Generic dao, additionally contains domain specific moethods

com.orm.dao.impl.GenericDaoImpl // Implementation of GenericDao interface, normally this class should be abstract  

com.orm.dao.impl.DomainDaoImpl // Implementation of DomainDao interface and extended from GenericDaoImpl class

これがあなたのためにクリアされることを願っています、乾杯

于 2012-09-25T07:18:16.617 に答える