The Definition of a Gentleman

The True Gentleman is the man whose conduct proceeds from good will and an acute sense of propriety, and whose self-control is equal to all emergencies; who does not make the poor man conscious of his poverty, the obscure man of his obscurity, or any man of his inferiority or deformity; who is himself humbled if necessity compels him to humble another; who does not flatter wealth, cringe before power, or boast of his own possessions or achievements; who speaks with frankness but always with sincerity and sympathy; whose deed follows his word; who thinks of the rights and feelings of others, rather than his own; and who appears well in any company, a man with whom honor is sacred and virtue safe.

– John Walter Wayland

Flotsam and Jetsam #106

  • Number 10 with a bullet!
  • As you may have noticed on my LinkedIn Profile, I am once again an employee at Gateway Ticketing.  This time around, I am a Senior Software Developer, meaning I am full-time Delphi Developer.  I’m delighted to be back in the new beautiful building that Gateway has built.  I’m also pleased to have shaved an hour off of my commute each way.  I enjoyed my time at Veeva Systems, but the prospect of returning to Gateway and reducing my commute was just too much to resist.
  • Why did Borland fail?  Danny Thorpe gave an answer on Quora, and it is being discussed on Hacker News.
  • The inestimable Julian Bucknall has released is well-known EZDSL data structure library at GitHub.  Thanks, Julian!
  • Book Update:  As many of you know, I’m working on a new book called, naturally, “More Coding in Delphi” and I thought I’d give you an update on it.  The whole book is written, and it’s going to be a little longer than “Coding in Delphi”.  It’s now in that really hard stage where you have to read it and read it and update it and change the demos and fix things and do all the millions of little things that it takes to finish things up.  In other words it’s in the “The last 20% takes 80% of the time” mode.  But don’t worry, as I type this I’m sitting at Burger King getting ready to plow into things and “git ‘er done”. 

Review: FixInsight

A confession:  I was given a free license to review FixInsight.

A summation:  I really like it.  It’s in a category tool that I think most Delphi developers don’t take advantage of. 

A statement:  It’s not as powerful as Delphi’s Code Audits, but it is more usable.  I presume that Roman Yankovsky will continue to improve it and eventually it will cover as many rules as Code Audits does.  Start using static analysis today, one way or another.

Full Comments:   FixInsight is a static code analysis tool.  A static tool is one that examines the code itself, apart from any runtime environment.  It uses a parser – in this case, a fork of Jacob Thurman’s Pascal Parser – to examine the code and apply a set of rules against the result.  Those rules can point to questionable constructs in your code that may be bugs or other problems.  You can use static analysis to enforce formatting rules,  find places where coding conventions have not been followed, and to enforce specific coding techniques.  The compiler will do a lot of this kind of thing for you, but there are certain things that the compiler won’t see that

FixInsight does all of this for you in the IDE.  Once installed, it provides a menu item that brings up the following dialog:

image

From here, you can select or unselect the Conventions or Warnings that you want to verify.  Some of the Conventions and Warnings can be configured as shown above where you can set the maximum number of variables that will be allowed in a given method on the right side of the window.

Conventions are things that “should” be done a certain way; they might be described as enforcing a certain coding “style”.  For instance, Convention C107 ensures that all private field variables in a class start with ‘F’, a long time Delphi convention. 

Warnings are coding constructs that “look suspicious”.  Things like a destructor without an inherited call, or the dreaded “Empty EXCEPT block” – that is, things that are likely just wrong code and that could cause problems in the execution of your code.    A warning basically says “Something doesn’t look right here and you should take a close look to make sure that all is well and correct”.

Running Fix Insight operates much like the compiler and produces Convention and Warning messages in – Surprise!  — the Message Pane:

image 

If you double click on one of the items, it take you to the spot in your code where the problem occurs.   Nice.

FixInsight also includes a command line tool for inclusion in a continuous integration process.  In fact, I’d recommend this be the main way you use it.  It can be used to fail a build that finds code in your repository that doesn’t conform to your definition of “clean” code. 

You can tell FixInsight to ignore chunks of your code via the _FIXINSIGHT_ compiler directive.

The documentation is quite nice, with each rule clearly explained, though I found that FixInsight’s descriptions are very easy to understand, and you shouldn’t have any trouble figuring out what it is trying to tell you. 

Here’s how I recommend you use FixInsight:

  1. Establish a set of Conventions and Warnings that you want to enforce.
  2. Use the IDE tooling to ensure that your code conforms to those rules and that you never check in code that violates any of your rules
  3. Run the command line tool as part of your continuous integration process, and break the build if any checked in code violates your rules

Do that, and it will go a long way towards keeping your codebase clean and tidy.

You can download a trial version of FixInsight here

I presume that Roman will add more Conventions and Warnings to future versions — there’s a lot of room here to do some very cool things.

Bottom Line:  FixInsight is a fine entry into the Delphi Third-party market.  Whether you decide to use it or Delphi’s own tool, you should be including static code analysis into daily routine and your continuous integration.