Framework-agnostic Code - A story about business and code
In this talk, I covered some software architecture concepts in order to make more scalable and reusable application code avoiding coupling with framework tools.
and Transparent. • A PagSeguro class that implements the Standard checkout. • I should be able to extend the PagSeguro class in order to implement the Transparent behaviour.
to process payments for orders, services, tickets, or anything payable. • The Payment Processor also should be able to work with the PagSeguro class as well with the PagSeguro Transparent class. • And the Payment Gateway should be able to process payments through different payment methods, if it supports.
• A Payment Processor must expect an implementation of a Gateway Interface instead of an instance of a PagSeguro class. • A Payment Processor must expect a Payable Interface instead of an instance of an Order class. • Use Dependency Injection of the abstractions. • Use DI containers to care about the concretion of these abstractions
Facades and Services • Inject and integrate it with the framework using tools like Dependency Injection Container, Service Container, etc… • If you need/want to move away from your current framework, you only need to change the service that integrates your business component with the framework.