如何构建 EJB 的内容
我正在制作一个简单的 CMS 只是为了学习目的,我有一个问题如何组织它。我有一个管理部分,您可以在其中添加新页面、编辑内容等,我还有一个用户可以看到的公共部分,例如页面。
因此,我有 PageEJB 类,它具有添加页面、编辑页面、删除页面、查找页面等的逻辑。换句话说,管理部分和公共部分的逻辑位于同一个类中。我应该制作一个 PageAdminEJB 和 PageEJB 并将内容分开吗?
I am making a simple CMS just for learning purposes and I have a question how I would organize it. I have an administration section where you can add new pages, edit content etc, and I also have a public part that the user see for example the pages.
So, I have PageEJB class that has logic for adding a page, edit a page, deleting a page, finding a page etc. in other words logic from the admin section and public section is in the same class. Should I instead make a PageAdminEJB and PageEJB and separte the content?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
既然您这样做只是为了学习目的,那么通过使用两个 EJB(而不是一个)您能学到任何东西吗?
我会说:从一个开始,看看它如何成长。当它达到临界质量时(当你看到它做得太多时),重构它。通过这种方式,您将了解向系统引入新 EJB 的难度/容易程度。也许外观设计模式会对您有所帮助。
根据您所写的内容,很难以一种或另一种方式果断地提出建议。
Since you're doing it for learning purposes only, will you learn anything by having two EJBs instead of one?
I'd say: start with one, see how it grows. When it reaches critical mass (when you see it does too much), refactor it. This way you'll learn how hard/easy is to introduce a new EJB to your system. Perhaps the facade design pattern will help you then.
Based on what you wrote, it's difficult to advise decisively one way or the other.