Saturday, May 10, 2014

TDD Is a Tool, Not a Religion

Catching Up

The internet is abuzz since DHH's blog post: TDD is Dead.
There have been many responses, including many by Bob Martin.

Breaking News

The latest new entry to the saga is a video conversation on YouTube where DHH, Martin Fowler and Kent Beck discuss the virtues and pains of test driven development. Definitely worth watching.

Subjective Summary

  1. TDD scratches an itch. It's one way to make you feel good about your work, confident that it works as intended, every step of the way. 
  2. TDD does not work well for all problems, like when the output is unknown or unquantifiable.
  3. Self-testing code (programmatic & repeatable) is highly desirable, but TDD is not the only way to get there.
  4. Heavy use of reflective mocking can tightly couple tests to implementations, counteracting one of the primary reasons to have tests: to enable refactoring. (Bob Martin has some thoughts on when and how to mock.)
  5. Programming has many trade offs (testability, maintainability, usability, speed, etc.), and it is important to keep them all in perspective, re-prioritizing as needed, without becoming myopic.


Just because writing unit tests and making them pass is easier and provides faster feedback than end-to-end tests doesn't mean unit testing is more important. It's critical that good unit design doesn't come at the cost of good system design.

I'll leave you with my favorite list of Object Oriented Design Principles. As with most sets of goals, it's impossible to satisfy them all all the time, but it's important to keep them all in mind, and know when to apply them.

Thursday, October 3, 2013

Capitalism + Socialism = America 2.0

Anthony Bourdain wrote a nice perspective piece on gun culture in America. It made me think.

Guns may not be a part of your culture, they're not part of mine, but they're definitely part of America's culture, past present and future. They are definitely deadly weapons, but so are cars. Neither are going away anytime soon.

Guns may not be what congress is fighting over today, but different cultures are definitely clashing. Do we individually pull ourselves up by our own bootstraps or do we collectively pull each other up? Do you spend your hard earned money to help some stranger you don't even know? Are people in need fellow humans down on their luck or mooching free loaders? That's what the fight is over.

If you're the mathematical type you might even recognize both issues from game theory, the study of conflict and cooperation between intelligent rational decision-makers. We could jest about congressional intelligence and rationality, but lets not miss the wide ranging implications. Eight game-theorists have won the Nobel prize, including John Nash for his idea of Nash equilibrium, the idea that the optimal solution for multiple competing game players is not just to play your own strategy but to adapt your strategy to the strategies of your competitors. If you ignore everyone else's priorities and goals and strategies you will lose.

I've applied this to corporate politics already, but it also applies to national politics. Granted, there are many complexities, like Bayes-Nash equilibrium, differing belief systems, random chance, incomplete information, risk avoidance or corruption. The core concept is still intuitive enough to apply (obviously the details are non-trivial). In general tho, we can't just think of ourselves and we can't just think of the collective. We need to think about what's best for us AND our community, me AND my neighbor, the state AND the country.

Our constitution may be a great document, but it's woefully lacking in these kinds of mixed-strategy incentives. It relies primarily on checks and balances, a strategy for combating the aggregation of power, but checks and balances are mostly disincentives, not incentives to do the right thing. Our constitution is great at stopping any one person or branch of government from becoming too powerful, but it's pretty terrible at motivating optimal behavior or continual improvement. What feedback loop is there to motivate your congressional representative to think about what's best for the country? If they please their constituents they get elected again, but where's the motivation to come to the table and do what's best for the other 99%+ of the people in the country? Instead of multiple incentives and enlightened thinking we have a government run on head butting competition that enables and glorifies pure selfish greed.

"Screw you, got mine" selfishness is poison the same way utopianaltruism is. Cooperation is nothing without a little self-interest, but too much self-interest unbalances the system so that everyone loses. Romanticized Capitalism is just as flawed as utopian Socialism. It's time for a new -ism; one where we think about us AND them.

Sunday, September 22, 2013

Exponential Improvement Is The New Growth

Here's a sneak peak at a future S.A.T. analogy. Fill in the blank.
Velocity : Acceleration : Jerk :: Growth : Continuous Improvement : _________
We'll get to the answer, but first a history lesson!

Buckminster liked to make up new words. "Ephemeralization" was his from the 1930's. The classic definition of ephemeralization is "doing more with less", but it's more precisely the observation that things happen more quickly and easily over time, requiring less resources. The easier things become, the faster they become easier. The cheaper things become, the faster they become cheaper. Generally this is attributed to the adoption of scientific management, as exemplified in early industrialization (especially by Henry Ford).

Gerald Hawkins in the 1980's described the idea that each stage of change had an inflection point where a paradigm shift ('mindsteps', as he called them) occurred, advancing the rate of change forward. He also observed that the rate of paradigm shifts was increasing. Change was accelerating.

In 1986, Masaaki Imai popularized "Kaizen", the idea of continuous improvement in business management. Ideally improvement doesn't need to be limited to discrete (continual)  jumps based on scheduled analysis after designated periods of time (iterations), but could instead be driven by slack in the system to allow (continuous) improvements every day. The acceleration of change requires faster measurement and analysis, but with built-in slack the workers on the factory floor can do it better than managers at a distance.

In 2010, David Anderson documented "Kanban", a method of software development that integrates Agile concepts with Japanese Kaizen improvement techniques. The practices and policies Anderson describes are great management techniques based on years of experience and an evolution of Agile methodology. His primary focus is on work in progress limits to create slack, but the real power comes from empowering workers with information and constant feedback so that they can use the slack for continuous improvement.

So with the implementation of continuous improvement in Japanese factories (like Toyota) and later Silicon Valley software developers (like Google), managers found themselves with less management to do because they'd empowered their employees to do their job for them. Many people have been confused by this, thinking that managers are now obsolete in an organization of continuous improvement (like Valve software), but the truth is simply that managers need to level up, the same way factory workers replaced by automation had to become educated to produce, maintain, and improve automation. Managers won't manage people in the future, they'll manage their own empowerment of people.

Managers don't just provide feedback any more. They empower employees to provide and receive feedback. Just like employees need feedback to improve, management needs feedback to improve as well. If you really want to get better at getting better you need to level up again. "It's much less about 'What kind of knowledge advantage do I have right now?' but 'How fast am I creating new knowledge?'."

This is where executives come in. The new job of executives isn't to manage the managers any more or even just to manage external expectations, but to empower the managers to manage themselves. Empowered managers get better at empowering workers to get better, inovating on innovation. As we've seen on the previous level, old style executives are becoming obsolete, even a liability. They need to educate themselves and raise to the challenge of faster change, to manage the empowerment of managers. They need to not just set a culture, but grow a culture of change. Business doesn't just need to evolve; it needs to improve its ability to evolve.

Back to the analogy...

Velocity is position over time. Acceleration is velocity over time. Jerk is acceleration over time. Growth is improvement of state over time (the new role of workers). Continuous Improvement is positive growth over time (the new role of managers). So Exponential Improvement is faster continuous improvement over time (the new role of executives).  Jerk is the third time-derivative of position. Exponential Change is the third time-derivative of state. Exponential Improvement is positive Exponential Change.

No, this doesn't mean future executives will all be jerks, but they might need to be good at calculus. The executive needs to enable Exponential Improvement, and the easiest way to do that is to derive it from the employee improvement metrics over time. They'll have to analyze metrics and behavior to figure out how to improve exponentially. They'll have to identify synergistic ways to empower managers that increase their rate of empowerment.

To be fair, Continuous Improvement will get you a long way. Most organizations haven't even figured out that yet, but they will. And the more that figure it out, the faster the movement will grow. But if you really want to succeed in the future you can't stop there. You have to get better at getting better at getting better.

Future Shock is no longer in the future, it's now. Change is and will be. Change is continuous and accelerating and decentralized. This isn't a revolution; revolutions end. Businesses that didn't change are already dead. Businesses that aren't changing fast enough are dying. The new race is how fast you can innovate. It's a race you can't conclusively win; you can only win now and survive until you win again. Growth is slowing down. To grow linearly you'll need to improve exponentially.

Stop watching the world improve and start participating in making it improve faster.