Introduction to Bridge Pattern
- Sharon Stefany Castilla Araque ~ 20251020089
- Luna A. Sandoval Rodríguez ~ 20241020053
The context of this project is about a small electronic billing system for a retail chain. The system supports different types of vouchers, each with its own content construction logic.
The main goal is to allow vouchers to work with different export formats, sending channels, and electronic signature providers without creating a subclass for every possible combination.
- Note: The export formats, sending channels, and signature providers are represented through interfaces and can vary independently from the voucher types.
- Package:
Exporters
- interface
FormatExporter - class
XMLExporter - class
PDFExporter - class
JSONExporter - class
EDIExporter
- Package:
SendingChannels
- interface
SendingChannel - class
EmailChannel - class
WhatsAppChannel - class
WebPortalChannel
- Package:
SignatureProviders
- interface
SignatureProvider - class
LocalSignature - class
CloudSignature - class
HSMProvider
- Package:
Vouchers
- abstract class
Voucher - class
SalesInvoice - class
CreditNote - class
DebitNote - class
WithholdingCertificate
Main
- Clone or download the repository.
- Open the project in a Java-compatible IDE such as VS Code, IntelliJ IDEA, or Eclipse.
- Make sure Java is correctly installed and configured.
- Run the
Mainclass. - Check the console output to observe the different voucher combinations.
- Verify that different vouchers can work with different export formats, sending channels, and signature providers.
- Check the EDI extension to verify that a new export format can be added without modifying the
Voucherhierarchy.
The architecture department requests the addition of a new export format, EDI, without modifying or recompiling any classes in the Comprobante hierarchy. Based on the diagram you created, answer the following in 1-2 lines: What new class should you create, what type should it inherit from or implement, and why does this operation not require modifying Comprobante or any of its four subclasses?
Answer: The new class that needs to be created is EDIExporter, which must implement the FormatExporter interface. This does not require modifying Voucher or its subclasses because they depend on the FormatExporter interface, not a specific implementation, allowing new formats to be added independently.
Last Modification: 14/08/2026