▲ 0 r/csharp
C# Interview take home assignment rejected over complexity
The is well know US company offering full HR and Payroll services.
The assignment core logic is to calculate tax based on regime config of each country.
There are 3 regimes flat, percentage and progressive.
The assignment already had a poorly written code using all in a single file:
hardcoded sql,
manual string parsing decimal values,
single for loop
The task was to find bugs and fix them, improve code quality using solid principles.
My below solution was deemed too complex to make the cut.
I wanted feedback on whether my solution is indeed complex.
Create Host.
Setup DI.
Run Host.
Host run BackgroundWorker.
Worker fetches regime mapping for each country in db using store proc.
Now build factory that returns approriate tax calulator for each country.
Creates a map of country + calulator.
Fetch pending tax rows from db using store proc in batches.
For each row:
look up map an run caluator.
add result to a collection.
Send the collection to a store proc that updates in db.
If no more rows then signal host to exit.
u/Different_Owl613 — 5 hours ago