<p>Do you use Design by Contract professionally? Is it something you have to do from the beginning of a project, or can you change gears and start to incorporate it into your software development lifecycle? What have you found to be the pros/cons of the design approach?</p>

<p>I came across the <a href="http://en.wikipedia.org/wiki/Design_by_contract" rel="noreferrer">Design by Contract</a> approach in a grad school course. In the academic setting, it seemed to be a pretty useful technique. But I don't currently use Design by Contract professionally, and I don't know any other developers that are using it. It would be good to hear about its actual usage from the SO crowd.</p>

I can't recommend it highly enough.  It's particularly nice if you have a suite that takes inline documentation contract specifications, like so:
```
```
// @returns null iff x = 0
public foo(int x) {
  ...
}
```
```
and turns them into generated unit tests, like so:
```
```
public test_foo_returns_null_iff_x_equals_0() {
  assertNull foo(0);
}
```
```
That way, you can actually see the tests you're running, but they're auto-generated.  Generated tests shouldn't be checked into source control, by the way.