Back to list
Views:   8.4K
Replies:  1
Archived

Factory or Strategy or Builder Pattern

I've got an application that creates and sends packets. A packet consists of one or more document objects. e.g.

Packet1 = [ DocA, DocB, DocB, DocB ]
Packet2 = [ DocB, DocB, DocC ]
Packet3 = [ DocC, DocB, DocA ]

Document objects vary in the number and type of input parameters used to query a database; they return unique datasets to fill specific document fields.

Both packet and document types are expected to grow.

Packets use different transport protocols. One might send() via fax server, another SMTP, FTP, save to PDF file, etc.

I think the strategy pattern could be utilized to isolate variances in the send() methods.

I'm wondering if the factory or builder pattern could be applied here to create the documents and then packets? My goal is make the application extensible in regards to adding new packet and document types. Any suggestions or insight would be appreciated. Thanks.


Jo Yoshida, Feb 16, 2013
Reply 1
I ended up using a factory for both documents and packets. Strategy pattern was used to handle the different transport protocols for the packet object.

The concrete classes are now only stubbed out with log messages but so far the solution looks extensible.
Jo Yoshida, Feb 19, 2013


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.2.2