Welcome Guest, Not a member yet? Register   Sign In
Codeigniter HMVC effect on performance
#1

[eluser]CodeIgniterNewbie[/eluser]
If I wanted to create reusable "modules" that can be developed and maintained independently and "dropped in" any CodeIgniter project, how should I go about doing this?

An example module would be, say, a forum module. Assume the module allows:

- a number of forum topics to be defined
- allow discussions to be started within the topics
- allow users to post messages withing the discussions

This is a generic enough concept that can be applied in many projects. What would I need to do so that I can build and maintain this forum module independent of projects that use the forum module?

It seems like I should be looking into MMVC (see http://stackoverflow.com/questions/63138...erformance), but I'm not sure.

Another problem I see is that if a module is not complete "self contained", meaning it requires some degree of coupling with the application using it. For example, say the forum module has the following:

Code:
TABLE: message
- message_id (PK)
- user_id (FK)
- message
- timestamp

If the forum module does not have a user table because it expects the application using it will have that table:

How can referential integrity be enforced? Surely the forum module won't know the database architecture of the application using it.

How will the forum module know where to get the value to insert in user_id? That value could be anywhere, depending on the application (e.g. could be in query string, session, etc.).

Suggestions?




Theme © iAndrew 2016 - Forum software by © MyBB