Write it once
When the same calculation appears in three places, every fix has to be made three times. A method gives a piece of logic a name, so you write it once and call it wherever you need it.
When the same calculation appears in three places, every fix has to be made three times. A method gives a piece of logic a name, so you write it once and call it wherever you need it.