Ask HN: I have 10 yrs of Exp. Failed 4 takehome projects. What am I doing wrong?
The code overall looks reasonable and I don’t write much python but:<p>- requirements.txt is the standard for specifying deps, right?<p>- making a README explaining the project might be good (I see you have this, but maybe switch documentation.md to README.md)<p>- tests?<p>- building the flask application via a function is a bit more testable<p>- reading settings from ENV is preferred (12 factor apps)<p>- output not sanitized for &#x2F;test endpoint<p>- generator in util could have been pulled out probably? It’s created every time<p>- generate test path function seems a bit longer than it should be — all those lambdas should probably just be functions since you’re going to use them a lot<p>- did you have to define your own Json type? Is that complete? Where’s null?<p>- url generate function should probably template hostname — that’s more important than host, most of the time for running in different environments<p>- trailing slashes matter in flask, evidently, and every request without one gets redirected (test suite would have caught this)<p>- on the usage of redis, I wonder if scanning + in-memory aggregation is better… zincr&#x2F;zrank&#x2F;zrevrange is good, but you’ll have to hold all data in memory (and receive it in one large response) and logN anyway, might as well do it simply with a set with a dynamic prefix and scan while building the output data structure as you go.<p>- do your API endpoints return JSON?<p>- error handling around points of failure like redis<p>— your app goes down if the connection is flaky right?<p>- zrevrange is deprecated now btw<p>Hard to tell for far they wanted you to go, but asking might have made sense… some nice-to-haves:<p>- healthz endpoints?<p>- metrics?<p>- tracing?<p>- error reporting (ex. Sentry)