I have a simple task this is what I need the code to do:
- Read data from a third party REST resource.
- Parse the json object to match my internal structure.
- Save the parsed data in my database.
I could just be lazy and have everything done in a single method, but I want to apply best practices, apply tests and have clean code, but being careful about overengineering.
My plan is to have three separated classes.
1. RestResourceReader List<OriginalResourceDTO> GetAll() 2. Parser List<ParsedResourceDTO> Parse(List<OriginalResourceDTO>) 3. ResourceRepository void Insert(List<ParsedResourceDTO>)
So in those three classes I have all the functionality needed. Then something must orchestrate those three classes in order to do something useful.
Should I just call those three classes inside "Main" in a console app?
Or should I create a fourth class called Syncer, where it will have a Sync method that will call all the functionality, and then just call that method inside Main?
I don't know sometimes I feel like I'm overengineering something too simple.