Circuitous Treasure Hunt
The Circuitous Treasure Hunt Anti-Pattern
is typically found in database
applications. Software system retrieves data from the first table in a database
, uses those results to search the second table, retrieves data from that table, and so on, until the ?ultimate results? are obtained. A large amount of database
processing is required for each time the ?ultimate results? is retrieved. This will result in performance
degradation for the application because of the high volume of database
accesses. Another instance of this Anti-Pattern
is also found in object-oriented systems, where operations have large ?response sets.? In this case, one object invokes an operation in another object, that object then invokes an operation in another object, and so on, until the ?ultimate result? is obtained. Then, each operation returns, one by one, to the object that made the original call. The performance
of the systems will deteriorate due to such chaining of the method invocations among different objects.
Symptoms and consequences
- In order to obtain the ?ultimate results?, the database needs to process a large amount of queries. This burden on the database leads to performance degradation of the database in processing other query requests.
- The large amount of database processing is especially problematic when the database is on a remote server as this causes the network performance degradation in addition to the processing burden of the database.
- The chaining of the method invocations at different objects requires an extra processing to identify the final operation to be called and invoked, especially in distributed object systems where objects involved may reside in other processes and on other processors.
- When the method invocation causes the intermediate objects to be created and destroyed, the impact on performance degradation is even greater. The memory allocation and de-allocation of the intermediate objects are frequently performed and they also consume system resources.
Very interesting link about Software Anti-Patterns