Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BBQ Ribs and Maintainable Mobile Apps

Patrick Seda
February 12, 2015

BBQ Ribs and Maintainable Mobile Apps

How to create maintainability in your mobile apps.

Patrick Seda

February 12, 2015
Tweet

More Decks by Patrick Seda

Other Decks in Programming

Transcript

  1. Patrick Seda @pxtrick [email protected] •  Independent Mobile App Architect • 

    Titanium zealot … Appc Titan •  Apps: Enterprise to Children’s games
  2. Skeletal Muscles External Intercostals Internal Intercostals •  Used for Inspiration

    •  Pull rib cage upward & outward •  Work in conjunction with diaphragm •  Used for (forced) Expiration •  Pull ribcage inward & downward
  3. Biological API SkeletalMuscle { contract(force) relax() } contract(force) = {

    // complex stuff, e.g. action potential, // T-tubule, actin, myosin, calcium ... }
  4. Biological API * Real-world (involuntary) : •  Pulmonary stretch receptors

    •  Hering - Breuer reflex BrainStem { acquireOxygen(amount, speed) removeCO2() }
  5. Breathing BrainStem -  acquireOxygen() - removeCO2() Cortex -  acquireOxygen() -

    removeCO2() (voluntary) (involuntary) ExternalIntercostals -  contract() - relax() Diaphragm -  contract() - relax() ?
  6. Facade ExternalIntercostals -  contract() - relax() Diaphragm -  contract() -

    relax() Breathing Lungs -  inhale() - exhale() BrainStem -  acquireOxygen() - removeCO2() Cortex -  acquireOxygen() - removeCO2() (voluntary) (involuntary)
  7. ExternalIntercostals -  contract() - relax() Diaphragm -  contract() - relax()

    Breathing Facade Lungs -  inhale() - exhale() BrainStem -  acquireOxygen() - removeCO2() Cortex -  acquireOxygen() - removeCO2() (voluntary) (involuntary) InternalIntercostals -  contract() - relax() (forced exhale) (normal)
  8. Symptoms of Bad Design Rigidity: Difficult to change, changes cause

    cascading changes Fragility: Unexpected breakage after a fix Immobility: Not reusable across projects Viscosity: Easy to do the wrong thing, hard to do the right thing
  9. Good Design … How? Single Responsibility Principle SOLID Principles Open/Closed

    Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
  10. Good Design … How? Ask these 3 questions: “Who should

    reasonably own this behavior?” “Who should interact with whom?” “Does this make sense?”
  11. Good Design … How? Roles & Responsibilities Loose Coupling /

    Modularity •  Single Responsibility Principle •  Interface Segregation Principle •  Open/Closed Principle •  Liskov Substitution Principle •  Dependency Inversion Principle •  Builder •  Bridge •  Command •  Interpreter •  Proxy •  State •  Strategy
  12. How Much Design? BDUF Agile/XP FDUF Everything! Nothing! “How much

    should we design up front?” Flexible Design Up Front
  13. How Much Design? The best predictor of change … “How

    much should we design up front?” … is previous change.
  14. Utilities // Utilities Helper { formatSSN(str) handleHTTPError(obj) removeAllChildren(uiView) groupDigits(str, country)

    formatAsCurrency(str, country) removeAlphaChars(str) validatePhoneNumber(str) formatPhoneNumber(str, style) }
  15. Utilities // Utilities Helper { formatSSN(str) handleHTTPError(obj) removeAllChildren(uiView) groupDigits(str, country)

    formatAsCurrency(str, country) removeAlphaChars(str) validatePhoneNumber(str) formatPhoneNumber(str, style) } PLEASE don’t do THIS! (Low cohesion)
  16. Web Services C. Kleeschulte J. Lonon M. Lockley H. Proske

    S. Feather C. Curry Refresh P. Patel Web Service Some Meetup app:
  17. Web Services HTTP Web Service Button Mock Data WS Proxy

    Mock WS Proxy getMembers() require()
  18. Technical Debt The Good The Bad •  Reduces time-to-market • 

    We understand the problem •  Code is kept clean •  Intentional (have plan for payback) •  Unintentional complexity •  Shoddy workmanship •  Becomes unmaintainable •  Leads to app REWRITE
  19. Value Quadrants Visible   Invisible   Value   +  

    -­‐   (Features) (Architecture/Design) (Technical Debt) (Bugs) CRUFT
  20. Value Quadrants “Badly designed, unnecessarily complicated, or unwanted code” -

    Oxford Dictionary Cruft: “The single contributing reason you’re going to rewrite your app from scratch, i.e. unmaintainable garbage” - Patrick Seda
  21. Value Quadrants Visible   Invisible   Value   +  

    -­‐   (Features) (Architecture/Design) (Technical Debt) (Bugs) Op#mized  UX   Works  correctly   Organic  anima#ons   Good  UI  design   Modular  design   UI  Typos   Slow  performance   Crashes   Duplicate  code   No  unit  tests   Doesn’t  work  correctly   SOLID  principles   Logging  framework   Coding  standards   “Big  Ball  of  Mud”   CRUFT
  22. Visible   Invisible   Value   +   -­‐  

    (Features) (Architecture/Design) (Technical Debt) Quality - (Desired)
  23. Visible   Invisible   Value   +   -­‐  

    (Features) (Architecture/Design) (Technical Debt) (Bugs) Quality - (Prod. Reality)
  24. Visible   Invisible   Value   +   -­‐  

    (Features) (Architecture/Design) (Technical Debt) (Bugs) Quality - (Prod. Over Time)
  25. Summary 1) You MUST avoid creating CRUFT 2) You MUST

    be DISCIPLINED 3) You MUST focus on good DESIGN 4) You MUST LEARN from the past The Maintainable Mobile App: