-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Redesign the bootstrapper concept #2696
Comments
Here are some initial thoughts
|
I think we should move as much as possible away from the bootstrapper base class. It doesn't really compose very well. We keep saying that "it's as simple as implementing I did some testing related to framework configuration in the prototype here. Think that could be something to pursue? It'll be like |
Well yes and no. I think there are value in having a base class for things like the configuration (
I like that it gives you the concept of "namespaces" for core components 👍 I guess somewhere in the background there would be something similar to |
This is also a good time to think about NancyBootstrapperWithRequestContainerBase and the need to keep that as its own thing. It was created in case were was a container that did not support child containers, but I think we've already established that most (all?) do these days and also that it is an essential thing for building these kinds of applications (added this to my initial comment to keep track) |
Background
The current design for INancyBootstrapper and, more importantly, the base implementation NancyBootstrapperBase have more or less been left untouched (part from a couple of additions here and there - but the over all design has remained the same) since it was introduced in the very early days of Nancy.
It has served us very well, but the time has come to start taking a look at an alternative design to help facilitate some things, such as a new feature set and to be able to integrate even better (and easier) with other environments. This is very likely to be a breaking change, hence it should be done before
2.0-RTM
is releasedCurrent design
Nancy is not really tied to the bootstrapper - it is just an additional layer put on top of the core, that helps you compose Nancy. Howerver, all you really need to do it so create an instance of
INancyEngine
and off you go. @grumpydev recently illustrated this in a gist where he essentially new up the entire framework without a DI container. It's still in anINancyBootstrapper
implementation, but as you can see all you really need is the code in theGetEngine()
method.So what does this mean? It means that the only things that are coupled (a part from user config) to the
INancyBootstrapper
(and in the background, theNancyBootstrapperLocator
) are ourNancy.Hosting.*
packages, that uses the boostrapper to get a, fully composed,INancyEngine
instance that it can use to broker requests/responses against. Nothing insideINancyEngine
(which is our root-level object) is even aware of the bootstrapper. This gives us a very clean separation between the bootstrapper concept, and the actual framework. This also means that we can replace the boostrapper design, without having an impact on Nancy, the framework. The only things that needs updating are ourNancy.Hosting.*
packages.Suggested approach
A while back @khellang spiked out a proof-of-concept of an alternative design. I suggest we use this as a place to start explore a new design. Given the clean separation, of Nancy and the boostrapper, that was described above, we should be able to transplant this spike into the boostrapper-update branch and hack away. For the purpose of the experimenting, we can simply focus on a single
Nancy.Hosting.*
package, and fix the others once we've settled on a design - again the changes to those packages should be very small (they grab theINancyBootstapper
instance from theNancyBootstrapperLocator
)Goals
Let's maintain a list of design goals that we all agree on. Please use individual comments to suggest changes / designs and once we reach consensus on something, we move it into this list.
The text was updated successfully, but these errors were encountered: