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

Think of a more elegant way to handle SGA #162

Open
gbordyugov opened this issue Oct 13, 2017 · 3 comments
Open

Think of a more elegant way to handle SGA #162

gbordyugov opened this issue Oct 13, 2017 · 3 comments

Comments

@gbordyugov
Copy link
Contributor

gbordyugov commented Oct 13, 2017

The current way of doing it revolves around passing an external data frame to the (apparently private) _delta() method, which goes a bit against the idea of encapsulation

https://github.com/zalando/expan/blob/dev/expan/core/experiment.py#L102

@daryadedik
Copy link
Contributor

Can you explain a bit more about what is the problem with passing data to _delta() from sga?

@gbordyugov
Copy link
Contributor Author

gbordyugov commented Oct 18, 2017

It's about encapsulation. _delta() is a (private) method of the Experiment class, it's supposed to perform operations on its fields instead of taking arbitrary (and possibly not verified) data frames from the outside world.

Which one do you like better:

class Complex(object):
  def __init__(self, x, y):
    self.x, self.y = x, y

  def abs(self):
    return sqrt(self.x*self.x + self.y*self.y)

or

class Complex(object):
  def __init__(self, x, y):
    self.x, self.y = x, y

  def abs(self, x, y):
    return sqrt(x*x + y*y)

?

@daryadedik
Copy link
Contributor

thanks for clarifying! It makes sense, just didn't get it from the first sight.

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

2 participants