Slide 1

Slide 1 text

Harmful GOTO's, Premature Optimizations, and Programming Myths are The Root of all Evil Alvaro Videla

Slide 2

Slide 2 text

Myths

Slide 3

Slide 3 text

myth: a widely held but false belief or idea Google define

Slide 4

Slide 4 text

myth: an unproved or false collective belief that is used to justify a social institution dictionary.com

Slide 5

Slide 5 text

The Book of Legendary Lands

Slide 6

Slide 6 text

What it was that Christopher Columbus tried to demonstrate?

Slide 7

Slide 7 text

A History of the Life and Voyages of Christopher Columbus

Slide 8

Slide 8 text

Lactantius - Cosmas Indicopleustes

Slide 9

Slide 9 text

Do we have similar myths in Computer Science?

Slide 10

Slide 10 text

Some Myths • No Unit-Tests, no working code • Procedure calls are expensive • NoSQL is faster than traditional DBs • 10x Engineers • Servers are cheaper than engineers

Slide 11

Slide 11 text

In the beginning…

Slide 12

Slide 12 text

May I ask if there is a reason why you prefer using goto instead of function recursion? https://github.com/igorw/retry/issues/3

Slide 13

Slide 13 text

retry library

Slide 14

Slide 14 text

retry library

Slide 15

Slide 15 text

retry library

Slide 16

Slide 16 text

GOTO flamewar dot gif

Slide 17

Slide 17 text

Go To Statement Considered Harmful

Slide 18

Slide 18 text

GOTO still considered harmful?

Slide 19

Slide 19 text

A case against the goto statement + Niklaus Wirth = Go To Statement Considered Harmful

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Please don't fall into the trap of believing that I am terribly dogmatical about [the go to statement]. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline! E. Dijkstra

Slide 22

Slide 22 text

Please don't fall into the trap of believing that I am terribly dogmatical about [the go to statement]. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline! E. Dijkstra

Slide 23

Slide 23 text

In search of Silver Bullets • Microservices • Testing • Agile • Performance Tricks • NoSQL • Message Queues

Slide 24

Slide 24 text

Beating the CAP Theorem https://www.youtube.com/watch?v=Wp08EmQtP44#t=1273

Slide 25

Slide 25 text

There is no single development, in either technology or management technique, which by itself promises even one order of magnitude [tenfold] improvement within a decade in productivity, in reliability, in simplicity Frederick Brooks Jr No Silver Bullet - http://worrydream.com/refs/Brooks-NoSilverBullet.pdf

Slide 26

Slide 26 text

Structured programming with go to statements • Introduction • Elimination of Go To Statements • Introduction of Go To Statements • Conclusions

Slide 27

Slide 27 text

Structured programming with go to statements

Slide 28

Slide 28 text

What year is this paper from?

Slide 29

Slide 29 text

1974 http://www.gregwilson.co.uk/tag/muhammad-ali/

Slide 30

Slide 30 text

http://dl.acm.org/citation.cfm?id=807045&dl=ACM&coll=DL

Slide 31

Slide 31 text

Logic Programming http://dspace.mit.edu/handle/1721.1/6171 http://dl.acm.org/citation.cfm?doid=155360.155362 1969 1972

Slide 32

Slide 32 text

http://web.archive.org/web/20120716185629/http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf

Slide 33

Slide 33 text

1973: Ethernet & UNIX http://www.computerhistory.org/timeline/?year=1973

Slide 34

Slide 34 text

1976: Big O Notation http://www.phil.uu.nl/datastructuren/10-11/knuth_big_omicron.pdf

Slide 35

Slide 35 text

1976: Big O Notation http://www.phil.uu.nl/datastructuren/10-11/knuth_big_omicron.pdf

Slide 36

Slide 36 text

1977: RSA http://www.google.com/patents/US4405829

Slide 37

Slide 37 text

1978: Type Polymorphism https://courses.engr.illinois.edu/cs421/sp2013/project/milner-polymorphism.pdf

Slide 38

Slide 38 text

TL;DR: 1974 • Almost no personal computers • Public Encryption a new thing • Structured Programming was all the rage • Abstract Data Types a new thing

Slide 39

Slide 39 text

low computer resources

Slide 40

Slide 40 text

“most of the running time in non-IO-bound programs is concentrated in about 3% of the source text” D. Knuth

Slide 41

Slide 41 text

“Experience indicates that nearly everybody has the wrong idea about the real bottlenecks in his programs” D. Knuth Computer Programming as an Art - http://dl.acm.org/citation.cfm?id=361612

Slide 42

Slide 42 text

“we should forget about small efficiencies, say about 97% of the time” D. Knuth

Slide 43

Slide 43 text

“premature optimization is the root of all evil” D. Knuth

Slide 44

Slide 44 text

“premature optimization is the root of all evil” D. Knuth The Godwin Law of Optimization Discussions

Slide 45

Slide 45 text

“Yet we should not pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified” D. Knuth

Slide 46

Slide 46 text

“Yet we should not pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified” D. Knuth

Slide 47

Slide 47 text

“the universal experience of programmers who have been using measurement tools has been that their intuitive guesses fail” D. Knuth

Slide 48

Slide 48 text

more GOTO elimination with focus on performance and program readability

Slide 49

Slide 49 text

“My books emphasize efficiency because they deal with algorithms that are used repeatedly as building blocks in a large variety of applications” D. Knuth

Slide 50

Slide 50 text

“We shouldn't merely remove go to statements because it's the fashionable thing to do; the presence or absence of go to statements is not really the issue.” D. Knuth

Slide 51

Slide 51 text

“We shouldn't merely remove go to statements because it's the fashionable thing to do; the presence or absence of go to statements is not really the issue.” D. Knuth

Slide 52

Slide 52 text

“The question is whether we should ban it [GOTO], or educate against it” Donald Knuth

Slide 53

Slide 53 text

Cargo Cult Programming http://c2.com/cgi/wiki?CargoCult

Slide 54

Slide 54 text

“The biggest problem we have as human beings is that we confuse our beliefs with reality” Alan Kay http://www.tele-task.de/archive/video/html5/14029/

Slide 55

Slide 55 text

How did we arrive to this status?

Slide 56

Slide 56 text

Pop Culture

Slide 57

Slide 57 text

“[in the 70s] computing spread out much, much faster than educating unsophisticated people can happen” Alan Kay https://queue.acm.org/detail.cfm?id=1039523

Slide 58

Slide 58 text

Twitter/HackerNews Oriented Programming

Slide 59

Slide 59 text

http://tinytocs.org/

Slide 60

Slide 60 text

“Those who cannot remember the past are condemned to repeat it" George Santayana https://archive.org/stream/lifeofreasonorph01sant#page/284/mode/2up

Slide 61

Slide 61 text

https://archive.org/stream/lifeofreasonorph01sant#page/284/mode/2up

Slide 62

Slide 62 text

History Repeats Itself Agile vs. Thinking Forth http://thinking-forth.sourceforge.net

Slide 63

Slide 63 text

History Repeats Itself TDD https://arialdomartini.wordpress.com/2012/07/20/you-wont-believe-how-old-tdd-is/ You won’t believe how old TDD is vs.

Slide 64

Slide 64 text

History Repeats Itself offline-first http://www.isi.edu/~johnh/RESEARCH/ucla/#ficus_replication primarily-disconnected vs.

Slide 65

Slide 65 text

“In 1968, the Communications of the ACM published a text of mine under the title "The goto statement considered harmful", which in later years would be most frequently referenced, regrettably, however, often by authors who had seen no more of it than its title” E. Dijkstra https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1308.html

Slide 66

Slide 66 text

“In 1968, the Communications of the ACM published a text of mine under the title "The goto statement considered harmful", which in later years would be most frequently referenced, regrettably, however, often by authors who had seen no more of it than its title” E. Dijkstra https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1308.html

Slide 67

Slide 67 text

Fahreinheit 451

Slide 68

Slide 68 text

“Classics cut to fit fifteen-minute radio shows, then cut again to fill a two-minute book column, winding up at last as a ten- or twelve-line dictionary resume” Fahrenheit 451

Slide 69

Slide 69 text

Memes

Slide 70

Slide 70 text

“[…] there has been far too much emphasis on go to elimination instead of on the really important issues; people have a natural tendency to set up all easily understood quantitative goal like the abolition of jumps, instead of working directly for a qualitative goal like good program structure” D. Knuth

Slide 71

Slide 71 text

“[…] there has been far too much emphasis on go to elimination instead of on the really important issues; people have a natural tendency to set up all easily understood quantitative goal like the abolition of jumps, instead of working directly for a qualitative goal like good program structure” D. Knuth

Slide 72

Slide 72 text

“we should strive most of all for a program that is easy to understand and almost sure to work” D. Knuth

Slide 73

Slide 73 text

“we had better see to it that the computer industry does not kill computing science” E. Dijkstra https://www.cs.utexas.edu/users/EWD/transcriptions/EWD12xx/EWD1284.html

Slide 74

Slide 74 text

Thanks Alvaro Videla - @old_sound