Fork me on GitHub

I think I'm missing something about Component and the Reloaded workflow. Why would you make more than one component? Why not put the entire app into a single component? It's still an instance with a lifecycle, so you can still reload it. I imagine there are cases where you may want to reuse a component with a different configuration, such as when you need two DB connections, but other than that, is there a reason to have multiple components?


I prefer each component to have a single responsibility, so that I can test them (ideally in integration with the stateful service they provide) independently, and can compose them in novel ways


Some folk also like to work with reusable components, e.g. the system project. Me, I find my trivial components are trivial to write, and my complex components implement protocols only germane to the app in which they live, so I don’t get much leverage from that avenue


I also tend to write apps that have a few different mode of operations, that need different projections of an overarching system. E.g. in one mode, it needs a db pool, an encrypter, and a message bus; in another mode, it needs a message bus, a decrypter, and an emailer. Starting only the bits that I need makes a meaningful difference in resource utilization.


☝️:skin-tone-2: This is what we do too. Our app has several components that we can swap with different implementations and test independently.