Strangler Fig Pattern
   HOME

TheInfoList



OR:

In programming, the strangler fig pattern or strangler pattern is an
architectural pattern Software architecture pattern is a reusable, proven solution to a specific, recurring problem focused on architectural design challenges, which can be applied within various architectural styles. Examples Some examples of architectural patte ...
that involves wrapping old code, with the intent of redirecting it to newer code or to log uses of the old code. Coined by Martin Fowler, its name derives from the strangler fig plant, which tends to grow on trees and eventually kill them. It has also been called Ship of Theseus pattern, named after a philosophical paradox. The pattern can be used at the
method Method (, methodos, from μετά/meta "in pursuit or quest of" + ὁδός/hodos "a method, system; a way or manner" of doing, saying, etc.), literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In re ...
level or the
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
level.


Rewrites

One use of this pattern is during software rewrites. Code can be divided into many small sections, wrapped with the strangler fig pattern, then that section of old code can be swapped out with new code before moving on to the next section. This is less risky and more incremental than swapping out the entire piece of software. The strangler fig pattern can be used on
monolithic application In software engineering, a monolithic application is a single unified software application that is self-contained and independent from other applications, but typically lacks flexibility. There are advantages and disadvantages of building applica ...
s to migrate them to a
microservices In software engineering, a microservice architecture is an architectural pattern that organizes an application into a collection of loosely coupled, fine-grained services that communicate through lightweight protocols. This pattern is characterize ...
architecture.


Logging

Another use of this pattern is the addition of logging to old code. For example, logging can be used to see how frequently the code is used in production, which can be used to decide whether to delete low-usage code, or to rewrite high-usage code.


See also

*
List of software architecture styles and patterns Software Architecture Pattern refers to a reusable, proven solution to a recurring problem at the system level, addressing concerns related to the overall structure, component interactions, and quality attributes of the system. Software architectur ...


External links

* https://learn.microsoft.com/en-us/azure/architecture/patterns/strangler-fig * https://martinfowler.com/bliki/StranglerFigApplication.html


References

{{Comp-sci-stub Software design patterns