RubenVerborgh / solid-server-architecture

Proposed architecture for a Solid server
https://rubenverborgh.github.io/solid-server-architecture/solid-architecture-v1-3-0.pdf
13 stars 2 forks source link

Consider removing OperationFactory #14

Closed michielbdejong closed 4 years ago

michielbdejong commented 5 years ago

It's not clear how the LdpHandler would know which Operations to create when given an OperationFactory, so why not just create the Operations before you create the LdpHandler, and then pass an Array of those already instantiated Operations to it instead?

RubenVerborgh commented 5 years ago

It's not clear how the LdpHandler would know which Operations to create when given an OperationFactory

That's actually the point of the OperationFactory. The LdpHandler does not know which Operation to create; it delegates that knowledge to the OperationFactory. That way, LdpHandler only needs the handling logic that is common between all operations. The idea is separation of concerns.

You can see that idea in action here (slightly different naming):

In summary, because LdpHandler does not know this, this knowledge can be tested separately and changed at any time, without involving LdpHandler. This is managing complexity through components.

so why not just create the Operations before you create the LdpHandler

In this architecture, as can be seen in the OperationFactory interface's createOperation method signature, operations are short-lived objects that are created per request. Hence, they cannot be created before LdpHandler.

RubenVerborgh commented 4 years ago

This has now happened in 9e68331473c5e9f79281098ad97c9ad95e3c1e5c, following @jaxoncreed's design.