I am doing an application that support external files with different extensions. With a FileChooser
the user selects the file, I get the name of the file and the extension. And now is the problem: if, for example, the user choose an xml, I need to get the nodes, if he chooses an CSV file I need to do split, if he ...
I know that use something like that is a bad programming
if(extension==".xml"){
XMLImportFile();
}else if (extension==".txt"){
TXTImportFile();
} else if (extension==".csv"){
...
}
So what you suggest? I was thinking using an interface (I don't know it the best idea and how it should be used) or other thing, if necessary, but I really want to avoid bad programming.