Rex Kerr
Jan 20, 2025

--

Implicit in stretching one axis and not the other axis of an object is that only the one axis gets stretched.

The contract isn't just the one specified by the type signature; it's what follows the API specification _and_ the principle of least surprise.

After all, otherwise you could correctly have the width and height scaling methods always resize the other, too, even for Rectangle! Then it would work for Square. But that would be pointless--you should just have a single `scale` method if you want that API.

--

--

Rex Kerr
Rex Kerr

Written by Rex Kerr

One who rejoices when everything is made as simple as possible, but no simpler. Sayer of things that may be wrong, but not so bad that they're not even wrong.

No responses yet