Skip to content

Global/Singleton Options #101

@Pedrozo

Description

@Pedrozo
  • Motivation: Many global parameters are defined only once (usually read from a file) and broadly used by the system. Currently, a single object holds all this data, and references are forwarded between classes. The consequence is recurrent boilerplate code to access an object instance that could be globally defined. Additionally, many classes that depend on Options only require 1 or 2 of its members, thus breaking the principle of least knowledge. For example, the HTTPServer receives the whole Options only to use the getHttpPort() member. It's just like the "Gorilla and the Banana problem": your class just needs a banana, but you have to receive a gorilla holding a banana, making you have to deal with the big and expensive gorilla as well.

  • Objective: Allow a single definition of global parameters, and make all classes/functions depend only on what is truly needed, instead of depending on a big global object.

  • Success Criteria: Unified global parameters definiton, allowing initialization from files, but also injection for testing purposes.

  • Dependencies: No dependencies.

  • Risks and Mitigations: This task should not impact current successful tests as no behavior changes will take place.

  • Resource Allocation: Requires proper reviewing as the selected approach must scale in future implementations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions