.vscode | ||
assets | ||
data/dtos | ||
models | ||
services | ||
.gitignore | ||
assignment (1).nl.en.pdf | ||
DemoApplication.csproj | ||
Problems.md | ||
Program.cs | ||
README.md | ||
review.cs |
Project Description
Running the project
-
Comment out all the code in review.cs file. Missing directives in that file will otherwise prevent the the program from running. And this file is not central to the project itself.
-
The easiest way to run this would be to use
dotnet run [args]
. If you want a more realistic use case, you usedotnet publish
to create an executable binary and then execute that binary with the command-line args as normal.
Infrastructure disclaimer
I come from a background of developing mobile applications in Dart/Flutter, with a different set of conventions (such for file naming etc). I have done some research into doing it and tried sticking to it. But in the end, the architecture is still heavily influenced by practices in mobile development.
Structure
Assets
There ae 2 JSON files in the assets
directory. These can be used as input as cli-args.
Data modelling objects
- OrderDTO: Captures the raw data received from a JSON file.
- OrderModel: Captures the usable part of the
OrderDTO
that will be written out to the CSV.
Services
- DemoApplicationConfiguration: Stores the configuration that the program ran with. Such as the command-line args passed (and hence the mode), the actual input data, and the ouput destination. Along with the file-existnece checks
- CsvWriter: Writes an order to a file.
- Deserializing the JSON was handled by a package. Could have made this into a service ideally, for better scaling up.
Packages used
- Newtonsoft.Json: For deserialzing JSON into constituent DTOs easily.
- CsvHelper: To write out to a CSV file.
Code review exercise
The answer to the review exercise can be found in Problems.md file.