4 ms·
The wildly mixing is because sometimes I want to use quotes within quotes: ' "a string" '. I default to this " ". But I switch around when needed. This is stan
by formulathree 3y ago
The wildly mixing is because sometimes I want to use quotes within quotes: ' "a string" '.
I default to this " ". But I switch around when needed. This is standard python methodology. Anyway..
This kind of thing doesn't matter. It's pure aesthetic, it's ocd stuff in my opinion. Whether you use " or ' has zero consequence to readability, maintainability, safety, and performance. Literally zero. Your code can grow to a billion lines this still doesn't matter. This is actually an ocd instinct that you should try to separate from your rational thinking. The inconsistent quotes * feel * wrong, but rationally they have zero consequence on any metric. It's just a feeling not an actuality.
Less experienced programmers often get caught up in stylistic issues but fail to realize when style is actually of zero rational consequence. Not all styles have zero consequence but some of it does.
>The code was also not fully organized for testing
Only literally 2 functions are unit testable here.
One of them is so basic that it's not even worth testing.
All unit testable functions are segregated away from IO so from a fundamental standpoint it's pretty much unit testable to the full extent.
The reason why I wrote that it's not is because the random path generation function has a bit of a flaw. It uses random number generation, so it can't be unit tested. I can't predict the output in the assert because it's random.
That's it. The amount of logic amenable to testing is so trivial and little it's not worth it here. I could segregate the random number out of the path generation function deterministic and testable but I made a judgement call here. It's a take-home and segregating the code like that leads to an API for the function call that's less intuitive. The function would need random seeds as input parameters.
Ideally, yes I shoulda done that. But this is a valid shortcut. I would say though, the majority of people aren't able to even realize how random number generation effects unit testability.
The unit testing thing is valid. Everyone mentioned that even though what's testable is so little. I'll just have to cater to the current dogma of the programming world.
- iamflimflam1 3y agoOne thing to bear in mind is that people reviewing applicants are looking for a reason to reject applicants. It used to be different when it was hard to find people. We would be looking for excuses to accept people - e.g. the code is a bit rough, but maybe they didn’t put too much effort into the take home - let’s get them in for an interview just in case… Now with so many applicants it will be much more a case of who can we reject so we don’t spend all our time interviewing… Also, don’t forget, the people reviewing your code may not be the senior engineers, bend with the wind, run your code through a standard formatted so that it will match expectations. Do the unit tests even if you think it’s pointless. Play the game.
- formulathree 3y agoSolid tip. Will follow. Thanks.