Skip to main content
Dirty Flag

Also known as

  • Change Tracking
  • Is-Modified Flag

Intent

The Dirty Flag design pattern is employed to avoid unnecessary computations or resource-heavy operations by maintaining a boolean flag that tracks whether the state of an object has changed ('dirty') or remains unchanged ('clean'). This flag, when set, indicates that a particular operation, such as recalculating or refreshing data, needs to be performed again to reflect the updated state.


iluwatarAbout 3 minBehavioralGame programmingPerformanceResource managementState tracking
Execute Around

Also known as

  • Around Method Pattern
  • Resource Block Management

Intent

Execute Around idiom frees the user from certain actions that should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource.


iluwatarAbout 2 minBehavioralClosureCode simplificationEncapsulationFunctional decompositionResource management
Guarded Suspension

Also known as

  • Conditional Block
  • Suspended Execution

Intent

The Guarded Suspension pattern manages operations that require both a lock and a condition to proceed, allowing a thread to wait for an appropriate condition while being efficient with resource use.


iluwatarAbout 2 minConcurrencyAsynchronousDecouplingResource managementSynchronizationThread management