Reputation: 4117
I am working on a large project which is comprised of what seem logically to be lots of smaller apps, the plan as of now is to have a controller application which manages the sub-apps and some global event bus through which they can communicate. The sub applications would be rendered into an iFrame which will have to talk to the parent application via aforementioned event bus.
Broadly speaking is this a sensible approach and does anyone have any material on application of this scale?
Upvotes: 1
Views: 82
Reputation: 4981
Well, commonly talking, we all are more or less making sub-applications, when doing our job on big projects. If I find piece of functionality, which is used in different place, of if it is too big / logically separated from other stuff - it's a good idea to extract it into separated entity.
These entities are called - modules.
They often communicate thru some global event bus, some messaging service. I think you know about profits, coming from using such techniques:
I don't think this question is about some particular JS framework, but as we are talking about Backbone, I would recommend just to take a look at this presentation - https://www.youtube.com/watch?v=0o2whtCJw8I
So here, even without more info about your project, I think you have to make a sub-division of your large project into submodules. Not a question.
Question for me is - why do you want to make these sub-apps rendered in iFrames. I think the only justified reason for this could be - you have to provide an ability to share sub-apps' widgets on different sites. Otherwise it only will give you increased complexity of system in any aspect of it:
Upvotes: 0
Reputation: 25994
Yes, it is a sensible approach. Not only that, it's basically the only sane approach for large apps: decompose them so they don't crumble under their complexity.
Marionette already has an application-level event bus (along with separate event buses for sub apps, as well as the possibility to create your own), so you won't have to worry about that.
As for an example of using sub apps, you can take a look at the source code that accompanies my Marionette book for inspiration: https://github.com/davidsulc/marionette-gentle-introduction
Upvotes: 1