-1

I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here to get some guide lines.

In our database we have a list of Products, which can be exported as XML, RTF or PDF

The user can select one or many products from the list to export. After Selecting the product(s) he/she is presented with list of Export type(XML, RTF, PDF) and a list of Connections( where to send this export files) like FTP, HTTP, EMail etc whose details are already configured.

And this export is used for many different users, who have different needs. For example User1 need only Description, User2 needs Description+Thumbnail etc.

Should I create for Export type(XML, RTF, PDF) a Manager class? and For Connections also a Manager class?

And for Different users should I create an Interface?

0

Firstly I think Manager is the wrong term here - Factory is probably a bette concept.

It sounds like you have three variables: format of export, columns to export, where to export.

Each one of these is a set of classes all conforming to an interface. A Factory would be useful in each case to create the correct class given the inputs (option fields on a UI?). Then they could be given to another class which coordinates their actions.

For example something like the below pseudo-code where Formatter, ColumnPicker, and DataStore are the interfaces I mentioned above. Concrete instance of them are created via factories based upon user input.

class Exporter {
    Exporter(Formatter formatter, ColumnPicker picker, DataStore storage) { ... }
    exportData(ProductList products) {
       storage.store(formatter.format(products.map(picker.pickColumns)))     
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.