tools and techniques that help maintain a high quality code base
DESCRIPTION
Talk about tools and techniques for keeping your code of high quality. Includes the code analysis tools overview (like clang analyser, OCLint, AppCode inspections), code refactoring options (in Xcode and AppCode) and unit testing.TRANSCRIPT
Tools and Techniques that help maintain a high quality code base!
Anastasia Kazakova
Have you ever encountered this?
…or this?
What is code quality?
What is code quality?!
!
!
!
Some say:!Easy to understand!
Easy to maintain!Easy to use!Works right!
!
!
!
!
!
!
!
!
!
Some say:!high quality == meets
requirements!!
!
!
!
!
!
Some say (CISQ):!Reliability!Efficiency!Security!
Maintainability!Size
What is code quality?
Possible problems• Dead code
• Copy/paste, duplicated code
• Hiding scope
• Too much happening at one place
• Code style inconsistency
• Patterns violations
• Bad coding practices
• Over-generalized code
• …
What do we have to do?!
1. Analyze
2. Fix, refactor
3. Check nothing was broken
Armed to the teeth - code analysis
!
• Clang analyzer
• OCLint
• AppCode analyzer
Clang analyzer!
• Open source, part of Clang project
• Integrated into Xcode
• Basic checks, dead code, API checks, language specific checks
OCLint!
• Metric-based defects
• 58 rules that can be customized per project
• Integrated with clang analyzer
• Can be used inside the Xcode
AppCode!
• Full-fledged IDE for iOS/OS X development, 100% compatible with Xcode
• Integrated with clang analyzer
• 60 inspections for Objective-C, 40 for C/C++, on-the-fly mode
• Quick fixes!
• Data Flow analysis included
• Settings, severity level, profiles
• Bulk mode, run by name, checks on commit stage
!
!
• Xcode refactorings
• Rename, Extract (method/function), Move up/down, Create superclass, Encapsulate, Convert…
• AppCode refactorings
• + Inline, Safe delete, Change signature, Extract everything, Rename with non-code usages (strings, comment, xib, etc.)
Armed to the teeth - code refactoring
!
• OCUnit
• XCTest
• Google Test
Armed to the teeth - unit testing
Summary
• Use the swiss-army knife thoughtfully to find smells
• Refactor to clean up the smells
• Cover every inch with the unit tests
Thanks for listening!
@anastasiak2512
IDE for iOS/OS X dev: http://jetbrains.com/appcode, @appcode
Cross-platform C/C++ IDE: http://jetbrains.com/clion, @clion_ide