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

why is Easing a type? #24

Open
pixelzoom opened this issue Mar 29, 2019 · 4 comments
Open

why is Easing a type? #24

pixelzoom opened this issue Mar 29, 2019 · 4 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 29, 2019

Easing is currently a collection of static methods and constants. It's constructor does nothing and it has no state:

  function Easing() {}

Why is it a type?

@jonathanolson
Copy link
Contributor

I had it as a type because it essentially defines three abstract methods. I'm open to recommendations for changes.

Should it take the 3 methods as constructor parameters? Should it just be POJOs and the method documentation could be moved to the top of the file?

@pixelzoom
Copy link
Contributor Author

This is a bizarre pattern you're using here. You have an abstract base type. You instantiate that abstract base type, which is antithetical to the whole notion of "abstract". Then you morph the abstract instances into concrete instances using assignment. And if I were to inspect instances of Easing in the debugger, they are liable to have different implementations of the abstract methods.

I'll leave it up to you to decide whether or not to change this.

@pixelzoom pixelzoom assigned jonathanolson and unassigned pixelzoom Apr 8, 2019
@jonathanolson
Copy link
Contributor

I agree it's a bit weird, and I'm happy to change it. What would you recommend instead?

@pixelzoom
Copy link
Contributor Author

  function Easing( value, derivative, secondDerivative ) {

    // @public (read-only)
    this.value = value;
    this.derivative = derivative;
    this.secondDerivative = secondDerivative;
  }

@pixelzoom pixelzoom assigned jonathanolson and unassigned pixelzoom Apr 10, 2019
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