## The Virtue of Laziness

My son, Alexey Radul, is a programmer. He taught me the importance of laziness in programming.

One of his rules:

Not to write the same line of code in the same program twice.

If you need the same line of code in the same program, that means you should either use a loop or outsource the line to a function. This style of coding saves time; it makes programs shorter and more elegant. Such programs are easier to debug and understand.

I remember how I copied and pasted lines of code before he taught me this rule. Then I needed to change parameters and missed some of the lines during changing. Debugging was such a headache.

Mathematicians are way lazier than programmers. Consider the system of two equations: x+2y=3 and 4x+5y=6. There are no repeating lines here. Only letters x and y appear twice. Mathematicians invented the whole subject of linear algebra and matrices so that they would not need to rewrite variables.

Mathematicians are driven by laziness. Once ancient mathematicians first solved a quadratic equation, they didn’t want to do it again. So they invented a formula that solves all quadratic equations once and for all.

I try to keep up with tradition. I try to make my theorems as general as possible. When I write my papers, I try to make them short and simple. When I think about mathematics I try to get to the stage where the situation is so clear I can think about it without paper and pencil. I often discover new theorems while I am in bed, about to fall asleep. Sometimes I wake up with a good idea. So I do my job while I sleep.

I love my profession. I get paid for being lazy.

## Chris:

I don’t know what kind of formatting your blog supports, but I’d point out that the concept is pervasive throughout the (good) programming culture and is acronymized [DRY](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) for “Don’t Repeat Yourself”, although the focus is more on correctness and reusability than laziness. Cheers.

11 April 2014, 1:10 pm## none:

Laziness for engineers

11 April 2014, 2:37 pmhttp://www.tickld.com/cdn_image_thing/746940.jpg

## Tanya Khovanova:

none,

Nice.

11 April 2014, 2:41 pm## Motlalepula Mokhele:

however I tend to differ to disagree with you. actually I can say mathematicians are smart workers

15 April 2014, 1:04 am## Jeff Zanooda:

That’s only half of the story, though. The other half is dependencies.

http://www.yosefk.com/blog/redundancy-vs-dependencies-which-is-worse.html

18 April 2014, 6:48 am## Count Iblis:

Umbral calculus would not have been invented had mathematicians not been lazy:

http://en.wikipedia.org/wiki/Umbral_calculus

20 April 2014, 10:53 am## Lew:

Programmers who do not follow the DRY principle are WET – Write Everything Twice, or We Enjoy Typing!

23 April 2014, 9:39 pm