Why is using the right tool for the job so important? Efficiency and results are two reasons that immediately spring to mind. You don’t see construction workers using shoes to drive in nails – so why as software developers do we so often make do with manual solutions to find bugs or optimize code? It’s certainly less efficient and much more frustrating, and the final results can be less than ideal.
It always takes time to learn a new tool – so how do you know where you should invest your time? We at KDAB would like to share our favourite Qt development tools that we think are worth the effort. We regularly rely on these tools to help us locate and fix troublesome bugs and solve difficult optimization challenges. If you live at the cutting edge of Qt development you may be familiar with many of these, but we know there’ll be something new for you regardless of your level of expertise.
GammaRay –introspection tool that adds Qt-awareness to the debugger
If you’ve been frustrated by debugging through endless Qt structure internals, you’ll definitely want to give this a try. GammaRay understands most of the core Qt components from a Qt perspective – QtQuick scene graphs, model/view structures, QTextDocuments, signal/slot activations, focus handling, GPU textures, QWidgets, state machines, and more – letting you observe and edit values at run-time in a natural way. You can debug applications from launch or attach to running apps (both local and remote).
- https://www.kdab.com/development-resources/qt-tools/gammaray/
- https://www.kdab.com/gammaray-2-9-0-release/
Clazy –compiler plug-in that understands Qt semantics
This is something that needs to be part of every Qt developer’s bag of tricks. By adding clazy to clang, you’ll get compile-time warnings for Qt best practices – unneeded memory allocations, misused APIs, or inefficient constructs. Clazy is a great way to improve your Qt code and best of all, it can provide automatic refactoring fixes for some of the errors it finds – no coding required!
- https://www.kdab.com/clazy-video/
- https://www.kdab.com/clazy-results-visualizer-qt/
- https://www.kdab.com/clazy-1-2-released/
Modern C++ – source code that uses C++11/14/17 improvements
Although C++11 and C++14 have been around for a while now, there are many old coding habits that die hard. Many developers don’t take advantage of newer C++ constructs that are more efficient, understandable, and maintainable. The thing is you don’t need to be a C++ standards expert to make small changes that can significantly help your code. We’ve got a few of the more important highlights covered in a paper below – or you can attend a training class or two for the real low-down.
Clang Tidy – compiler toolto help modernize your C++
This is the lazy person’s way to modernize C++. Another clang-based tool, Clang Tidy points out older C++ idioms that could use updating. It flags where these should be replaced with new C++11 or C++14 improvements, and in many cases can do the refactoring automatically. That’s productivity for you!
- https://www.kdab.com/clang-tidy-part-1-modernize-source-code-using-c11c14/
- https://www.kdab.com/clang-tidy-part-2-integrate-qmake-and-other-build-systems-using-bear/
HotSpot – tool to visualize your app’s CPU performance
When it comes to optimizing, nothing beats a profiler – but reading raw perf logs is a punishment that should only be reserved for people who believe zip files are a proper form of source control. HotSpot reads Linux perf logs and lets you see multiple different views (callers, timeline, top-down, bottom-up) to help you easily understand where you’re burning up your time.
- https://www.kdab.com/hotspot-video/
- https://www.kdab.com/hotspot-v1-1-0-adds-timeline-recording-features/
apitrace –set of tools to debug your graphics APIs and improve their performance
If you’re writing an app with a GUI, profiling doesn’t stop at your C++ code. You need a way to see the calls you’re making to OpenGL, Direct3D, or DirectDraw, view the contents of those calls in a graphical interpretation, and profile their performance. That’s exactly what apitrace does. It can also replay a trace file, allowing you to compare and benchmark performance once you’ve seen where to make improvements.
Kernel/System Profiler – tools for visualizing your operating system’s performance
Sometimes performance problems aren’t found in your app – they’re in multiple-process interactions, hidden in driver stacks, or a result of how you’re calling the operating system. For these kinds of really low-level debugging, you’ve got to have a system-profiling tool. It can feel like swatting a fly with a bazooka, but a system profiler is an incredibly invaluable tool that can find problems that nothing else will.
- Linux:
- QNX Neutrino:
Heaptrack – tooling to watch your app’s memory usage
Sometimes optimization isn’t about speed – it’s about memory. If you’re trying to profile yourapplication’s memory usage, you’ll want to check this out. By showing your application’s peak memory usage, memory leaking functions, biggest allocators, and most temporary allocations, you’ll be able to really narrow down where your app’s memory is going and how to keep it on a diet.
Continuous Integration (CI) – build systems for agile/XP development
Continuous integration fits hand-in-hand with unit testing as a methodology that can bring very real improvements to your software quality – whether you’re using agile development or not. Don’t bother creating your CI build system from scratch when there are a lot of great tools that can give you a leg up on delivering quality products.
Qt Creator – the Qt IDE
Perhaps you think it’s cheating to include Qt Creator in this list since it’s already installed on every Qt developer’s desktop. Yes, but did you know you can find slowspots in your Qt Quickcode through the built-in QML profiler? How about hitting Alt+Enter to get a list of all the refactoring options at the cursor location?What about other handykey sequences to find symbol references, do a git diff, or record a macro, along with many other super helpful navigation and editing aides? Shortcuts that you might use ten times a day if you only knew they were there. Don’t be a slave to your mouse – print out our handy reference card and pin it up on your cube wall.
- http://doc.qt.io/qtcreator/creator-qml-performance-monitor.html
- http://doc.qt.io/qtcreator/creator-editor-refactoring.html
- https://www.kdab.com/development-resources/qtcreator/
Those are our top ten tools for improving your Qt development tool chest. Don’t forget there are also things that can’t be automated but for which there are courses and customized training – such as effective code reviews or best coding practices.
Is there anything else that you’ve found to be invaluable that you want to share? Please leave a suggestion in the comments!
http://blog.qt.io/blog/2018/10/12/modern-qt-development-top-10-tools-using/