Slide 26 of 44
Notes:
The first step in refactoring a Blob AntiPattern is to Identify or categorize related attributes and operations according to contracts.
These contracts should be cohesive in that they all directly relate to a common focus, behavior or function within the overall system. For example, in the following example, a library system architecture diagram is represented with a potential Blob class called LIBRARY. In the example in Figure 3-3, the LIBRARY class encapsulates the sum total of all the systems functionality. Therefore our first step would be to identify cohesive sets of operations and attributes that represent contracts. In this case, we could gather operations related to catalog management, like sort_catalog and search_catalog as shown. We could also identify all operations and attributes related to individual items, like print_item, delete_item, and so on.