@@ -14,7 +14,7 @@ changing or extending the behavior of commands. :class:`~django_typer.TyperComma
1414or add additional commands to a command implemented elsewhere. You can then use Django's built in
1515command override precedence (INSTALLED_APPS) to ensure your command is used instead of the upstream
1616command or give it a different name if you would like the upstream command to still be available.
17- The :ref: `composition pattern <composition >` allows commands and groups to be added or overridden
17+ The :ref: `plugin pattern <plugin >` allows commands and groups to be added or overridden
1818directly on upstream commands without inheritance. This mechanism is useful when you might expect
1919other apps to also modify the original command. Conflicts are resolved in INSTALLED_APPS order.
2020
@@ -139,15 +139,15 @@ expect other apps to also modify the same command. It's also a good choice when
139139a different flavor of a command under a different name.
140140
141141What if other apps want to alter the same command and we don't know about them, but they may end up
142- installed along with our app? This is where the composition pattern will serve us better.
142+ installed along with our app? This is where the plugin pattern will serve us better.
143143
144144
145- .. _ composition :
145+ .. _ plugin :
146146
147- Composition
147+ Plugins
148148-----------
149149
150- **The composition pattern allows us to add or override commands and groups on an upstream command
150+ **The plugin pattern allows us to add or override commands and groups on an upstream command
151151directly without overriding it or changing its name. This allows downstream apps that know
152152nothing about each other to add their own behavior to the same command. If there are conflicts
153153they are resolved in INSTALLED_APPS order. **
@@ -159,7 +159,7 @@ Because we're now mostly working at the level of our particular site we may want
159159backup logic. For instance, lets say we know our site will always run on sqlite and we prefer
160160to just copy the file to backup our database. Lets also pretend that it is useful for us to backup
161161the python stack (e.g. requirements.txt) running on our server. To do that we can use the
162- composition pattern to add our environment backup routine and override the database routine from
162+ plugin pattern to add our environment backup routine and override the database routine from
163163the upstream backup app. Our app tree now might look like this:
164164
165165.. code-block :: text
@@ -218,7 +218,7 @@ this:
218218 do this inside ready() because conflicts are resolved in the order in which the extension
219219 modules are registered and ready() methods are called in INSTALLED_APPS order.
220220
221- For composition to work, we'll need to re-mplement media from above as a composed extension
221+ For plugins to work, we'll need to re-mplement media from above as a composed extension
222222and that would look like this:
223223
224224.. literalinclude :: ../../django_typer/tests/apps/examples/extensions/media2/management/extensions/backup.py
@@ -310,18 +310,18 @@ You may even override the initializer of a predefined group:
310310 and groups.
311311 """
312312
313- When Does Composition Make Sense?
313+ When Do Plugins Make Sense?
314314~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315315
316- Composition can be used to group like behavior together under a common root command. This can be
316+ Plugins can be used to group like behavior together under a common root command. This can be
317317thought of as a way to namespace CLI tools or easily share significant code between tools that have
318318common initialization logic. Moreover it allows you to do this safely and in a way that can be
319319deterministically controlled in settings. Most use cases are not this complex and even our backup
320320example could probably better be implemented as a batch of commands.
321321
322322Django apps are great for forcing separation of concerns on your code base. In large self contained
323323projects its often a good idea to break your code into apps that are as self contained as possible.
324- Composition can be a good way to organize commands in a code base that follows this pattern. It
324+ Plugins can be a good way to organize commands in a code base that follows this pattern. It
325325also allows for deployments that install a subset of those apps and is therefore a good way to
326326organize commands in code bases that serve as a framework for a particular kind of site or that
327327support selecting the features to install.
0 commit comments