|
I think you should ask yourselves why you are drawing blue rectangles. What is their purpose? Do they just happen to be blue? Or are they blue because they have they all "do the same job"? Maybe you should have drawInlineHelpBox(x0, y0, x1, y1) or drawEnergyShield(x0, y0, x1, y1) We can see from the language that unlike your example this is a true abstraction. You went from color parameter to a specific color. It's both phrased in terms of colors. But here we go from color to ui elements. The terminology is completely different. def drawEnergyShield(shield_capacity, incoming_dps, x0, y0, x1, y1):
hue = incoming_dps / shield_capacity
alpha = shield_capacity / 200
drawRectangle(hsva_color(hue, 1, 1, alpha), x0, y0, x1, y1)
And I think you should embrace having business logic in there. |