Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks...

19
@andee_marks Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad?

Transcript of Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks...

Page 1: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Does

Andy MarksTechnical Principal

ThoughtWorks

Smelly

Code Sound

Also

Bad?

Page 2: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Background

Page 3: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Agenda

● Music Theory Redux● Aeolian ● Design Choices (& examples)

Page 4: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

A Music Theory Primer

Notes Tempo KeysOctave

Page 5: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

github.com/andeemarks/aeolian

“the aeolian tonic chord is the submediant minor triad”

Java

One note per line of code

Make good quality code pleasant to listen to

Make poor quality code unpleasant to listen to

Page 6: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Tool chain

metrics

.abc.midi

abc2midi

Page 7: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@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 8: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@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, |

Notes

Tempo

Keys

Octave

Page 9: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices

Page 10: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #1/Notes

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

Page 11: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #2/Tempo

Tempo(+ (* 20 complexity) default-tempo)

<module name="CyclomaticComplexity">

Page 12: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #3/Key

Keys

<module name="SimianCheck">

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

Page 13: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #4/Instruments

Instruments

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

Page 14: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #5/Lyrics

Lyrics

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

Page 15: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices #6/Sequencing

Sequencing

Page 16: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Design Choices/Unresolved

Volume

Stereo Length

Note length Comments

/****/

Editor integration

Page 17: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Conclusion

Page 18: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

Visual indicators

Page 19: Code Sound DoesSmelly Bad? - YOW! Conferences · Does Andy Marks Technical Principal ThoughtWorks Smelly Code Sound Also Bad? @andee_marks Background. @andee_marks Agenda Music Theory

@andee_marks

if (is_smelly?(code)) {

set_build_light(“red”);

} else {

set_build_light(“green”);

}

if (is_smelly?(code)) {

play “What Does The Fox Say (Ylvis)”;

} else {

play “The Blue Danube (Strauss)”;

}

Audio indicators