--- url: "https://martinfowler.com/eaaCatalog/plugin.html" titulek: "Plugin" h1: "Plugin" popis: "Links classes during configuration rather than compilation." jazyk: "" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 21:09:22" znaku: 1558 slov: 213 kodovani: "utf-8" sha256: "ef11b3d9ccfebcc8a5b73620513aaa0f593ec656aeae56f2a617f510d15969a1" --- # Plugin Links classes during configuration rather than compilation. [Separated Interface](separatedInterface.html) is often used when application code runs in multiple runtime environments, each requiring different implementations of particular behavior. Most developers supply the correct implementation by writing a fac-tory method. Suppose you define your primary key generator with a Separated Interface so that you can use a simple in-memory counter for unit testing but a database-managed sequence for production. Your factory method will most likely contain a conditional statement that looks at a local environment variable, determines if the system is in test mode, and returns the correct key generator. Once you have a few factories you have a mess on your hands. Establishing a new deployment configuration - say “execute unit tests against in-memory database without transaction control” or “execute in production mode against DB2 database with full transaction control” - requires editing conditional statements in a number of factories, rebuilding, and redeploying. Configuration shouldn't be scattered throughout your application, nor should it require a rebuild or redeployment. Plugin solves both problems by providing centralized, runtime configuration. for more details go to [Chapter 18](https://learning.oreilly.com/library/view/patterns-of-enterprise/0321127420/ch18.html#ch18lev1sec9) of the online ebook at oreilly.com This pattern is part of [Patterns of Enterprise Application Architecture](.) David Rice and Matt Foemmel 05 March 2003