Here's an example of a recent one:
https://github.com/anonanonme/takehome-sample
takehome instructions: https://github.com/anonanonme/takehome-sample/blob/master/README.md
takehome readme: https://github.com/anonanonme/takehome-sample/blob/master/documentation.md
Can anyone provide some legit criticism? Or is the person evaluating this just being unreasonable?
The chance you will get ghosted? Very high.
The four hours could be better spent.. you are more likely to get a response by cold emailing other companies.
Send them open source work and ask them to judge your ability/style based on that. If they are not interested they were never going to judge your submission based om your style / abilities and the four (8) hours can be better spent.
If they do not value your time while you are interviewing, there is zero reason to believe they will respect it once you are hired.
This might seem superficial but as a super senior staff, I'd expect that you mentor your junior coworkers in how to build large yet maintainable projects. One important aspect is readability and consistent style. That's why black becomes more and more used even though some of its rules are fugly.
Second not so easy change: I find "The code was also not fully organized for testing" - this actually hints at you either not writing a lot of tests in your day to day life or being very inefficient in producing tested code. You also could have at least included one sample test.
" # returns the path and current count that was just made.
return {"path": path, "count": int(data[0])}"
also maybe extract variables and name them better like:
"pipeline_execution_result = await pipeline.execute()
count = int(pipeline_execution_result[0])"
same here:
return [{"path": path.decode('utf-8'), "count": count} for path, count in response]
what's in settings.py should probably be in an env fileoverall: variables and methods name could be clearer, use good names instead of bad comments, extract variables, don't define methods inside of methods
it's definitely not BAD code, but I'd expect a guy with 10YoE to do better
- requirements.txt is the standard for specifying deps, right?
- making a README explaining the project might be good (I see you have this, but maybe switch documentation.md to README.md)
- tests?
- building the flask application via a function is a bit more testable
- reading settings from ENV is preferred (12 factor apps)
- output not sanitized for /test endpoint
- generator in util could have been pulled out probably? It’s created every time
- 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
- did you have to define your own Json type? Is that complete? Where’s null?
- url generate function should probably template hostname — that’s more important than host, most of the time for running in different environments
- trailing slashes matter in flask, evidently, and every request without one gets redirected (test suite would have caught this)
- on the usage of redis, I wonder if scanning + in-memory aggregation is better… zincr/zrank/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.
- do your API endpoints return JSON?
- error handling around points of failure like redis
— your app goes down if the connection is flaky right?
- zrevrange is deprecated now btw
Hard to tell for far they wanted you to go, but asking might have made sense… some nice-to-haves:
- healthz endpoints?
- metrics?
- tracing?
- error reporting (ex. Sentry)
You should learn to accept the fact that you will not get an honest review. If you choose to enter in to a take home test go in to it with that understanding.
The interview process is a chance for them to review you, but also for you to review them. Make sure the process is equitable. If they ask for too much you owe it to yourself to push back. Ultimately they will respect you more if you stand up for yourself. It shows you have healthy boundaries and will protect their interests when you work for them.
I interviewed for a company in May that gave me a takehome that was very vague and probably would have taken my entire weekend to do it. So I declined and moved on.
My rule of thumb though is to spend no more than 2-3 hours on a takehome challenge. If you think it will take any longer, don't do it. And lack of any feedback from the company pass or fail is ridiculous to me.
As for your submission it LGTM. I'd bring you in and probably ask about how you'd want to improve it if you had more time, expecting the usual best practices and scalability things. I'm not sure your Python experience, but given the context of the problem space, I'd ask why you wouldn't consider other approaches like adding the url metric logic in a decorator or some other modularization that could be reused to "performance test" future API calls. I'd ask about your submission's lack of tests (getting at unit tests here) and how you could refactor your solution to facilitate better test coverage if you had more time. Deepdive about the tradeoffs of using Python coroutines as opposed to other concurrency methods.
Unfortunately there's always going to be a desperate developer out there who will spend every waking second overengineering a solution that will set a high standard for everyone else to be compared against.
Wishing you the best of luck!
That's not going to return the right value most of the time - for instance, in the example from the docs at https://redis.io/docs/data-types/sorted-sets/ has this:
zrank hackers "Anita Borg" is 4
but "Anita Borg"'s score is 1949. The operation you likely wanted was "zscore".It would be straightforward to check this, either manually or in an automated test - simulate hitting "/api/abc/" once and "/api/xyz/" three times. The result of 3 of the 4 requests will be wrong:
for /api/abc/: will have count=0 because /api/abc/ is the only entry in the sorted set
first one for /api/xyz/ will have count=1 because /api/abc/ sorts before /api/xyz/ and they both have a score of 1
second one for /api/xyz/ will have count=1 because /api/xyz/ has a higher score than /api/abc/
third one for /api/xyz/ will have count=1 because that's still true
Now, it's true that the assignment didn't say anything about what the service should return: you might have done better on this assignment by returning HTTP 204 and an empty body.IMO when a "super senior / staff engineer" chooses to write code, they should write WORKING CODE and verify that that's true.
That first part over there blew up your whole effort. No matter how good as an engineer you are, if you don't provide any unit tests, most often it's an automatic rejection.
Also why did you put that self-criticism section anyway? You don't owe them anything nor should they owe you as well.
As a final thought when you are doing the effort to apply to work for someone else then they can reject you for pretty much anything so don't sweat it too much.
I understand. It's disheartening. But it's not you, it's them.
Take-home exam is bullshit in my opinion. I've done total of 3 in my career, and nothing came out of it. Zero feedback other than you are not what we are looking for. I've long since declined about any take home exams. I rather leetcode than take home because leetcode can scale, while take home is just unpaid work.
Maybe a dumb question, but did you follow up and ask for feedback? Sometimes people just don't think to provide feedback, but they would if prompted to.
Other than that, I think the code is completely fine. Stylistically I can see people having non-consequential nit-picks based on what they like but I think it wouldn't be an issue to get weeded out by.
Code review: For a senior dev, I would expect tests even if I didn't ask for them explicitly. I'm also surprised to see that the functions are in a generic utils instead of better named files.
The reality: 1. other people are spending more time on these takehomes. 2. Being more senior means that there are higher expectations. 3. The takehomes are typically a qualitative assessment
No need to waste another 4 hours per company (a ridiculously large task).