CodeWizard for Linux
Price: $2495 US (single license)
Reviewer: Ben Crowder
You're working on your latest C++ project, an infinitely cool piece of software that everyone is dying to see. Before you release, however, you want to get rid of as many bugs as possible. You know you have a certain bad habit you learned in C, the one you have to go back and fix time, after time since you keep forgetting you're writing in C++ now.
Enter CodeWizard by ParaSoft, a tool that searches through your code for violations of good C++ coding standards. Based on programming ideas from Scott Meyers' books Effective C++ and More Effective C++, CodeWizard automatically enforces thirty-five descriptive rules or “items” for effective C++ programming—standards that significantly reduce the number of errors in your code. In addition to Meyers' rules, ParaSoft has included a list of thirty-six additional items.
What kind of rules are we talking about? First of all, the items have each been given a rating according to the severity of the rule. The five ratings, from least serious to fatal, are: Informational, Possible Violation, Violation, Possible Severe Violation and Severe Violation (see Figure 1). An example of an Informational rule is item 2 under the Effective C++ list: “Prefer iostream.h to stdio.h.” So, for instance, if you include stdio.h in your code, one of the warnings that will come up will explain that you shouldn't use stdio.h when coding in C++ (see Figure 2). A Possible Violation is rule #17: “Check for assignment to self in operator=.” Item #22 catalogs a Violation: “Pass and return objects by reference instead of by value.” A Possible Severe Violation is something like, “Don't try to return a reference when you must return an object.” Severe violations can prove to be fatal to your program. Rule #10 is a good example: “Write delete if you write new.” Seems obvious, of course, but you may forget it and thus cause ugly memory leaks. The items are divided into different categories, such as “Shifting from C to C++”, “Memory Management” and “Inheritance and Object-Oriented Design”.
CodeWizard came with some instructions on installation and basic usage. The distribution file is a tar file—it's up to you to manually copy it over from the CD and unpack it. A graphical installation program would come in handy for less experienced users (although you probably won't be using the UNIX version of CodeWizard, if you aren't familiar with a UNIX shell and basic commands). You can configure CodeWizard as either root or a regular user—both ways worked fine for me. A license is required, which must be obtained from ParaSoft. The pslic program, the ParaSoft License Manager, will give you a machine ID and a network ID, which you give to ParaSoft. In return, you'll receive an expiration date and a password which will unlock CodeWizard. I'm sure there's an easier way to manage licenses, one that doesn't require contacting ParaSoft, but this method minimizes pirating (which is, of course, a concern only for commercial software vendors—the GPL is beautiful in that it completely shatters software piracy).
You use CodeWizard in place of your compiler on the command line. Instead of typing
g++ project.c -o project
you would use
codewizard project.c -o projectYou can set the compiler for CodeWizard to use in a configuration file. CodeWizard then scans your code for any of the violations in its rule set. On a side note, you can suppress any of the rules (in case some of them make no sense when applied to your particular project), or you can add your own rules using RuleWizard (see Figure 3). There is a Motif GUI program, Insra (see Figure 4), that displays the error messages and allows you to open the source files, make any necessary changes, rebuild the program and retest the code for violations. If you want to keep everything strictly console-based, however, you can do that as well.
All in all, I'd have to say that CodeWizard can be an incredible help in C++ coding. A Java version is available as well, and with the ability to add your own rules, you could foreseeably use it for almost any other language as well. Though it is expensive, if you're serious about your C++, this would be a wise investment.Version 3.0 is due out in September.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.View Now!
- When Official Debian Support Ends, Who Will Save You?
- Ubuntu Ditches Upstart
- Video On Demand: 8 Signs You're Beyond Cron
- May 2015 Issue of Linux Journal: Cool Projects
- "No Reboot" Kernel Patching - And Why You Should Care
- Picking Out the Nouns
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites