Measure What Matters To Customers

In Measure What Matters To Customers, Ron Baker challenges several common notions held by professional service firms including “costs drive prices” and “productivity can be measured by timesheets”. Too many firms, Baker says, are focused on optimizing production and lowering costs to the detriment of effectively serving their customers.

To be successful in today’s information economy, executives must shift their focus to ensuring the success of customers. In this new model, executives must increase the firm’s intellectual capital, price, and effectiveness. Baker advocates developing firm-wide Key Predictive Indicators–forward looking predictors of customer success, not backwards looking performance measures. If you are helping your customers be successful, it’s likely you will be as well. KPIs should be generated by hypothesis and periodically tested. If a KPI isn’t actually predicting your firm’s outcomes, go back to the whiteboard.

Baker presents Gordon Bethune’s transformation of Continental Airlines as an example of the new business model. In the 90’s, Continental was a budget airline so cheap nobody wanted to fly on it. It ranked last in all performance measures for airlines. All efforts had been made to reduce the cost per seat mile traveled. Bethune shifted the focus to customer metrics: on-time arrivals, luggage lost, and complaints received. The airline quickly won more customer satisfaction awards than any other airline in the world and the stock priced increased 25X.

Baker also discusses the rise of the intellectual worker. He regards the timesheet as a remnant of Taylorism. Knowledge workers are not like workers of the industrial revolution. They are paid for their ideas, not hours worked. Setting billable hour quotas is demoralizing. Knowledge workers should be, at least in part, compensated for the results they produce in the form of bonuses or stock options.

Without timesheets, how should services be billed for? Simple. Set the price of the service relative to its value to the customer. With a price set upfront, the firm can tailor its services’s cost appropriately. Decoupling the cost from hours works can lead to innovation within the company. By taking on the risk of a fixed price contract, the firm gains the ability to earn far more than margin on labor.*

I recommend this book to every professional services manager. Baker provides insight into where some of our widely held beliefs originated. I’m confident following his advice will help other’s find a profitable future serving others.

*For more on this topic, see his book Implementing Value Pricing.

Generating SQL from expression trees, Part 2

As promised, here is a much improved version of the where clause builder from my last post. This version generates parameterized queries so it isn’t vulnerable to SQL injection. Using parameters also allowed me to simply the logic since I don’t need to worry about stringifying the values or using “IS” instead of “=” for null checking.

I moved all the string concatenation into a separate class called WherePart. These objects are composable in a structure similar to the source expression tree. Extracting this class is my favorite part of the refactoring.

I’m still not happy with how I’m handling the LIKE queries. I have to pass a prefix and postfix parameter down to the next level of recursion which clutters up the method signature. It might be better to just build the string in place.

Continue reading

Generating SQL from expression trees

Is this further down the rabbit hole than IL generation? I’m not sure but I went there.

(Note: This was an experiment. It doesn’t generate safe SQL. I’ll follow up with a better version.)

An expression tree is an abstract representation of code as data. In .NET they are primarily used for LINQ-style code. In C#, lambda expressions can be decomposed into expression trees. Here is an example of a lambda and it’s expression tree:

x => x.PosId == 1 && x.Name == "Main"


There are five key types of expression tree nodes.

UnaryExpression: An operation with a single operand such as negation.

BinaryExpression: An operation with two operands such as addition or && or ||.

MemberExpression: Accessing a property, field, or method of an object or a variable. (Variable references in lambda expressions are implemented as fields on a class generated by the compiler.)

ConstantExpression: A node that is a constant value.

ParameterExpression: An input to a lambda function.

The following code recursively walks an expression tree and generates the equivalent where clause in SQL, for sufficiently simple expressions. One of the areas that was a bit tricky is SQL’s handling of NULL. I have to check the right side of a binary expression for NULL so I can generate “x IS NULL” instead of “x = NULL”. I used parentheses liberally so ease composing the expressions. Handling negation was done naively. It could be cleaned up by propagating the negation into the child node.

Continue reading

Playing with IL generation

This week I started learning how to generate CIL (Common Intermediate Language, the .NET runtime’s equivalent of assembly). The .NET classes for doing this looked a bit intimidating so I chose to try out FluentIL first. FluentIL is a helper library to simplify generating IL. I’m not sure if it helped or hurt–I had to mentally translate all the online samples I looked at into FluentIL and I also found an opcode (castclass) which wasn’t implemented in the fluent helpers.

I used the cheater method to write the example below. First I wrote a strongly typed C# method which did exactly what I wanted the IL to do and built it in release mode. Then I used dotPeek to view the generated IL and wrote an equivalent generic version.

One of the difficulties of writing IL is debugging it. If the program isn’t perfectly valid, the runtime gives you a very generic invalid program error. Also, if you have a runtime type violation in the IL you get an exception saying the operation could make the runtime unstable. There is no stack trace to help you find the error.

This code provides a way to directly set properties on an object without using reflection. It would be useful if you have an object but only know the type at runtime. This isn’t production ready code.
Continue reading