Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove underscore from module names #7

Open
agarie opened this issue Mar 28, 2015 · 4 comments
Open

Remove underscore from module names #7

agarie opened this issue Mar 28, 2015 · 4 comments

Comments

@agarie
Copy link
Member

agarie commented Mar 28, 2015

Each distribution under Distribution has several different implementations depending on the libraries installed: pure Ruby, GSL, Java or statistics2.

Each implementation lives under a module named after the library with an underscore, e.g. Ruby_, Java_.

Is this underscore necessary? Can we find a better name for these modules? Or can we restructure the distribution gem so that these modules aren't necessary anymore?

@jufemaiz
Copy link

Curious as to why this is the case too…

@envp
Copy link
Member

envp commented Jan 19, 2016

While we are at it we can try something like the structure indicated in this wiki article.

Here is the proposed restructuring based on nature of the distribution's support, since this library effectively works with discrete distributions.

Distribution
|_Finite
| |_Uniform
| |  |_GSL
| |  |_Java
| |  |_Ruby
| |_ ...
|_Infinite
  |_Normal
  |  |_GSL
  |  |_Java
  |  |_Ruby
  |_Bernoulli
  |_ ...

let me know what you think

@agarie
Copy link
Member Author

agarie commented Feb 1, 2016

@vaibhav-y that might work, but I would prefer a more shallow structure, like Distribution::Uniform, etc. We could move to a "kind of OO" structure with Distribution::Uniform.new(backend: 'gsl') or something similar.

Of course, of the current issues this is the least important, so if we don't know a clearly better structure, let's not change it (yet). We should provide good arguments for changing something like this. :)

@envp
Copy link
Member

envp commented Feb 1, 2016

I gave it another thought later and what we have right now is quite good. I was toying with the idea of a factory pattern being used to create distribution objects, and this seems to fit the use case of the pattern itself.

Something like this calls a factory constructor (which will work quite well with the current structure)
Distribution.new(:type => :unif, :backend => :gsl)

vaibhav-y/statistical illustrates the idea I have in mind when I say factory pattern for distribution & rngs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants