Reusable Code
Domain: Code Generation
π― Motivation
Code written to be used in multiple places. The model can refactor duplicated code into reusable functions.
π Concrete Example
Three places have similar code. Model: βExtract this into a function: def validate_email(email): β¦β Now all three places call validate_email(). DRY: Do not Repeat Yourself.
π Analogy
A reusable shopping bag - instead of getting a new plastic bag each time, you use the same sturdy bag. Reusable code is used in multiple places without duplication.