2017 melb.jvm: "the hills are alive with the sound of your crappy code! "

22
@andee_marks The hills are alive... with the sound of your crappy code The hills are alive... with the sound of your crappy code

Upload: andy-marks

Post on 21-Jan-2018

28 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

The hills are alive... with the sound of your

crappy code

The hills are alive... with the sound of your

crappy code

Page 2: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Background

https://www.youtube.com/watch?v=Sg2BjFQnr9shttps://www.youtube.com/watch?v=063FTX4FE3g

Page 3: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Agenda

● Music theory redux● Aeolian ● Design choices (& examples)

Page 4: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Music theory redux

Page 5: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Tempo KeyNote OctaveChord

Page 6: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

github.com/andeemarks/aeolian

Page 7: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Java source metrics ⇨ “music”

“the aeolian tonic chord is the submediant minor triad”

One note per line of code

Make good quality code pleasant to listen to

Make poor quality code unpleasant to listen to

Page 8: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Tool chain

abc2midi timidityaeoliancheckstylebash

metrics

.abc

.midi

Page 9: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Aeolian/Hello World

public class HelloWorld {public static void main(String args[]) {

System.out.println("Hello World!");}

}

X:1T:HelloWorld.metricsC:AEOLIANM:4/4L:1/8Q:1/4=140K:C%%MIDI gchord c| "C"E c b E, E, E, |

X:1T:HelloWorld.metricsC:AEOLIANM:4/4L:1/8Q:1/4=140K:C%%MIDI gchord c| "C"E c b E, E, E, |

Page 10: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

ABC Notation

X:1T:HelloWorld.metricsC:AEOLIANM:4/4L:1/8Q:1/4=140K:C%%MIDI gchord c| "C"E c b E, E, E, |

Tempo

Key

Octave

Note

Chord

Page 11: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices

Page 12: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #1/Notes

<module name="LineLength">

(cond(< line-length 10)(note-from-octave octave-1 line-length)

(<= 10 line-length 39) (note-from-octave octave-2 line-length)

(<= 40 line-length 79) (note-from-octave octave-3 line-length)

...Notes

checkstyle

clojure

Page 13: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #2/Tempo

<module name="CyclomaticComplexity">

Tempo

checkstyle

(+ (* 20 complexity) default-tempo)

clojure

Page 14: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #3/Key

Keys

<module name="SimianCheck">

checkstyle

(if (< duplication-percentage 10)(set-major-key)(set-minor-key)))

clojure

Page 15: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #4/Accompanying chord

<module name="MethodLength">

checkstyle

(cond(<= 1 method-length 5)(chord 0)

(<= 6 line-length 10) (chord 1)

(<= 11 line-length 15) (chord 2)

...

clojure

Chord

Page 16: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #5/Instruments

(if (not (= current-author (get-author)))(instrument-for current-author)

clojure

Instruments

git blame...

bash

Page 17: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #6/Lyrics

(if (not (= current-source-file (get-source-file)))(lyrics-for current-source-file)

clojure

Lyrics

“Doe - a deerA female deerRay - a drop Of golden sunMe - a nameTo call myself”...

“Doe - a deerA female deerRay - a drop Of golden sunMe - a nameTo call myself”...

Page 18: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices #7/Sequencing

Sequencing

git blame… sort…

bash

Page 19: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Design Choices/Unresolved/Discarded

Comments

/**

**/

Volume Length

Note length Editor integration

Stereo

Page 20: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Conclusion

Page 21: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Line length ⇨ Note/octave

Cyclomatic complexity ⇨ Tempo

Method length ⇨ Accompanying chord

Duplication ⇨ Key

Git commit author ⇨ Instrument

Source file name ⇨ Karaoke lyric (for lolz)

Page 22: 2017 Melb.JVM: "The Hills are alive with the Sound of your Crappy Code! "

@andee_marks

Conclusion

Thank You!Thank You!