I have an assignment and I would like to figure out which pattern is better to utilize.
The task is pretty straightforward:
Develop an application that consumes various text files which differ from customer to customer, parses them one-by-one and persists into the database in a unified form. The application is going to be used by numerous customers.
For example, one .csv file can contain the following payload:
day,time,year,name,surname
01,12:00,2019,Andrey,Arshavin
...
Another file can look like:
day,time,year,fullName,country
01,12:00,2011,Cristiano Ronaldo,Portugal
...
And the database table has the following columns:
date(Timestamp),firstName(String),secondName(String)
The goal of the project is to provide a solution with a clear design.
The first idea that I have is to create different DTOs
for different customers and one Entity
class. On each .csv read, make a List<DTO>
by using a factory method and after convert it to the List<Entity>
and persist.
But how can I make it more extendable and maintainable? I think the spaghetti code is not a good idea for each new customer I will have to add
"if that customer then return such new object"
Aucun commentaire:
Enregistrer un commentaire