SlideShare a Scribd company logo
1 of 45
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved.
C2M – Best
Practices
iOS
Presented by:
Suyash Gupta
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 2
Agenda
 Design principles in Swift
 Recommended libraries
 Testing
 Continuous Integration
 Localization
 Best practises
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 3
Design principles in
Swift
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 4
Design principles (SOLIDS)
• Single Responsibility Principle
• Open/Closed Principle
• Liskov Substitution Principle : Any child type of a parent
type should be able to stand in for that parent without
things blowing up.
• Interface Segregation Principle: you don't want to force
clients to depend on things they don't actually need.
• Dependency Inversion: entities should depends upon
abstractions rather than upon concrete details.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 5
Single Responsibility Principle
class Handler { // BAD EXAMPLE
func handle() {
let data = requestDataToAPI()
let array = parse(data: data)
saveToDB(array: array)
}
private func requestDataToAPI() -> Data {
// send API request and wait the response
}
private func parse(data: Data) -> [String] {
// parse the data and create the array
}
private func saveToDB(array: [String]) {
// save the array in a database (CoreData/Realm/...)
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 6
Liskov Substitution Principle
protocol Bird {
var altitudeToFly: Double? {get}
func setLocation(longitude: Double , latitude: Double)
mutating func setAltitude(altitude: Double) //WRONG IMPLEMENTATION
}
class Penguin: Bird {
@override func setAltitude(altitude: Double) {
//Altitude can't be set because penguins can't fly
//throw exception
}
} //If an override method does nothing or just throws an exception, then
you’re probably violating the LSP.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 7
Liskov Substitution Principle
protocol Bird {
var altitudeToFly: Double? {get}
func setLocation(longitude: Double , latitude: Double)
}
protocol Flying {
mutating func setAltitude(altitude: Double)
}
protocol FlyingBird: Bird, Flying {
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 8
Liskov Substitution Principle
struct Owl: FlyingBird {
var altitudeToFly: Double?
mutating func setAltitude(altitude: Double) {
altitudeToFly = altitude
}
func setLocation(longitude: Double, latitude: Double) {
//Set location value
}
}
struct Penguin: Bird {
var altitudeToFly: Double?
func setLocation(longitude: Double, latitude: Double) {
//Set location value
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 9
Dependency Inversion Principle
struct Developer {
func work() {
// ....working
}
}
struct Manager {
let worker: Developer;
init (w: Developer) { //BAD EXAMPLE
worker = w;
}
func manage() {
worker.work();
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 10
Dependency Inversion Principle
//NEW TYPE
struct Tester {
func work() {
//.... working
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 11
Dependency Inversion Principle
protocol IEmployee {
func work()
}
struct Developer: IEmployee {
func work() {
print("Developer working...") // Developer working...
}
}
struct Tester: IEmployee {
func work() {
print("Tester working...") // Tester working...
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 12
Dependency Inversion Principle
struct Management {
let employee: IEmployee;
init (e: IEmployee) {
employee = e;
}
func manage() {
employee.work();
}
}
//Let’s give it a try,
let employee = Developer()
let management = Management(e:employee)
management.manage() // Output - Developer working...
let employer2 = Tester()
let management2 = Management(e:employer2)
management2.manage() // Output - Tester working...
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 13
Design principles in Swift
• Whilst analysing the wireframes, look for View
Controllers that have a common theme.
• Spot repeating elements – and make them as a
reusable widget to the project structure.
• Think long term. This is a project you may have to
deal with in 12 months time. Do yourself a favour
and make the right decisions now.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 14
Facade pattern
• Keeps the API’s normalised
• Hides complexity behind a simple method
• Makes it easier to refactor code
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 15
Facade pattern Demo
class Engine {
func produceEngine() {
print("prodce engine")
}
}
class Body {
func produceBody() {
print("prodce body")
}
}
class Accessories {
func produceAccessories() {
print("prodce accessories")
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 16
Facade pattern Demo
class FactoryFacade {
let engine = Engine()
let body = Body()
let accessories = Accessories()
func produceCar() {
engine.produceEngine()
body.produceBody()
accessories.produceAccessories()
}
}
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 17
Singleton - Good and Bad
• Ask yourself these questions:
• “Does the object need to be referenced by multiple
other objects at the same time e.g. needs to be ‘Thread
safe’ ?“
• “Does the current ‘state’ need to be always up to date
when referenced ?”
• “Is there a risk that if a duplicate object is created, the
calling object might be pointing at the wrong object?”
• If yes to all of these - USE A SINGLETON!
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 18
Design Patterns
• More Patterns:
https://github.com/ochococo/Design-Patterns-In-
Swift
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 19
Delegate vs Notifications
• Use a delegate pattern if it is only a single object
that cares about the event.
• Use NSNotifications when you need more then one
object to know about the event.
• Remember to use NSNotifications add and remove
callbacks in standard way.
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 20
Recommended Libraries
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 21
Recommended Libraries
# UI Customization
pod 'PureLayout'
pod 'SnapKit'
pod ‘UIColor_Hex_Swift’ // let fillColor = UIColor("#FFCC00DD").CGColor
# Camera / Photo
pod 'TOCropViewController'
pod 'Fusuma’ // Instagram-like photo browser with camera
# Bug Tracking
pod 'Fabric'
pod 'Crashlytics'
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 22
Recommended Libraries
# Analytics
pod 'GoogleAnalytics'
pod 'Appsee'
pod 'FBSDKCoreKit'
pod 'Mixpanel-swift’
# Address Book Data
pod 'APAddressBook/Swift '
pod ' PhoneNumberKit’ // parsing, formatting and validating international phone
numbers
# Network & JSON
pod 'Alamofire’ / pod ‘AFNetworking’
pod ‘SDWebImage'
pod 'SwiftyJSON'
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 23
Recommended Libraries
# AB Testing
pod 'Firebase/Core'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Performance'
pod 'GoogleTagManager’
# Debug
pod 'Dotzu’
# Data Storage
pod ‘RealmSwift'
pod ‘KeychainAccess’
#Quality
Pod ‘SwiftLint’
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 24
Recommended Libraries
# Permission
Pod ‘Permission/Camera’ // unified API to request permissions
# Common
pod ‘DateTools’
# Billing
pod ‘SwiftyStoreKit’ // In App Purchases framework
# Communication With Customers
pod 'Intercom'
# Rate App
pod 'Armchair’
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 25
Testing
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 26
Testing
• You should have one XCTestCase file for every
component you test.
• The key to writing good unit tests is understanding
that you need to break your app into smaller pieces
that you can test.
• Do include inverse behaviors, a.k.a. negative test
cases
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 27
Testing
• A well-architected set of unit tests should function
as documentation.
• Also make use of code-coverage to evaluate the
part of code left to test.
• Integrate it with CI/CD.
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 28
Continuous Integration
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 29
CI and CD
• Continuous Integration (CI) is a development practice
that requires developers to integrate code into a shared
repository several times a day. Each check-in is then
verified by an automated build, allowing teams to
detect problems early.
• Continuous Delivery (CD) is a software engineering
approach in which teams produce software in short
cycles, ensuring that the software can be reliably
released at any time. It aims at building, testing, and
releasing software faster and more frequently.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 30
Continuous Integration
• There are a lot of tools available that can help you with
continuous integration of iOS apps like Xcode Server,
Jenkins and Travis CI.
• Why use Continuous Delivery?
– Save days of preparing app submission, uploading
screenshots and releasing the app
– Colleague on vacation and a critical bugfix needs to be
released? Don’t rely on one person releasing updates
– Increase software quality and reaction time with more
frequent and smaller releases
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 31
Localization
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 32
Localization
• iOS Localization is the process of rendering the
content of your app into multiple languages.
• Users in other countries want to use your app in a
language they understand.
• Using iTunes Connect, you can indicate whether your
app is available in all territories or specific territories.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 33
Localization
DEMO
https://github.com/suyashgupta25/xib-localization
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 34
Best Practices
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 35
Best Practices - Xcode
• Xcode is the IDE of choice for most iOS developers,
and the only one officially supported by Apple.
There are some alternatives, of which AppCode is
arguably the most famous, but unless you're
already a seasoned iOS person, go with Xcode.
Despite its shortcomings, it's actually quite usable
nowadays!
• To install, simply download Xcode on the Mac App
Store.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 36
Best Practices - Xcode
• CoreData: Contains DataModel and Entity Classes.
• Extension: extensions+project class extensions
• Helper: Contain Third Party classes/Frameworks + Bridging
classes (eg. Obj C class in Swift based project)
• Model: The Web Service Response parsing and storing data
is also done here.
• Services: Contain Web Service processes (eg. Login
Verification, HTTP Request/Response)
• View: Contain storyboard, LaunchScreen.xib and View
Classes. Make a sub folder Cells - contain UITableViewCell,
UICollectionViewCell etc.
• Controller: Contain ViewControllers
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 37
Best Practices - Xcode
CocoaPods : it's a standard package manager for iOS
projects.
# It'll eat up 1,5gigs of space (the master repository under
~/.cocoapods), it creates unnecessary things too.
# It's the worst option, but it's the most popular one
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 38
Best Practices - AGILE
• Create ‘user stories’ from the specification
• Be Data driven - Gut feeling will only get you so
far!!!!!
• Be user driven - What do your users want ?
• Be Involved - Don’t be shy, have an opinion, use
your knowledge to advance the idea. Spot flaws
NOW, not 1 month down the line. You will save
yourself time, money and a lot of headaches.
• Iterate - Check, Do, Check, Change
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 39
Best Practices
• D.R.Y - Dont Repeat Yourself
– Don’t write lengthy methods, divide logic into
smaller reusable pieces.
– It will become a natural part of your refactoring
– Don’t do magic to achieve D.R.Y
• Unit Testing
– Try and add unit tests from the beginning of a
project. Retrofitting unit tests can be painful .
– Great UITesting tools in Xcode.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 40
Best Practices
Comments + Verbose method names
• COMMENT YOUR CODE - NO EXCUSES.
• Saves 1000’s of man hours.
• Is just common courtesy.
• Name of method should explain what it does
• Add a comment in the .h advising what the
class does.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 41
Best Practices
• Prototype
– Great to show stakeholders (Storyboards designed
for it)
– Can trust implementation without the ‘noise’ of
existing code
– Can help spot issues earlier.
• Do pair programming - Make it 20% of your weekly
schedule
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 42
Best Practices
• Keep your project organized Git - Commit little and
often
– Don’t be an ‘end of the day’ committer
– Get into the habit even when working solo
– Commit should reflect what was actually done.
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 43
HAPPY CODING!!
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 44
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 45
Demo Repository
https://github.com/suyashgupta25/xib-localization

More Related Content

Similar to Best practices iOS meetup - pmd

Serverless survival kit
Serverless survival kitServerless survival kit
Serverless survival kitSteve Houël
 
How to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native ApplicationsHow to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native ApplicationsSufyaan Kazi
 
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...Gene Kim
 
Build the API you want to see in the world
Build the API you want to see in the worldBuild the API you want to see in the world
Build the API you want to see in the worldMichelle Garrett
 
Talentica - JS Meetup - Angular Schematics
Talentica - JS Meetup - Angular SchematicsTalentica - JS Meetup - Angular Schematics
Talentica - JS Meetup - Angular SchematicsKrishnan Mudaliar
 
Functional programming, TypeScript and RXJS
Functional programming, TypeScript and RXJSFunctional programming, TypeScript and RXJS
Functional programming, TypeScript and RXJSVivek Tikar
 
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...DevOpsDays Tel Aviv
 
Security Testing with Zap
Security Testing with ZapSecurity Testing with Zap
Security Testing with ZapSoluto
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open StandardsAPIsecure_ Official
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Chetan Khatri
 
JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces CounterCoritel
 
Петро Коренєв, "Presentation state containers"
Петро Коренєв, "Presentation state containers"Петро Коренєв, "Presentation state containers"
Петро Коренєв, "Presentation state containers"Sigma Software
 
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...CODE BLUE
 
Innovating Faster with Continuous Application Security
Innovating Faster with Continuous Application Security Innovating Faster with Continuous Application Security
Innovating Faster with Continuous Application Security Jeff Williams
 

Similar to Best practices iOS meetup - pmd (20)

Advanced angular
Advanced angularAdvanced angular
Advanced angular
 
Serverless survival kit
Serverless survival kitServerless survival kit
Serverless survival kit
 
How to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native ApplicationsHow to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native Applications
 
API-First Design and Django
API-First Design and DjangoAPI-First Design and Django
API-First Design and Django
 
Useful C++ Features You Should be Using
Useful C++ Features You Should be UsingUseful C++ Features You Should be Using
Useful C++ Features You Should be Using
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
Exploring My Career: an Exclusive Interview EN
Exploring My Career: an Exclusive Interview ENExploring My Career: an Exclusive Interview EN
Exploring My Career: an Exclusive Interview EN
 
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...
DOES16 San Francisco - Marc Ng - SAP’s DevOps Journey: From Building an App t...
 
Build the API you want to see in the world
Build the API you want to see in the worldBuild the API you want to see in the world
Build the API you want to see in the world
 
Talentica - JS Meetup - Angular Schematics
Talentica - JS Meetup - Angular SchematicsTalentica - JS Meetup - Angular Schematics
Talentica - JS Meetup - Angular Schematics
 
Functional programming, TypeScript and RXJS
Functional programming, TypeScript and RXJSFunctional programming, TypeScript and RXJS
Functional programming, TypeScript and RXJS
 
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...
All you need is Zap - Omer Levi Hevroni & Yshay Yaacobi - DevOpsDays Tel Aviv...
 
Security Testing with Zap
Security Testing with ZapSecurity Testing with Zap
Security Testing with Zap
 
Final ppt
Final pptFinal ppt
Final ppt
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
 
JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces Counter
 
Петро Коренєв, "Presentation state containers"
Петро Коренєв, "Presentation state containers"Петро Коренєв, "Presentation state containers"
Петро Коренєв, "Presentation state containers"
 
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...
CODE BLUE 2014 : Persisted: The active use and exploitation of Microsoft's Ap...
 
Innovating Faster with Continuous Application Security
Innovating Faster with Continuous Application Security Innovating Faster with Continuous Application Security
Innovating Faster with Continuous Application Security
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

Best practices iOS meetup - pmd

  • 1. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. C2M – Best Practices iOS Presented by: Suyash Gupta
  • 2. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 2 Agenda  Design principles in Swift  Recommended libraries  Testing  Continuous Integration  Localization  Best practises
  • 3. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 3 Design principles in Swift
  • 4. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 4 Design principles (SOLIDS) • Single Responsibility Principle • Open/Closed Principle • Liskov Substitution Principle : Any child type of a parent type should be able to stand in for that parent without things blowing up. • Interface Segregation Principle: you don't want to force clients to depend on things they don't actually need. • Dependency Inversion: entities should depends upon abstractions rather than upon concrete details.
  • 5. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 5 Single Responsibility Principle class Handler { // BAD EXAMPLE func handle() { let data = requestDataToAPI() let array = parse(data: data) saveToDB(array: array) } private func requestDataToAPI() -> Data { // send API request and wait the response } private func parse(data: Data) -> [String] { // parse the data and create the array } private func saveToDB(array: [String]) { // save the array in a database (CoreData/Realm/...) } }
  • 6. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 6 Liskov Substitution Principle protocol Bird { var altitudeToFly: Double? {get} func setLocation(longitude: Double , latitude: Double) mutating func setAltitude(altitude: Double) //WRONG IMPLEMENTATION } class Penguin: Bird { @override func setAltitude(altitude: Double) { //Altitude can't be set because penguins can't fly //throw exception } } //If an override method does nothing or just throws an exception, then you’re probably violating the LSP.
  • 7. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 7 Liskov Substitution Principle protocol Bird { var altitudeToFly: Double? {get} func setLocation(longitude: Double , latitude: Double) } protocol Flying { mutating func setAltitude(altitude: Double) } protocol FlyingBird: Bird, Flying { }
  • 8. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 8 Liskov Substitution Principle struct Owl: FlyingBird { var altitudeToFly: Double? mutating func setAltitude(altitude: Double) { altitudeToFly = altitude } func setLocation(longitude: Double, latitude: Double) { //Set location value } } struct Penguin: Bird { var altitudeToFly: Double? func setLocation(longitude: Double, latitude: Double) { //Set location value } }
  • 9. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 9 Dependency Inversion Principle struct Developer { func work() { // ....working } } struct Manager { let worker: Developer; init (w: Developer) { //BAD EXAMPLE worker = w; } func manage() { worker.work(); } }
  • 10. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 10 Dependency Inversion Principle //NEW TYPE struct Tester { func work() { //.... working } }
  • 11. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 11 Dependency Inversion Principle protocol IEmployee { func work() } struct Developer: IEmployee { func work() { print("Developer working...") // Developer working... } } struct Tester: IEmployee { func work() { print("Tester working...") // Tester working... } }
  • 12. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 12 Dependency Inversion Principle struct Management { let employee: IEmployee; init (e: IEmployee) { employee = e; } func manage() { employee.work(); } } //Let’s give it a try, let employee = Developer() let management = Management(e:employee) management.manage() // Output - Developer working... let employer2 = Tester() let management2 = Management(e:employer2) management2.manage() // Output - Tester working...
  • 13. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 13 Design principles in Swift • Whilst analysing the wireframes, look for View Controllers that have a common theme. • Spot repeating elements – and make them as a reusable widget to the project structure. • Think long term. This is a project you may have to deal with in 12 months time. Do yourself a favour and make the right decisions now.
  • 14. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 14 Facade pattern • Keeps the API’s normalised • Hides complexity behind a simple method • Makes it easier to refactor code
  • 15. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 15 Facade pattern Demo class Engine { func produceEngine() { print("prodce engine") } } class Body { func produceBody() { print("prodce body") } } class Accessories { func produceAccessories() { print("prodce accessories") } }
  • 16. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 16 Facade pattern Demo class FactoryFacade { let engine = Engine() let body = Body() let accessories = Accessories() func produceCar() { engine.produceEngine() body.produceBody() accessories.produceAccessories() } }
  • 17. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 17 Singleton - Good and Bad • Ask yourself these questions: • “Does the object need to be referenced by multiple other objects at the same time e.g. needs to be ‘Thread safe’ ?“ • “Does the current ‘state’ need to be always up to date when referenced ?” • “Is there a risk that if a duplicate object is created, the calling object might be pointing at the wrong object?” • If yes to all of these - USE A SINGLETON!
  • 18. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 18 Design Patterns • More Patterns: https://github.com/ochococo/Design-Patterns-In- Swift
  • 19. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 19 Delegate vs Notifications • Use a delegate pattern if it is only a single object that cares about the event. • Use NSNotifications when you need more then one object to know about the event. • Remember to use NSNotifications add and remove callbacks in standard way.
  • 20. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 20 Recommended Libraries
  • 21. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 21 Recommended Libraries # UI Customization pod 'PureLayout' pod 'SnapKit' pod ‘UIColor_Hex_Swift’ // let fillColor = UIColor("#FFCC00DD").CGColor # Camera / Photo pod 'TOCropViewController' pod 'Fusuma’ // Instagram-like photo browser with camera # Bug Tracking pod 'Fabric' pod 'Crashlytics'
  • 22. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 22 Recommended Libraries # Analytics pod 'GoogleAnalytics' pod 'Appsee' pod 'FBSDKCoreKit' pod 'Mixpanel-swift’ # Address Book Data pod 'APAddressBook/Swift ' pod ' PhoneNumberKit’ // parsing, formatting and validating international phone numbers # Network & JSON pod 'Alamofire’ / pod ‘AFNetworking’ pod ‘SDWebImage' pod 'SwiftyJSON'
  • 23. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 23 Recommended Libraries # AB Testing pod 'Firebase/Core' pod 'Firebase/DynamicLinks' pod 'Firebase/Performance' pod 'GoogleTagManager’ # Debug pod 'Dotzu’ # Data Storage pod ‘RealmSwift' pod ‘KeychainAccess’ #Quality Pod ‘SwiftLint’
  • 24. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 24 Recommended Libraries # Permission Pod ‘Permission/Camera’ // unified API to request permissions # Common pod ‘DateTools’ # Billing pod ‘SwiftyStoreKit’ // In App Purchases framework # Communication With Customers pod 'Intercom' # Rate App pod 'Armchair’
  • 25. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 25 Testing
  • 26. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 26 Testing • You should have one XCTestCase file for every component you test. • The key to writing good unit tests is understanding that you need to break your app into smaller pieces that you can test. • Do include inverse behaviors, a.k.a. negative test cases
  • 27. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 27 Testing • A well-architected set of unit tests should function as documentation. • Also make use of code-coverage to evaluate the part of code left to test. • Integrate it with CI/CD.
  • 28. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 28 Continuous Integration
  • 29. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 29 CI and CD • Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early. • Continuous Delivery (CD) is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time. It aims at building, testing, and releasing software faster and more frequently.
  • 30. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 30 Continuous Integration • There are a lot of tools available that can help you with continuous integration of iOS apps like Xcode Server, Jenkins and Travis CI. • Why use Continuous Delivery? – Save days of preparing app submission, uploading screenshots and releasing the app – Colleague on vacation and a critical bugfix needs to be released? Don’t rely on one person releasing updates – Increase software quality and reaction time with more frequent and smaller releases
  • 31. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 31 Localization
  • 32. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 32 Localization • iOS Localization is the process of rendering the content of your app into multiple languages. • Users in other countries want to use your app in a language they understand. • Using iTunes Connect, you can indicate whether your app is available in all territories or specific territories.
  • 33. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 33 Localization DEMO https://github.com/suyashgupta25/xib-localization
  • 34. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 34 Best Practices
  • 35. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 35 Best Practices - Xcode • Xcode is the IDE of choice for most iOS developers, and the only one officially supported by Apple. There are some alternatives, of which AppCode is arguably the most famous, but unless you're already a seasoned iOS person, go with Xcode. Despite its shortcomings, it's actually quite usable nowadays! • To install, simply download Xcode on the Mac App Store.
  • 36. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 36 Best Practices - Xcode • CoreData: Contains DataModel and Entity Classes. • Extension: extensions+project class extensions • Helper: Contain Third Party classes/Frameworks + Bridging classes (eg. Obj C class in Swift based project) • Model: The Web Service Response parsing and storing data is also done here. • Services: Contain Web Service processes (eg. Login Verification, HTTP Request/Response) • View: Contain storyboard, LaunchScreen.xib and View Classes. Make a sub folder Cells - contain UITableViewCell, UICollectionViewCell etc. • Controller: Contain ViewControllers
  • 37. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 37 Best Practices - Xcode CocoaPods : it's a standard package manager for iOS projects. # It'll eat up 1,5gigs of space (the master repository under ~/.cocoapods), it creates unnecessary things too. # It's the worst option, but it's the most popular one
  • 38. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 38 Best Practices - AGILE • Create ‘user stories’ from the specification • Be Data driven - Gut feeling will only get you so far!!!!! • Be user driven - What do your users want ? • Be Involved - Don’t be shy, have an opinion, use your knowledge to advance the idea. Spot flaws NOW, not 1 month down the line. You will save yourself time, money and a lot of headaches. • Iterate - Check, Do, Check, Change
  • 39. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 39 Best Practices • D.R.Y - Dont Repeat Yourself – Don’t write lengthy methods, divide logic into smaller reusable pieces. – It will become a natural part of your refactoring – Don’t do magic to achieve D.R.Y • Unit Testing – Try and add unit tests from the beginning of a project. Retrofitting unit tests can be painful . – Great UITesting tools in Xcode.
  • 40. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 40 Best Practices Comments + Verbose method names • COMMENT YOUR CODE - NO EXCUSES. • Saves 1000’s of man hours. • Is just common courtesy. • Name of method should explain what it does • Add a comment in the .h advising what the class does.
  • 41. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 41 Best Practices • Prototype – Great to show stakeholders (Storyboards designed for it) – Can trust implementation without the ‘noise’ of existing code – Can help spot issues earlier. • Do pair programming - Make it 20% of your weekly schedule
  • 42. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 42 Best Practices • Keep your project organized Git - Commit little and often – Don’t be an ‘end of the day’ committer – Get into the habit even when working solo – Commit should reflect what was actually done.
  • 43. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 43 HAPPY CODING!!
  • 44. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 44
  • 45. Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights reserved.Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 45 Demo Repository https://github.com/suyashgupta25/xib-localization

Editor's Notes

  1. Intro, welcome and other PMD things
  2. ISP: Clients should not be forced to implement interfaces they don’t use.