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
![Page 1: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/1.jpg)
Tools and Techniques that help maintain a high quality code base!
Anastasia Kazakova
![Page 2: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/2.jpg)
Have you ever encountered this?
![Page 3: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/3.jpg)
…or this?
![Page 4: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/4.jpg)
What is code quality?
![Page 5: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/5.jpg)
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
![Page 6: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/6.jpg)
What is code quality?
![Page 7: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/7.jpg)
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
• …
![Page 8: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/8.jpg)
What do we have to do?!
1. Analyze
2. Fix, refactor
3. Check nothing was broken
![Page 9: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/9.jpg)
Armed to the teeth - code analysis
!
• Clang analyzer
• OCLint
• AppCode analyzer
![Page 10: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/10.jpg)
Clang analyzer!
• Open source, part of Clang project
• Integrated into Xcode
• Basic checks, dead code, API checks, language specific checks
![Page 11: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/11.jpg)
OCLint!
• Metric-based defects
• 58 rules that can be customized per project
• Integrated with clang analyzer
• Can be used inside the Xcode
![Page 12: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/12.jpg)
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
![Page 13: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/13.jpg)
!
!
• 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
![Page 14: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/14.jpg)
!
• OCUnit
• XCTest
• Google Test
Armed to the teeth - unit testing
![Page 15: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/15.jpg)
Summary
• Use the swiss-army knife thoughtfully to find smells
• Refactor to clean up the smells
• Cover every inch with the unit tests
![Page 16: Tools and Techniques that help maintain a high quality code base](https://reader034.vdocument.in/reader034/viewer/2022051313/547e89aeb47959c0508b4b8e/html5/thumbnails/16.jpg)
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