Code Quality Tools

Palantir is very passionate about strong engineering practices in our software. We make use of a wide range of techniques and tools to ensure the best possible code outputs. In this post we will explore some of the standardised tools we use to ensure our high level of quality.

Automated Testing

We work primarily in the Financial Services industry, and we need to know that our code is correct. Almost as important we need to be able to verify that it has stayed correct even after changes. We thus make heavy use of automated tests suites; from unit testing which tests the smallest parts of the code rigorously, through component testing, integration testing, and even browser based functional testing. See Automated Testing for more details.

We consider it unprofessional to produce code without a comprehensive suite of automated tests, and our preferred coding discipline is known as Test Driven Development; we start with the tests, and then write the code that fulfills those tests.

Code Contracts

Code Contracts is a library and set of tools that allow the developer to specify behaviour in the code, and for the compiler to check that the code conforms to that behaviour. This allows for much stricter compile checking than C# currently has, the compiler can now reason about the code, and pick up a huge set of issues.

Almost as important we’ve found that Code Contracts heavily reduce the amount of automated tests we require. For example, if you use Code Contracts for parameter guard clauses, then you don’t need to test the scenarios where incorrect values are passed in, such a situation is guaranteed to never happen by the static check.

This reduces the required amount of tests by approximately 30%, with a concomitant decrease in costs, and no decrease in quality.


We have a strict set of coding standards, but coding standards are useless without adherence to the standards. Accordingly our coding standards are enforced by tools and processes.

We make use of tools called FxCop and StyleCop which check the adherence to our standards (a selection of the “standard” rules for those tools, coupled with some extra rules of our own. These tools must be successfully executed prior to code being allowed to enter the code base. This policy is itself enforced by automated tools.

This helps makes Palantir code more consistent, more secure, and more performant.

We also make use of a tool called Resharper, which helps automated adherence to these rules, in addition to providing many productivity improvements. We get markedly better code for the same effort that poor code would require.

Metrics & Logging

One of the most neglected things in bespoke software systems is the monitoring and logging. This can result in vastly inflated production support costs, as figuring out complex interactions require developers to spend time stepping through what the code did and why. An example is in complex calculations; in order to provide an answer as to why a particular result was arrived at can require hours of developer time.

At Palantir we believe very strongly in logging, the most the better. We have a Calculation Steps Engine which helps surface the internals and results of complex calculations, we log performance and usage metrics in detail, and our logging strategy makes use of structured logging to allow analysis of logged information.

Coupled with metric and log aggregators, this provides fast and deep insights into the operational performance and operation of the software we build. We also make use of Correlation IDs passed between software layers to allow us to thoroughly track individual requests as they thread their way through complex layers and arrangements of services.

Leave a Reply

Your email address will not be published. Required fields are marked *