## 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.

Share:

1. #### 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.

2. #### none:

Laziness for engineers
http://www.tickld.com/cdn_image_thing/746940.jpg

none,

Nice.

4. #### Motlalepula Mokhele:

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

5. #### 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

6. #### Count Iblis:

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

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

7. #### Lew:

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