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

RenderInheritor #134

Open
rcvink opened this issue Mar 20, 2018 · 0 comments
Open

RenderInheritor #134

rcvink opened this issue Mar 20, 2018 · 0 comments
Labels
refactoring code is working but could benefit from refactoring or extraction

Comments

@rcvink
Copy link
Collaborator

rcvink commented Mar 20, 2018

Dear sirs/madams/others - please specify:

Currently when we create a new cell from parents we do it like this:

var cell = new Cell(this._bodyModule.fromVertices(
      this._positionInheritor.x(parent1, parent2),
      this._positionInheritor.y(parent1, parent2),
      this._shapeInheritor.childVertices(parent1, parent2),
      { render: {fillStyle: this._colourInheritor.colourMixer(parent1, parent2) }}),
                        new Gait(),
                        new Age(time),
                        new Voice()
                       );

It could be cleaner if we had a RenderInheritor which returned a more useful object, cleaning up our code into something like this:

var cell = new Cell(this._bodyModule.fromVertices(
      this._positionInheritor.x(parent1, parent2),
      this._positionInheritor.y(parent1, parent2),
      this._shapeInheritor.childVertices(parent1, parent2),
      this._renderInheritor.childRender(parent1, parent2)
      ),
                        new Gait(),
                        new Age(time),
                        new Voice()
                       );

For anyone who might be thinking 'Roland you're trying to remove our code from the project!' It is not so.

The render inheritor would still need a colourInheritor to mix the parents' colours! It could be instantiated like this:

var colourInheritor = new ColourInheritor(rgbFormatter, mutator);
var renderInheritor = new RenderInheritor(colourInheritor);

Thoughts comments feedback?

@rcvink rcvink added the refactoring code is working but could benefit from refactoring or extraction label Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring code is working but could benefit from refactoring or extraction
Projects
None yet
Development

No branches or pull requests

1 participant