21
@Mostgood Inheriting code Sally Shepard

Inheriting iOS code

Embed Size (px)

Citation preview

@Mostgood

Inheriting codeSally Shepard

Who am I? @mostgood

✤ Started writing iPhone apps in 2008 !

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

✤ Best of 2013 - Newsstand

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

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

“Why do I need to open Xcode?”

✤ Some rampant bugs need squashing!

✤ The app looks dated!

✤ Add new features!

✤ Legal issues!

✤ API deprecation

I’ve opened Xcode...

wowsuch error

much warnings

so deprecated

Stalk your prey

✤ Go through documentation!

✤ Look through commit history!

✤ Issue tracking!

✤ Crash reports!

✤ Become obsessive

As you go

✤ add comments!

✤ add pragmas!

✤ document how it works!

✤ keep track of known issues!

✤ add tests

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

Not so quick fixes

✤ Standardise: Replacing XYMagicGridView with UICollectionView!

✤ Modernise: NSURLConnection -> NSURLSession!

✤ Updating persistent storage type: Plist -> CoreData!

✤ Complicated refactoring

It’s too broken: rewrite all the things

✤ Declare bankruptcy on technical debt!

✤ Shoehorning!

✤ Latest and greatest

This isn’t working: rewrite all the things

✤ booBoo.surfaceArea > plaster.surfaceArea!

✤ Making it worse!

✤ Ghosts in the code

“Why is it like this?”

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

✤ Possibly!

✤ But there is usually a reason why

Culprits...

✤ On the cheap!

✤ Newly native!

✤ Inexperienced team

...Culprits

✤ Cray cray deadlines!

✤ Too many cooks!

✤ Bad clients

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

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

“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

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)

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

Thanks!

@mostgood