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);
Dear sirs/madams/others - please specify:
Currently when we create a new cell from parents we do it like this:
It could be cleaner if we had a
RenderInheritor
which returned a more useful object, cleaning up our code into something like this: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:
Thoughts comments feedback?