ios团队开发实践经验

Post on 09-Aug-2015

129 Views

Category:

Software

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

iOS团队开发实践经验shengxuanwei

2015-06-29

流程 Process

Workflow

Begin With Milestone

• ⺫⽬目标

• 功能

• 责任

• 依赖

• ⻛风险

• MRD

One Feature, One Branch

5

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

重构永⽆无⽌止境

以Code Reviewer姿态对待你的代码

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

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

规范 Specification

Specification

• 开发规范

• 设计⽂文档

• 接⼝口指南

Developer’s Guide

• Objective-C Style Guide

• Git Flow Spec

• Git Commit Spec

• Logging Spec

• ……

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

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/

– Martin Fowler

“Code as Documentation”

架构 Architecture

MVC

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

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

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/

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

VIPERSingle Responsibility Principle

VIPER• View (UserInterface)

• Presenter

• Interactor

• Entity

• Routing (Wireframe)

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

Benefits of VIPER• Easy to iterate on

• Collaboration friendly

• Separated out concerns

• Spec-ability

• Vipergen

Other Frameworks

• AOP (Aspects)

• DeepLink (DeepLinkKit)

• AutoLayout (Masonry)

• Logging (CocoaLumberjack)

⼯工具 Tool

抛弃SVN,拥抱Git• Branching and Merging

• Small and Fast

• Distributed

• Data Assurance

• The Staging Area

GitLab• Activity Stream

• Issue Tracking

• Git Powered Wiki

• Code Review

• Git Hooks

• Services

Choosing the Right IDE• Performance

• Editor (syntax highlight, autocomplete)

• Extensions

• Refactoring

• Vi mode

Linter

• uncrustify

• OCLint

• FBInfer

CocoaPods

• Dependency Manager

• Podfile

• Podspec

• Submodule

Other Tools• Dash

• Reveal

• Charles

• Paw

• SmartGit

• Beyond Compare

规划 Planning

One Month

• VIPERing

• Deep Link

• Code Quality

Three Month• Performance (UI, Network)

• Crash

• Unit Test

• iOS 9

• iPad Universal

Six Month

• Modularization

• CI

• UI Automation

• Swift

The End.

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

top related