I am trying to create a library where I need to validate and parse a file in a CSV-like format and then use this data to generate a Tree data structure.
At the moment I split the process into two steps:
- Validate the file and store its lines in a list (in the
- Read the list plus a string array containing a subset of columns to generate the tree (in the
I was thinking if the steps can be simplified as a single one, since I would only need to store data just once (and there would be better performance) and I would store less data because of the columns subset. But I am concerned that the single step would result in a merged package that has too many responsibilities: validation and tree preparation.
What would be the best option in terms of best practice of software architecture?