mardi 23 août 2016

What design pattern is to be used in JAVA?

I have a set of inputs and the there are different methods which accept those inputs and do different task in once class. Shall I use a factory pattern here since the method signature is same and create different classes where the implementation differs? The number of cases are pretty big , factory pattern is good idea?

As example I have a switch on file type and there are almost 20 types of file types so 20 switch cases. Have a look at the below example for 2 such cases , I have such 20+ cases

switch( fileType ) {
                case SIMPLE_FILE:
                    processSIMPLEData( stepInput, stepOutput,ackFilePath, errorFilePath );
                break;
                case MUL_FILE:
                   processMULData( stepInput, stepOutput,ackFilePath, errorFilePath );
                break;

....

Aucun commentaire:

Enregistrer un commentaire