Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created March 14, 2025 10:00
Show Gist options
  • Save trikitrok/e3aa609f476ff2dc00ffbbc2673ce79e to your computer and use it in GitHub Desktop.
Save trikitrok/e3aa609f476ff2dc00ffbbc2673ce79e to your computer and use it in GitHub Desktop.
Wrap method

Wrap method.

Version 1 (when clients will only use the composed behaviour).

How to do it:

  1. Identify the change point.

  2. Extract a method with the body of the current method.

  3. Develop a method for the new behaviour with tests.

  4. Call it from the current method.

Version 2 (when clients will use either the old or new behaviour).

How to do it:

  1. Identify the change point.

  2. Develop a method for the new behaviour with tests.

  3. Create another method that calls the new and the old methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment