SlideShare une entreprise Scribd logo
1  sur  12
How to improve
Code Quality?
iOS apps
RECOMMENDATIONS
Code Quality
Continuous
Inspection
Unit
Testing
2
Sonar covers the 7 axes of code quality
SONAR an open source web application
to manage code quality
Key metrics
 Potential bugs
 Potential performance problems
 Potential security issues
 Duplicates
 Unused Code
 Code Complexity
 Technical debt
 Сoverage
Community Plugin
5
FREE
No support
Might not support Xcode 8
https://github.com/Backelite/sonar-
objective-c
Official Plugin
6
€ 5,000 per year
Support included
Frequent new releases
http://www.sonarsource.com/products/plugi
ns/languages/objective-c/
Comparison
community plugin official plugin
price Free € 5,000 per year
support no included
metrics •Complexity: uses Lizard
•Documentation: blank comments, comment
lines, %
•Duplication: blocks, linkes, %
•Issues: Uses OCLint: 63 rules, and Faux Pas: 102
rules
•Size
•Test: Uses xctool, will probably switch to
xcodebuild + xcpretty soon
•Code coverage: With gcovr for project before
Xcode 7, otherwise slather
more details: https://github.com/octo-
technology/sonar-objective-
c/wiki/Features, https://github.com/Backelite/son
ar-objective-c
200+ rules: details
supported
systems
•Given that there is no official support, POC is
required to check it whether it works with XCode
8
•0.4.x releases for SonarQube >= 4.3 (4.x and 5.x)
•latest release was in 01/2015
•no information about XCode
supported
•all Sonar versions are
supported
Recommendations
Configure Objective C and Swift
community plugins
Set up daily scans
Configure daily emails
to the dev team
Analyze results
•Define areas for improvements:
•Security, unused code, code
duplicates, potential performance
issues
•Reduce code complexity
•Fix existing critical and major issues
Fix new issues
8
If community plugins don’t work - buy an official plugin
Metrics and KPIs to track
Track Issues provided by plugin:
◦ fix blockers and majors
◦ set an acceptable threshold for minor and info
Track the next metrics:
◦ technical debt (calculated by the tool)
◦ security issues
◦ unit test coverage
◦ duplicated code
◦ complexity:
◦ cyclomatic complexity number
◦ number of parameters
Unit Testing
Don’t test trivial code!
Scope of Unit Testing:
◦ View Models
◦ Generic Algorithms
◦ Managers with business logic
◦ Complicated View Controllers
Expected incremental coverage is ~60%
◦ Code coverage is not a primary goal for unit testing!
Tools:
◦ XCTest
◦ Sonar
◦ Jenkins – add unit tests to build lifecycle
10
Unit testing –
Process recommendations
Write unit tests
for the code to
be refactored
Write unit tests
during bug
fixing
Start unit
testing for the
new code
11
Exampleofaunittest
12
class LabelValuesTests: XCTestCase {
var vc: ViewController!
override func setUp() {
super.setUp()
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
vc = storyboard.instantiateInitialViewController() as! ViewController
}
func testLabelValuesShowedProperly() {
vc.updateLabels(Float(80.0), Float(50.0), Float(40.0))
// The labels should now display 80, 50 and 40
XCTAssert(vc.numberLabel.text == "80.0", "numberLabel doesn't show the right text")
XCTAssert(vc.percentageLabel.text == "50.0%", "percentageLabel doesn't show the right text")
XCTAssert(vc.resultLabel.text == "40.0", "resultLabel doesn't show the right text")
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the
class.
super.tearDown()
}
}

Contenu connexe

Tendances

Tendances (18)

Code review process with JetBrains UpSource
Code review process with JetBrains UpSourceCode review process with JetBrains UpSource
Code review process with JetBrains UpSource
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Robot framework
Robot frameworkRobot framework
Robot framework
 
Selenium Design Patterns
Selenium Design PatternsSelenium Design Patterns
Selenium Design Patterns
 
Robot Framework Dos And Don'ts
Robot Framework Dos And Don'tsRobot Framework Dos And Don'ts
Robot Framework Dos And Don'ts
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Code Review
Code ReviewCode Review
Code Review
 
Testing Java applications with Maveryx
Testing Java applications with MaveryxTesting Java applications with Maveryx
Testing Java applications with Maveryx
 
Unit Testing 101
Unit Testing 101Unit Testing 101
Unit Testing 101
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshers
 
Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
 
FluentSelenium Presentation Code Camp09
FluentSelenium Presentation Code Camp09FluentSelenium Presentation Code Camp09
FluentSelenium Presentation Code Camp09
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Software Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet SolutionSoftware Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet Solution
 

En vedette

solution architect
solution architectsolution architect
solution architect
Oleg Miroff
 
Pathway to solution architect
Pathway to solution architectPathway to solution architect
Pathway to solution architect
Volodymyr Yelchev
 
Practical SOA for the Solution Architect
Practical SOA for the Solution Architect Practical SOA for the Solution Architect
Practical SOA for the Solution Architect
WSO2
 

En vedette (20)

ATG Best Practices
ATG Best Practices ATG Best Practices
ATG Best Practices
 
Oracle ATG Commerce Overview for developers
Oracle ATG Commerce Overview for developers Oracle ATG Commerce Overview for developers
Oracle ATG Commerce Overview for developers
 
ATG Advanced Profile Management
ATG Advanced Profile ManagementATG Advanced Profile Management
ATG Advanced Profile Management
 
ATG Advanced RQL
ATG Advanced RQLATG Advanced RQL
ATG Advanced RQL
 
ATG pipelines
ATG pipelinesATG pipelines
ATG pipelines
 
How a project is born. Intro to Discovery Phase
How a project is born. Intro to Discovery Phase How a project is born. Intro to Discovery Phase
How a project is born. Intro to Discovery Phase
 
Ecommerce in 2018
Ecommerce in 2018Ecommerce in 2018
Ecommerce in 2018
 
solution architect
solution architectsolution architect
solution architect
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change Management
 
Pathway to solution architect
Pathway to solution architectPathway to solution architect
Pathway to solution architect
 
Oracle eCommerce (ATG) Database Best Practices
Oracle eCommerce (ATG) Database  Best Practices Oracle eCommerce (ATG) Database  Best Practices
Oracle eCommerce (ATG) Database Best Practices
 
Software engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least onceSoftware engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least once
 
SEO Instruments in ATG
SEO Instruments in ATGSEO Instruments in ATG
SEO Instruments in ATG
 
Sonar Review
Sonar ReviewSonar Review
Sonar Review
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
Sonar technology ppt
Sonar technology pptSonar technology ppt
Sonar technology ppt
 
Lean Security
Lean SecurityLean Security
Lean Security
 
Sonar
SonarSonar
Sonar
 
Practical SOA for the Solution Architect
Practical SOA for the Solution Architect Practical SOA for the Solution Architect
Practical SOA for the Solution Architect
 
Code Review Tool Evaluation
Code Review Tool EvaluationCode Review Tool Evaluation
Code Review Tool Evaluation
 

Similaire à How to improve code quality for iOS apps?

Deepak_Resume_Automation
Deepak_Resume_AutomationDeepak_Resume_Automation
Deepak_Resume_Automation
Deepak Pandey
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
gaoliang641
 

Similaire à How to improve code quality for iOS apps? (20)

Deepak_Resume_Automation
Deepak_Resume_AutomationDeepak_Resume_Automation
Deepak_Resume_Automation
 
Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 
Code Quality - Security
Code Quality - SecurityCode Quality - Security
Code Quality - Security
 
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
 
Pragmatic Code Coverage
Pragmatic Code CoveragePragmatic Code Coverage
Pragmatic Code Coverage
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Java Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeekJava Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeek
 
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaTech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
 
(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
 
Code quality
Code qualityCode quality
Code quality
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
 
How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 
Continuous Inspection of Code Quality: SonarQube
Continuous Inspection of Code Quality: SonarQubeContinuous Inspection of Code Quality: SonarQube
Continuous Inspection of Code Quality: SonarQube
 
Zero-bug Software, Mathematically Guaranteed
Zero-bug Software, Mathematically GuaranteedZero-bug Software, Mathematically Guaranteed
Zero-bug Software, Mathematically Guaranteed
 
1506.08725v1
1506.08725v11506.08725v1
1506.08725v1
 
GPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesGPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators Families
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

How to improve code quality for iOS apps?

  • 1. How to improve Code Quality? iOS apps RECOMMENDATIONS
  • 3. Sonar covers the 7 axes of code quality SONAR an open source web application to manage code quality
  • 4. Key metrics  Potential bugs  Potential performance problems  Potential security issues  Duplicates  Unused Code  Code Complexity  Technical debt  Сoverage
  • 5. Community Plugin 5 FREE No support Might not support Xcode 8 https://github.com/Backelite/sonar- objective-c
  • 6. Official Plugin 6 € 5,000 per year Support included Frequent new releases http://www.sonarsource.com/products/plugi ns/languages/objective-c/
  • 7. Comparison community plugin official plugin price Free € 5,000 per year support no included metrics •Complexity: uses Lizard •Documentation: blank comments, comment lines, % •Duplication: blocks, linkes, % •Issues: Uses OCLint: 63 rules, and Faux Pas: 102 rules •Size •Test: Uses xctool, will probably switch to xcodebuild + xcpretty soon •Code coverage: With gcovr for project before Xcode 7, otherwise slather more details: https://github.com/octo- technology/sonar-objective- c/wiki/Features, https://github.com/Backelite/son ar-objective-c 200+ rules: details supported systems •Given that there is no official support, POC is required to check it whether it works with XCode 8 •0.4.x releases for SonarQube >= 4.3 (4.x and 5.x) •latest release was in 01/2015 •no information about XCode supported •all Sonar versions are supported
  • 8. Recommendations Configure Objective C and Swift community plugins Set up daily scans Configure daily emails to the dev team Analyze results •Define areas for improvements: •Security, unused code, code duplicates, potential performance issues •Reduce code complexity •Fix existing critical and major issues Fix new issues 8 If community plugins don’t work - buy an official plugin
  • 9. Metrics and KPIs to track Track Issues provided by plugin: ◦ fix blockers and majors ◦ set an acceptable threshold for minor and info Track the next metrics: ◦ technical debt (calculated by the tool) ◦ security issues ◦ unit test coverage ◦ duplicated code ◦ complexity: ◦ cyclomatic complexity number ◦ number of parameters
  • 10. Unit Testing Don’t test trivial code! Scope of Unit Testing: ◦ View Models ◦ Generic Algorithms ◦ Managers with business logic ◦ Complicated View Controllers Expected incremental coverage is ~60% ◦ Code coverage is not a primary goal for unit testing! Tools: ◦ XCTest ◦ Sonar ◦ Jenkins – add unit tests to build lifecycle 10
  • 11. Unit testing – Process recommendations Write unit tests for the code to be refactored Write unit tests during bug fixing Start unit testing for the new code 11
  • 12. Exampleofaunittest 12 class LabelValuesTests: XCTestCase { var vc: ViewController! override func setUp() { super.setUp() let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()) vc = storyboard.instantiateInitialViewController() as! ViewController } func testLabelValuesShowedProperly() { vc.updateLabels(Float(80.0), Float(50.0), Float(40.0)) // The labels should now display 80, 50 and 40 XCTAssert(vc.numberLabel.text == "80.0", "numberLabel doesn't show the right text") XCTAssert(vc.percentageLabel.text == "50.0%", "percentageLabel doesn't show the right text") XCTAssert(vc.resultLabel.text == "40.0", "resultLabel doesn't show the right text") } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } }

Notes de l'éditeur

  1. FREE: Track your iOS app code quality using Sonar: http://blog.octo.com/en/track-your-ios-application-code-quality-using-sonar/community plugin: https://github.com/Backelite/sonar-objective-c
  2. NOT FREE: SonarSource Objective-C http://www.sonarsource.com/products/plugins/languages/objective-c/ Documentation: http://docs.sonarqube.org/pages/viewpage.action?pageId=3080359 Automated Objective-C code quality analysis 200+ coding rules Coding rules for MISRA-C and MISRA-C++ MITRE CWE coverage CWE Compatible Support for user-defined coding rules
  3. Siva