Skip to content

nedshopov/JsonTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JsonTask

Hello,

First of all thank you for your time!

Please take a moment to read through this text file as I am going to describe some design decisions and assumptions. I am currently on full-time job and chasing a project deadline so I could not afford to spend much more time working on this task. I gave examples of various parts of the system on how it could be improved. Thanks for understanding!

  1. Assumptions

As a part of the task I have assumed that I need to do very basic implementation that is fulfilling the requirements. That means the product is nothing like completed and more like the bare minimum. However it does contain some validation and testing logic. The validation required for the purpose of the final product should be implemented on more places than it currently is. At the moment most (if not) all validation is done via a JSchema (newer version of the old JsonSchema). That schema is predifined and saved as JSon, which can be found in main project folder.Ideally that schema should be generated in runtime (there is some code for that existing in the project). The reason why I have pre-defined it is because It was easier for me to fine tune it with few regex statements and type validation. For example the maximum 'to' age property. There should be validation attributes and maybe against set of rules. The overall design could be refactored for better unit testing. In order to achieve that all the static classes should have interfaces and methods, so they can be instantiated and mocked. An inversion of control container could also help the testing process and decouple the different elements of the system. There should be as well a dedicated file provider and logger. I have wrote few unit tests across multiple classses, just for demonstration purposes, but they are nowhere enough.

Generally every single input should be validated and any errors handled. I also assumed that any unit types that are not part of the PART1 of the task are not valid input (such as g(s)). I also assumed that any number that is not a valid integer is not a valid input (like 1.2 and -1). Currently there is no implementation for marking the non-required input properties.

There is a slight mismatch between the desired output and the generated one. I assume it will not cause any issues, since it is few empty lines and few new lines. They can be fixed if the serialization is split into smaller stages.

  1. How to use

Open in visual studio. Set JsonTask as start project. In Program.cs there is a commented out line of code, which contains the file name of the input file to use, so it can be easily switched between different input files. After running the program, an output.json file is generated, containing all valid inputs mapped to the desired output schema. Any errors with incorrect input are logged into the ErrorLog.Txt, which is being generated by a custom json converter. It is using a json schema file, which filters out any undesired input. The contains of that file could be done in a more readable format if required.

Thank you again for your time and looking forward into receiving your feedback!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages