Slide 1

Slide 1 text

But Does It Actually Work? AutomaCon 2015, Portland Fletcher Nichol @fnichol

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

@fnichol

Slide 6

Slide 6 text

–Me, often “Infrastructure code has high entropy”

Slide 7

Slide 7 text

–Me, also “Infrastructure code must be executed frequently to prevent it from degrading over time”

Slide 8

Slide 8 text

–Devil’s Advocate Me “But, why?”

Slide 9

Slide 9 text

–Adam Jacob, Web Operations “Enable the reconstruction of the business from nothing but a source code repository, an application data backup, and bare metal resources.” Infrastructure as Code

Slide 10

Slide 10 text

–Fletcher, This Talk “It is software.” Infrastructure as Code

Slide 11

Slide 11 text

https://flic.kr/p/dp6D4X

Slide 12

Slide 12 text

Does Code Decay? • Published January, 2001 • Large codebase for telephone switches • 100,000,000 LOC (C/C++) • 15-year old codebase • Each release ~20,000,000 LOC

Slide 13

Slide 13 text

Does Code Decay? Metaphor: software suffering from decay can be thought of as diseased

Slide 14

Slide 14 text

Decayed Code Unit of code is decayed if it is harder to change than it should be, measured in terms of effort, interval, and quality

Slide 15

Slide 15 text

Decayed Code: Measurement 1. Cost of the change, which is effectively on the personnel cost for the developers who implemented it 2. Interval to complete the change, the calendar/clock time required 3. Quality of the changed software

Slide 16

Slide 16 text

Code Decay • Decay is temporal, may be useful to add a “more difficult to change than it used to be” to the definition • Code can be ”correct” and still be decayed • Software that is decaying is simultaneously increasing in value

Slide 17

Slide 17 text

Article Claim “Code decay is the result of previous changes to the software”

Slide 18

Slide 18 text

Decay: Three Classes of Changes 1. Adaptive changes - add new functionality to a system 2. Corrective changes - fix faults in the software 3. Perfective changes (“maintenance for the sake of maintenance” or “reengineering”) - are intended to improve the developers’ ability to maintain the software without altering functionality or fixing faults

Slide 19

Slide 19 text

Symptoms of Code Decay (Selected) 1. Excessively complex (bloated) code 2. A history of frequent change (a.k.a. code churn) 3. Widely dispersed changes 4. Numerous interfaces (i.e. entry points)

Slide 20

Slide 20 text

But It Gets Worse • In general, low fault tolerance (everyone read Release It!) • Dependency management complexities • Aggressively changing runtimes

Slide 21

Slide 21 text

Shannon Entropy • From Information theory • Introduced by Claude E. Shannon in "A Mathematical Theory of Communication” (1948) • Expected value of the information contained in each message received • Entropy of a message is its amount of uncertainty • Increases when the message is closer to random • Decreases when it is less random

Slide 22

Slide 22 text

Entropy Example Polling on a political issue

Slide 23

Slide 23 text

Entropy Example Coin toss

Slide 24

Slide 24 text

Entropy and Software Systems • Published May, 2011 • Combines entropy and testing concepts

Slide 25

Slide 25 text

Why Do We Test? We test software systems because there is uncertainty in its actual behavior.

Slide 26

Slide 26 text

Why Do We Test? 1. The more we test, the more we know about the system under test 2. The more we know about the system under test, the more likely faults can be found

Slide 27

Slide 27 text

Infrequent Testing 0 22.5 45 67.5 90 Time Entropy

Slide 28

Slide 28 text

Frequent Testing 0 20 40 60 80 Time Entropy

Slide 29

Slide 29 text

Frequent Testing 0 20 40 60 80 Time Entropy

Slide 30

Slide 30 text

Frequent Execution 0 20 40 60 80 Time Entropy

Slide 31

Slide 31 text

Frequent Execution 0 20 40 60 80 Time Uncertainty Code in use Code in decay

Slide 32

Slide 32 text

–Jez Humble and David Farley, Continuous Delivery “If it hurts, do it more frequently, and bring the pain forward.”

Slide 33

Slide 33 text

–Me, again “Infrastructure code must be executed frequently to prevent it from degrading over time”

Slide 34

Slide 34 text

Thank You! AutomaCon 2015, Portland Fletcher Nichol @fnichol

Slide 35

Slide 35 text

References Jacob, Adam. “Infrastructure as Code.” Web Operations: Keeping the Data on Time. Ed. John Allspaw and Jesse Robbins. Beijing: O’Reilly, 2010. 65-80. Print. Boehm, B.w., and P.n. Papaccio. “Understanding and Controlling Software Costs.” IEEE Transactions on Software Engineering IIEEE Trans. Software Eng. 14.10 (1988): 1462-477. Web. 9 Sept. 2015. Eick, S.g., T.l. Graves, A.f. Karr, J.s. Marron, and A. Mockus. “Does Code Decay? Assessing the Evidence from Change Management Data.” IEEE Transactions on Software Engineering IIEEE Trans. Software Eng. 27.1 (2001): 1-12. Web. 9 Sept. 2015. Yang, Linmin. “Entropy and Software Systems: Towards an Information-theoretic Foundation of Software Testing.” Diss. Washington State U, 2011. Web. 9 Sept. 2015. . “Entropy (information theory).” Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc. 7 Sept. 2015. 9 Sept. 2015 . Humble, Jez, and David Farley. Continuous Delivery. Upper Saddle River, NJ: Addison-Wesley, 2011. Print.

Slide 36

Slide 36 text

Image Credits Downtown Portland, OR: https://flic.kr/p/cXAqeb Construction Silhouette: https://flic.kr/p/k1fGAe Bay Bridge East Span Under Construction: https://flic.kr/p/wGCczf Lincoln's Inn Library: https://flic.kr/p/dp6D4X Random • Geometry: https://flic.kr/p/6KzZF7 Ballot boxes from the 2008 London elections: https://flic.kr/p/4KBnFw Stock Photography - Canadian Coins: https://flic.kr/p/q6Ufjj Practice. Practice. Practice.: https://flic.kr/p/qSBYah Deserted Beach: https://flic.kr/p/85KM6Q