News for hackers. Stuff that matters.
Re:Write code that is easy to delete, not easy to extend (2016) by smileypete on Wednesday July 22, 2020 @09:21AM (#23916662)
Maybe

    drawColouredRectangle("red", x0, y0, x1, y1)

    decideHighlightColour(someDecidingFactor1, someDecidingFactor2)
then call separately? Depends on the number of calls to drawHighlightingRectangle I guess.

Something I've learned recently is to try to think in terms of behaviours, then compose them instead of mixing them together. Also it's easier to juggle the pieces by erring on the side of decomposition initially, then recompose a bit once they're organised, but only if it makes more sense.

There are no comments on this comment yet.