Reading Path for Core Developer Skills
Often when seeking to break systems up into properly-coupled, strongly-cohesive entities, one can create long, complex paths that must be traced in order to understand how any single piece of functionality is implemented. This can impede understanding and maintenance, and when this happens we express this by saying the design lacks focus.
If cohesion is about there being a place for everything, focus is about completing the adage and making sure everything is in its place.
It is essential that you be able to find all the code related to a particular concept as quickly as possible. If a single concept is sprinkled throughout numerous methods or classes, then it will be more difficult to find all the code for it.
Improving and sustaining the focus of our code makes it easier to find code related to a specific concept. That reduces the cycle time required to make a change and that, in turn, reduces both cost and risk.
The main obstacle to focus is that sometimes people think it opposes other code qualities like cohesion or encapsulation. If this is how you see the world, then programming is a constant battle between keeping your code well-factored enough to avoid redundancy or be testable and concentrated enough to be focused and readable.
As with all code qualities, how you remedy a problem matters.
If you imagine good design as this great battle between a pantheon of qualities, then things are going to be difficult for you forever. The solution, for someone who sees things that way is to try and create balance between these competing forces. Every time you add scope, things will get more difficult because of the inexorable march toward disorder implied by such a view.
If, on the other hand, you focus on how the code qualities can harmonize and amplify one another, you have a different set of choices. For example, in many cases, the solution to a lack of focus is to identify the concept that wasn’t properly recognized in your design and increase both cohesion and focus by extracting that concept into its own class or method.