December 23, 2008

...Learn TDD with Codemanship

Dependencies & The "Credit Crunch"

In support of my parallel between the problems involved in managing complex networks of debt and the likely propogation of defaults, watch the interviewers face as mathematicians Nassim Taleb and Benoit Mandelbrot calmly and rationally explain why we're all ****ed.

The international debt network has gotten way too complex and is divided among too few financial institutions that are too highly interconnected. Similarly, too many dependencies in your code divided among too few packages with too many interpackage dependencies will likely as not lead to the potential for the tiniest change in one part of the code leading to massive disruption in the rest of the software.

Now I know that many developers just don't "get" dependency management, but you simply cannot afford to ignore a problem like this. It will hurt you.

Remember the three rules of dependency management:

1. Less code = less dependencies. Remove as much unnecessary and duplicate code as possible. Remove features that aren't being used, for exampe. And remove all examples of copy-and-paste inheritence.

2. Encapsulate your dependencies. As Robert Martin teaches us; things that change together belong together. Break up your classes into size-optimised, highly cohesive and loosely-coupled packages. And no, size-optimised doesn't mean "as small as possible"...

3. Depend on things that are more dependable. Sounds obvious, doesn't? In OO programming, this generally means we should favour dependencies on classes and packages that are: a) less likely to be disrupted by changes to other parts of the code (more stable), and b) easier for us to substitute without affecting the client (more abstract).

Posted 9 years, 6 months ago on December 23, 2008