scientistproject / Scientist.net

A .NET library for carefully refactoring critical paths. It's a port of GitHub's Ruby Scientist library
MIT License
1.46k stars 95 forks source link

Do something about the unwieldy ExperimentInstance constructor. #57

Closed haacked closed 8 years ago

haacked commented 8 years ago

The constructor for ExperimentInstance has a lot of parameters. Because we want this to effectively be an read only instance, we need to supply all the parameters via the constructor.

Our options are:

  1. Create a new ExperimentSettings class that has settable properties. Add a constructor overload to ExperimentInstance that takes a settings instance and sets all the properties accordingly.
  2. Create a new ExperimentBuilder class that lets you set properties and returns a new instance of ExperimentInstance with those properties set via some Create method.
  3. Add multiple ctor overloads to ExperimentInstance
  4. Something I hadn't considered...

/cc @davezych who noted this problem

joncloud commented 8 years ago

I created a quick implementation of 1. I figured i'd keep it simple, but we can definitely cook up another implementation if it seems more suitable.