[coldbox-4.x]: Models vs. Modules: Pros. and Cons.


My app contains a number of models like Product, Cart, Payment, Search, etc. I was wondering what are the real benefits if I converted them to modules? By the way, I haven’t done/developed a module before.


Not sure what you mean about converting a model to a module. Modules can contain models, but they aren’t the same thing. A benifit of moving models to a module could simply be for organization. If you want to do that though, I would think of how to also move related views, handlers, and layouts into the module as well.



The reason I asked because I was looking at the first diagram on http://wiki.coldbox.org/wiki/Modules.cfm; and it shows Cart and Billing are modules. Also, on one of bullet points on Features, it says, “A module can be complex as a full ColdBox application or as simple as one CFC”.

So, I was trying to find a point/reason when I should create a module. In my case, I have Cart and Billing/Payment in models; and the diagram shows they could be modules. That’s where I got confused. But, you’re right about considering moving related views and handlers.