Skip to content

Factory

Related tasks

Context

There are situations where a specific interface instance is needed (e.g. a Machines component), but the exact implementation depends on the application (e.g. AWS, GCP, Azure, etc.). Interface implementations make heavy use of Dependency Injection (DI) to establish dependencies and decouple modules.

Currently, in order to initialize a component with dependencies, dependency initialization and parameter configuration must be explicitly coded everywhere an instance is created. Having to define the implementation in the code does not allow an application configuration to change its implementation through a configuration parameter.

Cloudsim is aiming to become a framework that provides applications with an API that allows running simulations. The architecture design relies on the concept of platforms and components; interchangeable parts that applications can pick and match. It will provide a number of components that applications can choose from (or write on their own if necessary). A mechanism to configure Cloudsim without needing to write code would allow applications to quickly select and configure their components through a configuration file, saving time and help move towards the concept of plugins.

Change

A Factory interface has been introduced to decouple interface fulfillment from the actual implementation. It is designed to tie in well with the new Loader interface, allowing initialization and configuration of interface instances through configuration files.

Other information

Additional documentation

Merge request reports