Search code examples
architecturecastle-windsorfactorybootstrapping

What is different between bootstrap vs factory


I'm learning software architecture and patterns useful for C# language. Now I am little confused what is different between bootstrap and factory.

What I think about those is:

  1. Factory is class which provide instances of other classes instead of calling constructor itself.
  2. Bootstrap resolves dependencies between instances and can create instance of class.

Therefore bootstrap can be part of factory? Or bootstrap is factory?


Solution

  • I'm assuming when you're referring to bootstrap you're talking about the place where the container is configured.

    As such I don't think of container boostrapping as a pattern. A design pattern is a more general technique that can be applied in various contexts, to various problems.

    Bootstrapping is a technique specific to a single very particular problem: feeding knowledge about your code, to a framework - be it an ORM, or IoC Container, before it can be used.

    When you say

    Bootstrap resolves dependencies between instances and can create instance of class

    it sounds like you're referring to the IoC container (like Windsor), which in a way can be thought of as a super-charged generic factory, that creates, destroys and manages lifecycle of a certain subset of objects in your system.

    You might also find this documentation page useful for explaining the concept a little more.