ios团队开发实践经验

39
iOS团队开发实践经验 shengxuanwei 2015-06-29

Upload: jiyee-sheng

Post on 09-Aug-2015

129 views

Category:

Software


4 download

TRANSCRIPT

Page 1: iOS团队开发实践经验

iOS团队开发实践经验shengxuanwei

2015-06-29

Page 2: iOS团队开发实践经验

流程 Process

Page 3: iOS团队开发实践经验

Workflow

Page 4: iOS团队开发实践经验

Begin With Milestone

• ⺫⽬目标

• 功能

• 责任

• 依赖

• ⻛风险

• MRD

Page 5: iOS团队开发实践经验

One Feature, One Branch

5

Page 6: iOS团队开发实践经验

开发就像打怪,怪物就是issues

Page 7: iOS团队开发实践经验

重构永⽆无⽌止境

Page 8: iOS团队开发实践经验

以Code Reviewer姿态对待你的代码

Page 9: iOS团队开发实践经验

How to make reviewers life harder

• large commits

• reformatting of code

• lots of refactoring

• omit issue number when committing

http://kaczanowscy.pl/tomek/sites/default/files/2012_code_reviews.png

Page 10: iOS团队开发实践经验

iOS Testinghttp://neglectedpotential.com/wp-content/uploads/iOS-Testing-Mind-Map-1.2.png

Page 11: iOS团队开发实践经验

规范 Specification

Page 12: iOS团队开发实践经验

Specification

• 开发规范

• 设计⽂文档

• 接⼝口指南

Page 13: iOS团队开发实践经验

Developer’s Guide

• Objective-C Style Guide

• Git Flow Spec

• Git Commit Spec

• Logging Spec

• ……

Page 14: iOS团队开发实践经验

Git Flow Workflowhttps://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow

Page 15: iOS团队开发实践经验

Telling Stories With Your Git History

• ⼀一个 commit 只做⼀一件事情,⽐比如⼀一个 feature,⼀一个bugfix

• 每个 commit 的粒度不要太⼤大,⼤大型 feature 分解成多个⼦子 feature 做多个 commit

• git push 之前在本地进⾏行 git rebase

• 每个 commit 需要撰写详尽的 commit message,相关 issue 需要注明 issue number。关闭对应 issue,需要注明 close #issue-number.

https://about.futurelearn.com/blog/telling-stories-with-your-git-history/

Page 16: iOS团队开发实践经验

– Martin Fowler

“Code as Documentation”

Page 17: iOS团队开发实践经验

架构 Architecture

Page 18: iOS团队开发实践经验

MVC

Page 19: iOS团队开发实践经验

MEGA-ViewControllerhttp://code.oursky.com/viper-ios-architecture-beyond-mega-viewcontroller/

事件、通知、⺴⽹网络请求、UI显⽰示、业务逻辑、⽤用户输⼊入、数据正确性验证、内存和⺴⽹网络条件检测,⾏行为统计,缓存,登录状态认证,⻚页⾯面切换...

Page 20: iOS团队开发实践经验

Light View Controllers• Move Domain Logic into the Model

• Move View Code into the View Layer

• Separate Out Data Source and Other Protocols

• Creating the Store Class

• Move Web Service Logic to the Model Layer

• Communicationhttp://www.objc.io/issues/1-view-controllers/lighter-view-controllers/

Page 21: iOS团队开发实践经验

A little-monster-collection http://code.oursky.com/viper-ios-architecture-beyond-mega-viewcontroller/

Page 22: iOS团队开发实践经验

VIPERSingle Responsibility Principle

Page 23: iOS团队开发实践经验

VIPER• View (UserInterface)

• Presenter

• Interactor

• Entity

• Routing (Wireframe)

Page 24: iOS团队开发实践经验

VIPER Checklist• Views and view controllers receive user interactions and pass

them to Presenters for decision making

• Presenters contain the view logics and prepare content for display and reacting to user inputs

• Presenters should not know about the existence of all UIViews

• Interactors contain business logics and they should be independent of UI

• Entities are model objects only manipulated by Interactors

• Wireframe is the only place to define screen navigations and their transition animations

Page 25: iOS团队开发实践经验

Benefits of VIPER• Easy to iterate on

• Collaboration friendly

• Separated out concerns

• Spec-ability

• Vipergen

Page 26: iOS团队开发实践经验

Other Frameworks

• AOP (Aspects)

• DeepLink (DeepLinkKit)

• AutoLayout (Masonry)

• Logging (CocoaLumberjack)

Page 27: iOS团队开发实践经验

⼯工具 Tool

Page 28: iOS团队开发实践经验

抛弃SVN,拥抱Git• Branching and Merging

• Small and Fast

• Distributed

• Data Assurance

• The Staging Area

Page 29: iOS团队开发实践经验

GitLab• Activity Stream

• Issue Tracking

• Git Powered Wiki

• Code Review

• Git Hooks

• Services

Page 30: iOS团队开发实践经验

Choosing the Right IDE• Performance

• Editor (syntax highlight, autocomplete)

• Extensions

• Refactoring

• Vi mode

Page 31: iOS团队开发实践经验

Linter

• uncrustify

• OCLint

• FBInfer

Page 32: iOS团队开发实践经验

CocoaPods

• Dependency Manager

• Podfile

• Podspec

• Submodule

Page 33: iOS团队开发实践经验

Other Tools• Dash

• Reveal

• Charles

• Paw

• SmartGit

• Beyond Compare

Page 34: iOS团队开发实践经验

规划 Planning

Page 35: iOS团队开发实践经验

One Month

• VIPERing

• Deep Link

• Code Quality

Page 36: iOS团队开发实践经验

Three Month• Performance (UI, Network)

• Crash

• Unit Test

• iOS 9

• iPad Universal

Page 37: iOS团队开发实践经验

Six Month

• Modularization

• CI

• UI Automation

• Swift

Page 38: iOS团队开发实践经验

The End.

Page 39: iOS团队开发实践经验

References• http://twasink.net/2004/05/17/refactoring-vs-re-architecting-vs-redesign-vs-

rewriting/

• http://mp.weixin.qq.com/s?__biz=MjM5NTIyNTUyMQ%3D%3D&idx=1&mid=208090692&sn=ebcac43c3af9d07a9916bcfeca3bbf2a

• https://netguru.co/blog/a-quick-guide-to-peer-code-review

• https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow

• https://about.futurelearn.com/blog/telling-stories-with-your-git-history/

• http://code.oursky.com/viper-ios-architecture-beyond-mega-viewcontroller/

• https://www.youtube.com/watch?v=4XpnKHJAok8

• http://product.hubspot.com/blog/architecting-a-large-ios-app-with-cocoapods