문제

I'm making a leave management (HRM) website. I'm using codeignitor HMVC to build this. Following features are included in this site:

  1. A table to display a summary of leaves.
  2. A table for leave types like annual, MC, urgent, other...

I was thinking to create two modules for leave_summary and leave_types, but my friend told me it is useless.

According to HMVC architecture we are trying to create self contained modules for reusability. If I'm creating a different module for leave types, I should be able to reuse it and module itself needs to be self containing. But I can't use leave_types module anywhere else.

My friend asked me to put all the leave related stuff in one module called leave. This sounds strange to me as I found lots of examples people are trying to separate things out.

Do we only need to separate the modules which can be reused in the future (ex: login module, image_gallery module, profile module) and keep all others things inside a one module? (according to the above example I have to keep everything related to leave in a one module ex: leave_type, leave_requests, leave_summary will be placed inside the leave module)

What are the benefits I will get, if I separate the leave_type, leave_requests, leave_summary etc... into separate modules?

Will I be able to reuse them? If so How?

In HMVC model classes and other assets can be exchanged among the modules, so how can I call it a self-contained module or a separate entity as it is depending on another module? (ex: I have to call leave_type module's model class inside the leave_summary module to show the leave type name in a table.)

I'm little lost here. Please help me to understand. Thanks a lot!

도움이 되었습니까?

해결책

As i work lot of MVC projects. And I am agree with your friend.
May times this question arise when i used join that i have to choose in which one module i should go for write query. If you write in one model may next developer will write in another one model.
So according me it is best to keep same type of tables which are handling relation and using for same behavior use this approach like leave model, profile model etc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top