I’m reading Death and Life in the hope of finding connections between city planning and software architecture. In the book, Jane Jacobs presents a number of fundamental factors that are key to the success of city neighborhoods – such as diversity of uses, a mix of old and new buildings, et cetera. Extreme programmers and other fans of refactoring and emergent design claim that being savvy about code smells, and refactoring frequently whenever there is smelly code, is “all” that’s required for achieving and maintaining good design.
I think that this might be true, but I’m not yet at the point where I know that this is true for a team of programmers, who locally make design choices, navigating by code smells, and refactoring continuously.
As I’m writing this I think about the importance of, when making design decisions, re-using patterns that are familiar either within the team, or among programmers in general. Design can’t be purely local, or the system will consist of too many different types of solutions. If we use the image that a system’s architecture is like a grammar for a language – that the architecture describes the system, rather than make a blueprint for a system that is to be built. Then, the simpler the grammar the better (up to a point, of course). Programmers must, as they make local design decisions, pay attention to what those decisions mean at the larger scale – how they affect the system’s grammar: its architecture.
This is something that Jane Jacobs doesn’t have to deal with in her book. There is, in some way, a pattern language, a grammar, an architecture, that all cities implicitly follow. They use elements such as streets, buildings, squares, parks, bridges, et cetera. At a particular level of abstraction, all cities grow in the same way: by adding more of these types of elements (sometimes by replacing). Software, on the other hand, can grow in ways that completely distort the topology. So software development needs principles that programmers follow to keep the system from getting incomprehensible as a whole.