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.
1. Tools and Techniques that help maintain a high quality code base! Anastasia Kazakova
2. Have you ever encountered this?
3. or this?
4. What is code quality?
5. 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
6. What is code quality?
7. 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
8. What do we have to do? ! 1. Analyze 2. Fix, refactor 3. Check nothing was broken
9. Armed to the teeth - code analysis ! Clang analyzer OCLint AppCode analyzer
10. Clang analyzer ! Open source, part of Clang project Integrated into Xcode Basic checks, dead code, API checks, language specific checks
11. OCLint ! Metric-based defects 58 rules that can be customized per project Integrated with clang analyzer Can be used inside the Xcode
12. 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
14. ! OCUnit XCTest Google Test Armed to the teeth - unit testing
15. Summary Use the swiss-army knife thoughtfully to find smells Refactor to clean up the smells Cover every inch with the unit tests
16. Thanks for listening! [email protected] @anastasiak2512 IDE for iOS/OS X dev: http://jetbrains.com/appcode, @appcode Cross-platform C/C++ IDE: http://jetbrains.com/clion, @clion_ide