Top Banner
@Mostgood Inheriting code Sally Shepard
21

Inheriting iOS code

Aug 07, 2015

Download

Software

Sally Shepard
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Inheriting iOS code

@Mostgood

Inheriting codeSally Shepard

Page 2: Inheriting iOS code

Who am I? @mostgood

✤ Started writing iPhone apps in 2008 !

✤ Head of App Development at Dennis Publishing (we’re hiring!)!

✤ Best of 2013 - Newsstand

Page 3: Inheriting iOS code

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

Page 4: Inheriting iOS code

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

Page 5: Inheriting iOS code

“Why do I need to open Xcode?”

✤ Some rampant bugs need squashing!

✤ The app looks dated!

✤ Add new features!

✤ Legal issues!

✤ API deprecation

Page 6: Inheriting iOS code

I’ve opened Xcode...

wowsuch error

much warnings

so deprecated

Page 7: Inheriting iOS code

Stalk your prey

✤ Go through documentation!

✤ Look through commit history!

✤ Issue tracking!

✤ Crash reports!

✤ Become obsessive

Page 8: Inheriting iOS code

As you go

✤ add comments!

✤ add pragmas!

✤ document how it works!

✤ keep track of known issues!

✤ add tests

Page 9: Inheriting iOS code

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

Page 10: Inheriting iOS code

Not so quick fixes

✤ Standardise: Replacing XYMagicGridView with UICollectionView!

✤ Modernise: NSURLConnection -> NSURLSession!

✤ Updating persistent storage type: Plist -> CoreData!

✤ Complicated refactoring

Page 11: Inheriting iOS code

It’s too broken: rewrite all the things

✤ Declare bankruptcy on technical debt!

✤ Shoehorning!

✤ Latest and greatest

Page 12: Inheriting iOS code

This isn’t working: rewrite all the things

✤ booBoo.surfaceArea > plaster.surfaceArea!

✤ Making it worse!

✤ Ghosts in the code

Page 13: Inheriting iOS code

“Why is it like this?”

✤ Did people really not care about quality and maintainability?!

✤ Possibly!

✤ But there is usually a reason why

Page 14: Inheriting iOS code

Culprits...

✤ On the cheap!

✤ Newly native!

✤ Inexperienced team

Page 15: Inheriting iOS code

...Culprits

✤ Cray cray deadlines!

✤ Too many cooks!

✤ Bad clients

Page 16: Inheriting iOS code

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

Page 17: Inheriting iOS code

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

Page 18: Inheriting iOS code

“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

Page 19: Inheriting iOS code

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)

Page 20: Inheriting iOS code

Insurance Premiums

mild WTF Good Better Ultra-über-awesome

Comments x x x xDocumentation x x xIssue tracking x x

Refactor x xCoding standard x x

Readability xTests x

Price: < hour few hours a day few days

Page 21: Inheriting iOS code

Thanks!

@mostgood