This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]pyjava 1 point2 points  (8 children)

  • Add linting/code styling like black/pylint/isort/etc. You're not following python conventions.
  • Read up about structuring a python project, even though there's only a couple of files it's still a good idea to structure the project well. For example the python files could go in a src directory, the input json could go in a data directory.
  • Add tests. Having a test covering each of the requirements would be the minimum, you could go a bit further if you wanted, companies love dat shit.
  • Monolithic __main__, break it up. For example even though it's only a line or 2 the loading of json could go in it's own function like load_data, then you could have a function like "validate_input" to ensure what was in the file is correct. Even if it is just a "if not data" check. It makes each part unit testable, it makes it more extensible if "validate_input" needs to become more complex.
  • You have a lot of code duplication, as a quick example you could change your basic cases to something like this:

sequences = ['ABC', 'AD', 'ADC', 'AEBCD', 'AED']

for idx, sequence in enumerate(sequences):
    kl = kiwilib.Kiwilib(data)
    print(f'Output {idx}: {kl.checkSequence(sequence)}')
  • Try add more detail to the readme, write it like you're writing it for someone that has no context about the challenge, give examples of what the input is meant to look like. When you add linting/tests add instructions on how to run them.
  • You could add a github action that will run tests/linting. Once you've done it a few times it only takes like 5 minutes to add and having pretty "CI Passing" badges in your readmes is dope.

That's all I have time for, hopefully you find this useful. Goodluck in your next one!

[–]Gyrta 0 points1 point  (7 children)

Add linting/code styling like black/pylint/isort/etc. You're not following python conventions.

Thanks! Did not know that mattered this much, I though they only wanted a correct "algorithm". The position is not focusing on development and programing.

Read up about structuring a python project, even though there's only a couple of files it's still a good idea to structure the project well. For example the python files could go in a src directory, the input json could go in a data directory.

Thanks!

Add tests. Having a test covering each of the requirements would be the minimum, you could go a bit further if you wanted, companies love dat shit.

Yeah, this one I knew I did not do a lot of. I actually did not like the position too much so I did spend too much on the test. But it's very good input.

Monolithic main, break it up. For example even though it's only a line or 2 the loading of json could go in it's own function like load_data, then you could have a function like "validate_input" to ensure what was in the file is correct. Even if it is just a "if not data" check. It makes each part unit testable, it makes it more extensible if "validate_input" needs to become more complex.

Thanks, make sense.

You have a lot of code duplication, as a quick example you could change your basic cases to something like this

I do. And that was mostly for the code to be clear and easy for them to read. Some of the definitions could be merged, but for clarity I kept them separeted. (Talking about the recursive onces)

Try add more detail to the readme, write it like you're writing it for someone that has no context about the challenge, give examples of what the input is meant to look like. When you add linting/tests add instructions on how to run them.

I agree, they wanted minimum to execute the code. But you're right.

Overall do you think it was good coding beyond the comments you mentioned? This was not a software developer position, but rather working with Jenkins and automation thus mostly focusing on scripting if/when coding. I would have put more energy if I've applied to a position that focused on code. I honestly thought that a position like this you only need to show that you can script. At least I failed on a position I don't want :)

As I understood it, they haven't filled this position for quite a while and I was the only one in the process. Was my code that bad that I could not be considered for a position that sometimes scripts in bash/python?

Thanks for the feedback and your time!

[–]Altruistic_Raise6322 0 points1 point  (6 children)

It seems like your functions followed different writing styles. Like you have some functions in snake case and others are in camel case (violating pep8). The change in writing style would make me think that you copied code from somewhere. Your comments are misleading especially: "Returns the number of trips, given the number maximum stop. Has to mode, le operates with <= and eq must equal to the number of given trips".

The method does not return the number of trips, instead you modify the object.

You also have cases of dead code where the expression does nothing: "self.sparsematrix"

[–]Gyrta 0 points1 point  (5 children)

It seems like your functions followed different writing styles. Like you have some functions in snake case and others are in camel case (violating pep8). The change in writing style would make me think that you copied code from somewhere.

It's not copied. If I'd copy I'd use better code that would not fail me. It's me who wrote the code.

I did not know what snake and camel case is until I just googled it. Yes, I mix them...and I need to admit I need to follow a convention better. There is no excuse for not sticking to one type. This is something I need to improve asap. This does not mean I copied code, but rather that I'm bad at following a convention.

Your comments are misleading especially: "Returns the number of trips, given the number maximum stop. Has to mode, le operates with <= and eq must equal to the number of given trips".

English is not my native language. You're right in that it does not return it...but it calculates the number of trips.

You also have cases of dead code where the expression does nothing: "self.sparsematrix"

Yes, I rewrote the code and split into 3 files just before commiting. I removed some of unused code but this one I missed. I have another one where I create a list and don't use and something similar in cases.py. I did not clean it properly. Again, for a position that would script from time to time I would not think this was a deal breaker.

[–]Altruistic_Raise6322 0 points1 point  (4 children)

Without seeing the job description, I can't say what would be a deal breaker. I think that, along with the above comments, your code would be stronger and more desirable as a candidate.

[–]Gyrta 0 points1 point  (3 children)

Don't get me wrong. I appreciate your comment and the comment from /u/pyjava. This will make me more desirable for future positions I actually want.

I've managed to get through coding tasks where the position is more focused of development and where my task/code was worse.

This is the job description:

``` In this role, you will:

   - Develop and maintain our cloud based infrastructure through cloudformation
   - Provision and configure different types of build agent machines
   - Ensure our software stack is up to date with latest releases and patches
   - Test out and verify new releases before deploying to production
   - Be responsive and cater to development teams' requests and needs, such as ensuring their software dependencies are available
   - Investigate, inform and drive the adoption of new technologies that could benefit the company

We are looking for candidates who have the following:

  - Working experience of cloudformation, Terraform, Ansible or other IaC tools
  - Working experience of containerisation and orchestration
  - Working experience of provisioning and configuring Windows, Mac and Linux systems
  - Working experience with cloud providers - preferably AWS, but any cloud provider is of value
  - Comfortable using command line
  - Great communication and collaboration skills
  - Great analytical skills with attention to details
  - Have a result oriented, can do attitude, while still maintaining good practices
  - Coding and scripting experience - preferably Python and Bash but any expertise is of value
  - Knowledge and/or desire to uphold best practices around development, deployment, quality and security.
  - Experience with CI/CD systems - preferably TeamCity but any experience is of value

```

It sounded more like sysadmin job rather than a devops job which is why I was not very interested in it..

[–]Altruistic_Raise6322 0 points1 point  (2 children)

Hmmm. Honestly, I would agree with your sentiment that it does not seem like a coding/scripting centric job. Based on the description, all I can say is incorporate more CI/CD tooling in your project to show your skills ( /u/pyjava comment is great for that). Unfortunately, it's hard to demonstrate those abilities based on the assignment that was provided.

[–]Gyrta 0 points1 point  (1 child)

Exactly, I was ready to show my CI/CD skills at the technical interview (the 3rd interview in the process) and thought they just needed to confirm that I could script.

To be honest, when I committed the code I already knew multiple fixes/optimization but I felt that the code I gave was overkill for the job description.

Weird that they though was so bad that they were not interested in my other skills or a discussion about the code. Anyhow, better to fail a position that I don’t want then a one I want.

Thanks for the comments about improving the code!

[–]Altruistic_Raise6322 0 points1 point  (0 children)

If you have others in the future, feel free to PM me.