Boiling out Boilerplate

Warsjawa 2014

Hi, I'm Maciej

  • Android Developer
  • @ EL Passion

What we are going to try?

  • Annotation Processing API (JSR 269)
  • Bytecode weaving
  • AST transformations

Annotation processing

  • Only creating new classes
  • Small amount of reflection
    • or using generated classes directly

Annotation processing

  • AndroidAnnotations
  • ButterKnife
  • Icepick / Memento
  • Parceler / AutoParcel
  • ...

Bytecode weaving

  • After compilation
  • Mostly injecting code into existing methods
  • Depends on build tools

Bytecode weaving

  • Hugo
  • LogLifeCycle
  • InjectView
  • InjectExtra

Bytecode weaving

  • stalk Stéphane Nicolas
    • https://github.com/stephanenicolas/injects
      • Mimic
      • AfterBurner
      • Morpheus
    • https://speakerdeck.com/stephanenicolas/byte-code-weaving-for-android

AST tranformations

  • Most powerful
  • But require support from IDE

AST transformations

  • Lombok & Hrisey
  • Groovy
  • recruting
  • agile software house
  • mastery, autonomy

Let's do some exercises

and only code what is worth coding!

Boiling out Boilerplate / Warsjawa 2014

By Maciej Górski

Boiling out Boilerplate / Warsjawa 2014

  • 1,627