YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Tools and Techniques that help maintain a high quality code base

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

Have you ever encountered this?

Page 3: Tools and Techniques that help maintain a high quality code base

…or this?

Page 4: Tools and Techniques that help maintain a high quality code base

What is code quality?

Page 5: Tools and Techniques that help maintain a high quality code base

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

What is code quality?

Page 7: Tools and Techniques that help maintain a high quality code base

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

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

Armed to the teeth - code analysis

!

• Clang analyzer

• OCLint

• AppCode analyzer

Page 10: Tools and Techniques that help maintain a high quality code base

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

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

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

!

!

• 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

!

• OCUnit

• XCTest

• Google Test

Armed to the teeth - unit testing

Page 15: Tools and Techniques that help maintain a high quality code base

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

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


Related Documents