Patrones de Dise帽o y Principios SOLID
Patrones de Dise帽o y Principios SOLID en Python
Principios SOLID
Principio de Responsabilidad 脷nica (SRP) en Python
Procesador de Pagos con Stripe en Python
Aplicar el Principio de Responsabilidad 脷nica (SRP)
Principio Abierto/Cerrado (OCP) en Python
Aplicar el Principio Abierto/Cerrado (OCP)
Principio de Sustituci贸n de Liskov (LSP) en Python
Aplicar el Principio de Sustituci贸n de Liskov (LSP)
Principio de Segregaci贸n de Interfaces (ISP) en Python
Aplicar el Principio de Segregaci贸n de Interfaces (ISP)
Principio de Inversi贸n de Dependencias (DIP) en Python
Aplicar el Principio de Inversi贸n de Dependencias (DIP)
Reestructuraci贸n del proyecto
Reestructuraci贸n de un proyecto en Python
Patrones de Dise帽o
Introducci贸n a los Patrones de Dise帽o
Patr贸n Strategy en Python
Implementando el Patr贸n Strategy
Patr贸n Factory en Python
Implementando el Patr贸n Factory
Patr贸n Decorator en Python
Implementando el Patr贸n Decorador: Mejora tu Servicio de Pagos
Patr贸n Builder en Python
Implementando el Patr贸n Builder: Construye Servicios de Pago
Patr贸n Observer en Python
Implementando el Patr贸n Observer
Patr贸n Chain of Responsibility en Python
Implementando el Patr贸n Chain of Responsibility: Flujo Eficiente de Validaciones
Patrones de Dise帽o y Principios SOLID en un Procesador de Pagos
You don't have access to this class
Keep learning! Join and start boosting your career
Implementing the principle of interface segregation is key to keeping the code clean and flexible in complex systems such as a payment processor. In this case, several enhancements were addressed within the payment processor including the creation of specific methods for refunds and recurrences, along with the proper segregation of interfaces according to the capabilities of each payment processor.
processTransaction
method was modified to not depend on the Stripe attribute, as there are now multiple processors.The offline payment processor implemented methods that it could not use, such as refunds and recurrences, which violated the interface segregation principle. This principle states that a class should not depend on methods that it cannot implement or use.
(RefundPaymentProtocol
) and one for recurrences(RecurringPaymentProtocol
).(RefundProcessor
and RecurringProcessor
), allowing each type of processor to handle only the actions that correspond to it.Contributions 9
Questions 2
Want to see more contributions, questions and answers from the community?