Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Inheriting iOS code


Published on

Inheriting Code:
Tips for inheriting iOS code

Presented at NSLondon January 2014 in the Pecha Kucha style


Published in: Software
  • Be the first to comment

  • Be the first to like this

Inheriting iOS code

  1. 1. @Mostgood Inheriting code Sally Shepard
  2. 2. Who am I? @mostgood ✤ Started writing iPhone apps in 2008 ! ✤ Head of App Development at Dennis Publishing (we’re hiring!)! ✤ Best of 2013 - Newsstand
  3. 3. Inheriting code ✤ Code that was written by someone else that you have to maintain! ✤ How many of us have inherited code?! ✤ Try it if you haven’t - it’s amazingly fun and educational, and only occasionally painful
  4. 4. Why inheriting code? ✤ Had a new iOS developer join last week! ✤ There has been a lot of ! “Why was this done?” ! “How does this actually work?”! and general anger at the people who wrote it...
  5. 5. “Why do I need to open Xcode?” ✤ Some rampant bugs need squashing! ✤ The app looks dated! ✤ Add new features! ✤ Legal issues! ✤ API deprecation
  6. 6. I’ve opened Xcode... wow such error much warnings so deprecated
  7. 7. Stalk your prey ✤ Go through documentation! ✤ Look through commit history! ✤ Issue tracking! ✤ Crash reports! ✤ Become obsessive
  8. 8. As you go ✤ add comments! ✤ add pragmas! ✤ document how it works! ✤ keep track of known issues! ✤ add tests
  9. 9. Quick fixes ✤ Update 3rd party libraries/frameworks! ✤ Basic refactoring! ✤ Drop support for older OS versions if possible! ✤ Run ‘Convert to Modern Objective-C Syntax’, etc
  10. 10. Not so quick fixes ✤ Standardise: Replacing XYMagicGridView with UICollectionView! ✤ Modernise: NSURLConnection -> NSURLSession! ✤ Updating persistent storage type: Plist -> CoreData! ✤ Complicated refactoring
  11. 11. It’s too broken: rewrite all the things ✤ Declare bankruptcy on technical debt! ✤ Shoehorning! ✤ Latest and greatest
  12. 12. This isn’t working: rewrite all the things ✤ booBoo.surfaceArea > plaster.surfaceArea! ✤ Making it worse! ✤ Ghosts in the code
  13. 13. “Why is it like this?” ✤ Did people really not care about quality and maintainability?! ✤ Possibly! ✤ But there is usually a reason why
  14. 14. Culprits... ✤ On the cheap! ✤ Newly native! ✤ Inexperienced team
  15. 15. ...Culprits ✤ Cray cray deadlines! ✤ Too many cooks! ✤ Bad clients
  16. 16. Don’t point fingers ✤ We all do stupid things! ✤ There are always circumstances! ✤ If you haven’t already, you’ll create something that will torture another developer someday
  17. 17. Open a dialogue ✤ If possible, get in touch with who worked on it before! ✤ Talk to people who are maintaining your code! ✤ Find people at conferences, meet-ups, twitter, etc...
  18. 18. “It’s good to talk” ✤ It shows you how far you’ve come! ✤ Grounds you! ✤ Learn something new! ✤ Teach someone something new! ✤ Shows respect! ✤ Strengthens community
  19. 19. What’s your legacy? ✤ When you write code, think of the next developer! ✤ Document and comment! ✤ Write meaningful commit messages! ✤ Coding standard! ✤ Readability! ✤ Write tests (if you’re into that sort of thing)
  20. 20. Insurance Premiums mild WTF Good Better Ultra-über- awesome Comments x x x x Documentation x x x Issue tracking x x Refactor x x Coding standard x x Readability x Tests x Price: < hour few hours a day few days
  21. 21. Thanks! @mostgood