Slide 1

Slide 1 text

IN SEARCH OF THE SOFTWARE URSATZ Sean Cribbs @seancribbs

Slide 2

Slide 2 text

ABOUT ME Software Engineer at Basho Technologies We make Riak! erstwhile Pianist, Conductor, Composer, Music Theorist

Slide 3

Slide 3 text

IN SEARCH OF... An understanding of so!ware cra!smanship An intuitive technique for analysis of software structure A subjective means of critical comparison More why and less how

Slide 4

Slide 4 text

WHY CARE? We can improve our cra!, so we need a "amework for critical thought that goes beyond surface features. There is a difference between simplicity and ease. My belief: Systems reflect [leak?] the foundations on which they are built.

Slide 5

Slide 5 text

A TALE OF TWO PIECES images from Wikimedia Commons

Slide 6

Slide 6 text

A TALE OF TWO PIECES images from Wikimedia Commons

Slide 7

Slide 7 text

A TALE OF TWO PIECES images from Wikimedia Commons

Slide 8

Slide 8 text

A TALE OF TWO PIECES J.S. Bach’s Prelude No. 1 in C and Chopin’s Etude No. 8 in F images from Wikimedia Commons

Slide 9

Slide 9 text

A TALE OF TWO PIECES J.S. Bach’s Prelude No. 1 in C and Chopin’s Etude No. 8 in F Have the SAME Fundamental Structure images from Wikimedia Commons

Slide 10

Slide 10 text

WHO IS HEINRICH SCHENKER?

Slide 11

Slide 11 text

BIOGRAPHICAL Born 1868 in present-day Ukraine Studied as a child with Carl Mikuli in Lemberg (Lviv) Scholarship to University of Vienna in 1884, also studied at the Konservatorium with Anton Bruckner & Ernst Ludwig Became regular performer, conductor, composer, critic, and theorist Taught his theories privately in his home

Slide 12

Slide 12 text

ACCOMPLISHMENTS Championed Urtext and the study of primary sources: manuscripts, diaries, letters Published extensive scholarly editions of major works, incl. Beethoven’s Symphony no. 9 Theories of Harmony, Counterpoint, and Free Composition

Slide 13

Slide 13 text

SCHENKERIAN ANALYSIS & CODE

Slide 14

Slide 14 text

HARMONIC SERIES a.k.a. “The Overtone Series” or “Chord of Nature” images from Wikimedia Commons

Slide 15

Slide 15 text

HARMONIC SERIES a.k.a. “The Overtone Series” or “Chord of Nature” images from Wikimedia Commons

Slide 16

Slide 16 text

HARMONIC SERIES a.k.a. “The Overtone Series” or “Chord of Nature” images from Wikimedia Commons

Slide 17

Slide 17 text

VERTICAL IN CODE The environments in which our software runs – hardware, operating system, runtime, libraries – constitute the vertical dimension or harmony. Each component in the vertical is built on a layer below, imparting some of that layer’s aesthetics and form up the stack.

Slide 18

Slide 18 text

COUNTERPOINT The interaction of two or more simultaneous melodic lines, aka “voice leading” Counterpoint “rules” derived from intervallic relationships, aesthetic considerations Strict: regular divisions of other line aka “species” Free: free choice of all/any divisions, chromaticism, freer dissonances

Slide 19

Slide 19 text

HORIZONTAL IN CODE Linear progressions of steps in code are analogous to melody. Interactions and tensions between independent procedures constitute a sort of counterpoint. Procedures in lock-step are like strict counterpoint; procedures with independence are more free and pleasing.

Slide 20

Slide 20 text

DER TONWILLE “The Will of the Tones”, or Scale Functions images from Wikimedia Commons 1 2 3 4 5 6 7 8 1 - tonic 2 - dissonant, down 3 - consonant 4 - dissonant, down 5 - consonant 6 - consonant, down 7 - dissonant, up 8 - consonant

Slide 21

Slide 21 text

WILL OF THE CODE Coupling and connascence are analogous to notions of consonance, dissonance, and scale function. Removing coupling resolves unnecessary dissonance. Reducing the degree of connascence produces more harmonious, flexible, modular code. The relationships of independent procedures should point toward the same goal.

Slide 22

Slide 22 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 23

Slide 23 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 24

Slide 24 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 25

Slide 25 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 26

Slide 26 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 27

Slide 27 text

URSATZ The Fundamental Structure images from Wikimedia Commons

Slide 28

Slide 28 text

PROLONGATION “Semper idem sed non eodom modo” Always the same, but not always in the same way. The process of composing-out [Auskomponierung]: extending a harmony over time, or elaboration The exploration of the meanings of a motif Gives rise to different structural levels (Schichte) Progression from strict to "ee counterpoint

Slide 29

Slide 29 text

CODE PROLONGATION Refactoring toward general algorithms is analogous to structural prolongation in music. Use of generalized algorithms [patterns?] increases readability and maintainability, and can be more amenable to global optimization.

Slide 30

Slide 30 text

CODE COMPLEXITY “Most techniques for controlling compleixty...decompose a problem into almost independently solvable subproblems” “[A] good package encapsulates a higher level concept which has meaning independent of its implementation.” “Often one can make progress to the solution of a simplified version of the problem which is similar in some essential aspect to the original one but which differs from it in detail.” – Sussman and Steele, The Art of the Interpreter

Slide 31

Slide 31 text

GRAPHIC ANALYSIS “Urlinie Tafel” Image from http://nicolas.meeus.free.fr/Analyses.html

Slide 32

Slide 32 text

CODE GRAPHS? We have no strong analogy here: boxes-and-arrows, sequence diagrams, UML, etc, are all in a vocabulary different "om the subject being analyzed. On the other hand, we%-structured code could approach its own graphical analysis.

Slide 33

Slide 33 text

KEY POINTS A unique understanding of harmony and counterpoint Relies on the intuition and subjectivity of the musician Multiple, interrelated layers of structure via prolongation A common language independent of style

Slide 34

Slide 34 text

LIMITATIONS Focused on Tonal music only, expanded later by others Plagued with 19th-century chauvinism, disregards unprivileged viewpoints Predates modernist and post-modernist art and theory

Slide 35

Slide 35 text

EXAMPLE

Slide 36

Slide 36 text

Client App riak_kv_pb_listener riak_kv_pb_server riak_kv_pb_server riak_kv_pb_server riak_kv_pb_server TCP Riak riak-erlang-client

Slide 37

Slide 37 text

PROBLEMS Client library is a dependency of the server Hard to extend server process with new requests, coupled to Riak KV Request processing intermixed with connection handling

Slide 38

Slide 38 text

DECOUPLING Separate request/response message definition into an independent library Separate connection management from request processing, using Erlang “behaviours” - basically creating a uniform interface Extract the new structure from Riak KV into a new namespace/app

Slide 39

Slide 39 text

PATTERN ELABORATION gen gen_server riak_api_pb_server

Slide 40

Slide 40 text

PATTERN ELABORATION gen gen_server riak_api_pb_server riak_api_pb_service riak_kv_pb_object

Slide 41

Slide 41 text

PATTERN ELABORATION gen gen_server riak_api_pb_server riak_api_pb_service riak_kv_pb_object Implementation Behaviour

Slide 42

Slide 42 text

REVIEW

Slide 43

Slide 43 text

REVIEW Software and music are multi-layered with intricate internal relationships. Our cra! of software should reflect an intuition and awareness of multiple simultaneous levels of abstraction. We are both composer and analyst. This analytical technique does not prove greatness or correctness, but could be a means for greater insight into software design.

Slide 44

Slide 44 text

REFERENCES Schenker, Heinrich; ed. and annot. Oswald Jonas (1954) [1906]. Harmony. trans. Elisabeth Mann-Borgese. Chicago: University of Chicago Press. ISBN 0-226-73734-9. OCLC 280916. Schenker, Heinrich. Five Graphic Music Analyses. Dover, 1969. SchenkerGUIDE http://www.schenkerguide.com Schenkerian analysis on Wikipedia: http://en.wikipedia.org/wiki/Schenkerian_analysis

Slide 45

Slide 45 text

REFERENCES, CONT. Luciane Beduschi and Nicolas Meeùs. Schenkerian Theory and Analysis http://nicolas.meeus.free.fr/Analyses.html Steele, Guy and Sussman, Gerald. The Art of the Interpreter. MIT AI memo No. 453, 1978. ftp://publications.ai.mit.edu/ ai-publications/pdf/AIM-453.pdf

Slide 46

Slide 46 text

THANK YOU @seancribbs