Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good design pattern to implement a dynamic data importer tool?

Tags:

We are planning to build a dynamic data import tool. Basically taking information on one end in a specified format (access, excel, csv) and upload it into an web service.

The situation is that we do not know the export field names, so the application will need to be able to see the wsdl definition and map to the valid entries in the other end.

In the import section we can define most of the fields, but usually they have a few that are custom. Which I see no problem with that.

I just wonder if there is a design pattern that will fit this type of application or help with the development of it.

like image 620
Geo Avatar asked Dec 19 '08 20:12

Geo


People also ask

Which is best design pattern in java?

Solution: Singleton design pattern is the best solution of above specific problem. So, every design pattern has some specification or set of rules for solving the problems.

How do I know what design pattern to use?

To use design patterns effectively you need to know the context in which each one works best. This context is : Participants — Classes involved. Quality attributes — usability, modifiability, reliability, performance.

Which design patterns would you use to make the implementation of a function to vary at runtime depending on specific needs?

Decorator Pattern The decorator design pattern is used to modify the functionality of an object at runtime. At the same time, other instances of the same class will not be affected by this, so individual object gets the modified behavior.

What is the best approach in design patterns in coding?

One of the most popular design patterns used by software developers is a factory method. It is a creational pattern that helps create an object without the user getting exposed to creational logic. The only problem with a factory method is it relies on the concrete component.


1 Answers

I am not sure where the complexity is in your application, so I will just give an example of how I have used patterns for importing data of different formats. I created a factory which takes file format as argument and returns a parser for particular file format. Then I use the builder pattern. The parser is provided with a builder which the parser calls as it is parsing the file to construct desired data objects in application.

// In this example file format describes a house (complex data object)
AbstractReader reader = factory.createReader("name of file format");
AbstractBuilder builder = new HouseBuilder(list_of_houses);
reader.import(text_stream, builder);

// now the list_of_houses should contain an extra house
// as defined in the text_stream
like image 158
Erik Engheim Avatar answered Nov 15 '22 05:11

Erik Engheim