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

The Code was the Easy Part: Introducing an iOS ...

Sam Jarman
September 04, 2019

The Code was the Easy Part: Introducing an iOS Library at a Corporate

In 2018, we developed an internal iOS “Style Guide”. A Swift library full of branded UIViews, UIColors, UIFonts and more for use in building our apps. Our iOS devs breezed through the coding of the library, but what we found was that was the easy part... Were 12 developers ready for such a change in coding methodology? Our first internal dependency? A lot was changing. This talk covers the development of the framework, but more importantly, the conversations, mindset shifts and debates we went through to scale our iOS development. This talk will go into topics such as API design, semantic versioning, testing coverage, team and personal responsibilities, expectation management, and more.

Sam Jarman

September 04, 2019
Tweet

More Decks by Sam Jarman

Other Decks in Programming

Transcript

  1. THE CODE WAS 
 THE EASY PART Introducing an iOS

    Library at a Corporate @samjarman #DevWorld
  2. NEW YEAR
 HU DIS • Sam Jarman • iOS Apps

    Since 2009 • Full time iOS 2018/2019 • Polyglot Programmer • Currently writing JS full time @samjarman
 #DevWorld
  3. @samjarman #DevWorld TODAY • This is a talk about software

    engineering • Problems with existing code and processes • Introducing a iOS UI Framework • The mindset changes • The lessons learned
  4. @samjarman #DevWorld TEAM MAKE UP Android
 Dev Android
 Dev iOS


    Dev iOS
 Dev Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner
  5. @samjarman #DevWorld Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev

    Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner FEATURE A FEATURE B FEATURE C
  6. @samjarman #DevWorld Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev

    Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner Android
 Dev Android
 Dev iOS
 Dev iOS
 Dev Tester Tester Biz Analyst Product Owner CHAPTERS
  7. @samjarman #DevWorld TESTING • If you changed “common” • Testers

    had to test the other app (manual) • Without context / cases / SLA cases • Without an expectation for what is normal • Doing the process without an impact on quality
  8. @samjarman #DevWorld Don’t share features across apps 
 unless they’re

    never ever going to change between apps. LESSON 1
  9. @samjarman #DevWorld Target State 
 Architecture 
 (TSA) • An

    agreement of what our codebase would look like without tech debt • What if it would look like if we built it today • What we want to get to • Check each time if a change is towards or away from TSA
  10. @samjarman #DevWorld • Try this at your own company •

    Take half a day with your engineers to think what perfection would look like • Maybe it’s micro-services, modularisation, etc. • Come back with a plan • Stick it on the wall, refer to it 
 again and again Target State 
 Architecture 
 (TSA)
  11. @samjarman #DevWorld Take the time to make sure 
 your

    team agrees on the target 
 state architecture. LESSON 2
  12. @samjarman #DevWorld View Business
 Logic Model APIs WHAT WAS SHARED?

    View Business
 Logic Model APIs App A App B Common
 (and more)
  13. @samjarman #DevWorld We are now making 
 code for our

    teammates to use. MINDSET 
 SHIFT
  14. @samjarman #DevWorld THE START • We’d start with a UI

    Library 
 – “StyleGuide” • Needed to prove the concept to ourselves and internally • No time from the business for this – a secret skunkworks project
  15. @samjarman #DevWorld CONTAINED: • Cocoa Touch Framework • UIKit Subclasses

    • Fonts • Colours • Typography • Some view controllers
  16. @samjarman #DevWorld STYLE GUIDE
 COMMITTEE • Four Devs – two

    devs from each app group • Our iOS designer
  17. @samjarman #DevWorld BUILD 
 TIME • Built the framework in

    a few hours • Moved over most 
 existing components • Renamed • Fixed imports • Got it building
  18. @samjarman #DevWorld THE LONG 
 TAIL BUILD Sketch Files Swift

    Files • Build complex TableView rows • Buttons • Text Fields
  19. @samjarman #DevWorld DISCUSSIONS • Nut out API design • Component

    boundaries • Naming schemes • Best practices • Wrote up documentation for chapter
  20. @samjarman #DevWorld (Like these slides before @HelloMissPotter helped me out.)

    The goal of the StyleGuide 
 was to not let developers create something ugly.
  21. @samjarman #DevWorld API DESIGN • Alloc init with? • Dequeue

    and setup()? • Factory? • Config objects? • Builder pattern? • Getters and setters for everything?
  22. @samjarman #DevWorld SETUP() • Init’d by you, or by tableview/collectionview

    • Setup took args that gave strings, flourishes • For complex args, we’d use config objects (structs) • If you can pass in an arg set, it should support it • Optionals were API
 Eg: Optional subtitles (string?)
  23. @samjarman #DevWorld COMPONENT BOUNDARIES • A first attempt at this

    was something known as a “Flexi-Cell” • A super configurable cell • Hard to edit • Easy to use • Trivial to make something ugly
  24. @samjarman #DevWorld BEST PRACTICES Use Optionals Produce a Cell version

    Don’t move to SG if just for your app Ask for help Variation or new component Push back on design if new Test it yourself Collab with designers Straight to master Ask around to avoid duplication If the API won’t let you, don’t
  25. @samjarman #DevWorld Think of the advice and 
 mindset you

    had and 
 document it for others. LESSON 4
  26. @samjarman #DevWorld ARBITRARY • No one right way • Went

    with what makes sense • Debate and commit
  27. @samjarman #DevWorld SOLVING 
 ARGUMENTS • Arguments are common •

    Often leave people feeling disengaged, angry or resentful • It’s simpler than you think?
  28. @samjarman #DevWorld THE 
 PROBLEMS • Committee got gatecrashed •

    Other team members weren’t 
 told of impact • Low Buy-in • New hires • Poor knowledge of modules
  29. @samjarman #DevWorld HOW THE 
 SAUSAGE 
 IS MADE •

    A team member once gate crashed a meeting • “I just want to see how the sausage is made.” • What was our impression? 
 Fun? Cowboys? Malicious?
  30. @samjarman #DevWorld SOLVING IT • More outwards communication • Weekly

    updates • More documentation • A bit more training/walkthroughs • Pairing on tasks
  31. @samjarman #DevWorld • Opened up committee meetings • We had

    to explain everything • Debates re-visited • Work undone • Progress halted NOT
 SOLVING IT
  32. @samjarman #DevWorld Not all code we're working on is for

    our team’s feature. MINDSET 
 SHIFT
  33. @samjarman #DevWorld We got momentum as a team of 


    teams when we looked to make 
 common components as 
 we built individual features. LESSON 7
  34. @samjarman #DevWorld BUSINESS 
 ANALYSTS • BAs at ACME are

    scrum masters • Wanted to know how to size stories • Dependants/Dependencies • Solved quite easily with conversation
  35. @samjarman #DevWorld PRODUCT 
 OWNERS • Ultimately own the teams

    time at ACME • Goal is products out the door • Had to be convinced that internal tooling would pay off in the long run • Solved by pointing out this is standard practice already at ACME • Saw benefits of the process for ACME as a whole
  36. @samjarman #DevWorld PROBLEMS:
 TESTERS • Not developers at ACME •

    Wanted to know what to test • How to test it • Where to test it
  37. @samjarman #DevWorld • StyleGuide Test App • Test it in

    that • All scenarios displayed • Test it in both apps* SOLUTIONS:
 TESTERS
  38. @samjarman #DevWorld Our phase one was just a 
 smaller

    shared library. We didn’t 
 have a true dependency yet.
  39. @samjarman #DevWorld MODULARISATION 
 PROJECT • Our work was noticed!

    Positively! • Leadership decided we should push forward with TSA and modularise properly • It was time for a…
  40. @samjarman #DevWorld If you want to fight with an iOS

    Developer, just say your favourite dependency manger on ‘three’
  41. @samjarman #DevWorld DEPENDENCY 
 MANAGER • CocoaPods? • Carthage? •

    Git sub-modules/subtrees? • Swift Package Manager?
  42. @samjarman #DevWorld • Went with Carthage • Corporate Networks •

    Ease of Use • Ease of Changing Mind Later DEPENDENCY 
 MANAGER
  43. @samjarman #DevWorld X.Y.Z • X = Major Version. • Breaking

    Changes. Non-compatible. • Y = Minor versions. • Additions and deprecations. • Z = Patch versions • Under the hood changes. Bug fixes. SEMANTIC
 VERSIONING
  44. @samjarman #DevWorld Semantic versioning is about much 
 more than

    a fancy number system.
 
 It’s about making a promise to 
 your consumers.
  45. @samjarman #DevWorld 1.2.1 → 1.3.0
 I promise you’ll see new

    stuff in this 
 version, but it won’t break old stuff.
  46. @samjarman #DevWorld PROCESS
 CHANGES • This was a big mindset

    change for a lot of the developers • Upfront thinking about versioning threw some people • Testing fit into this…how?
  47. @samjarman #DevWorld • More testing by developers before handing it

    off • Testers not equipped to test if SemVer was correct • SemVer being correct was important PROCESS
 CHANGES
  48. @samjarman #DevWorld • “I don’t see how I wouldn’t have

    to 
 test both apps?” • “How can I prove my code is correct before integrating it?” • “Who updates it if we get too 
 far behind?” • “Wait, why do I not have to test 
 both apps?” PROCESS
 CHANGES
  49. @samjarman #DevWorld • Old code / mindset / processes /

    training was Push. • You made a change to something common, it was forced into the other app at compile time. • Therefore, while making the change, you have to test that push scenario. PUSH VS PULL
  50. @samjarman #DevWorld • New process was pull • You would

    pull in a new update and that would come with a promise of visual and code compatibility • You, then and there, would have to resolve those changes PUSH VS PULL
  51. @samjarman #DevWorld What may be an obvious 
 way of

    working to you might be dramatically new to others. LESSON 12
  52. @samjarman #DevWorld "What if you couldn't get out of 


    your chair and ask questions 
 or give advice?”
  53. @samjarman #DevWorld COMMS • Great README • Great SemVer discipline

    • Great change log • Great/Clear API • Great documentation • samjarman.co.nz/dxguide
  54. @samjarman #DevWorld Happily 
 Ever 
 After! • SemVer clicking

    with most • We made multiple new versions per week (decreasing) • We introduced another couple 
 of dependencies • On our way TSA
  55. @samjarman #DevWorld He aha te mea nui o te ao?

    He tāngata, he tāngata, he tāngata. What is the most important thing in 
 the world? It is people, it is people, 
 it is people.
  56. THE CODE WAS 
 THE EASY PART Introducing an iOS

    Library at a Corporate @samjarman #DevWorld