IS /是否有任何Android的标准封装结构/层次的做法?有任何、层次、做法、结构

2023-09-06 06:12:50 作者:低调の沉默者

在开发J2EE Web应用程序我通常会安排我的包结构通过以下方式

When developing J2EE web applications I would typically organise my package structure in the following way

com.jameselsey< applicationName的方式>

控制器 - 控制器/行动去这里 服务 - 事务服务类,由控制器名为 域 - 我的领域类/对象的应用程序使用 DAO - 抽象DAO层 DAOImpl - 实现DAO层,使JPA / JDO / Hibernate的切换等 utils的 - 实用工具类,通用的东西我可能要使用比如我自己DateUtils等 Controller - Controllers/Actions go here Service - transactional service classes, called by Controllers Domain - My domain classes/objects that the application uses DAO - abstract DAO layer DAOImpl - implementing DAO layer, to make JPA/JDO/Hibernate switchable etc Utils - utility classes, anything generic I might want to use such as my own DateUtils etc

这让我保持特定的角色/任务地点举办我的课。

This allows me to keep my classes organised in locations specific to their roles/tasks.

有没有为Android等效?我一直没能找到任何指引,然而,我在找包层次结构/结构的采用的标准

Is there an equivalent for Android? I haven't been able to find any guidelines as yet, I'm looking for an adopted standard of package heirarchy/structuring

感谢

推荐答案

如果您使用的是DI框架,是的,他们往往会说出他们way..but DI和MVC两者都有些新的Andr​​oid版并没有很多的开发者正在使用这些命名模式。

If you are using a DI framework yes they tend to name them that way..but both DI and MVC are somewhat new to Android and not a lot of devs are using those naming patterns.