I recently started working as a developer for a start up. I have a little more than two years of programming experience (college + internships), and at this new job they asked me to do some feature enhancements and the entire code base is a mess. I am pointing out a few technical difficulties I face as a context to my question. Any reasonable developer must be able to agree on a few of these being annoying.
- 90% of the functions are inside their own "try...except Exception" blocks (makes debugging a PITA)
- Zero comments or docstrings (no feature documentations either; just word of mouth on the so called "Code Walkthrough")
- Non-idiomatic code
- Query formatted using string concatenation (not sure how well the inputs are sanitized)
- One single dictionary used as input and output across a variety of functions, mutated everywhere.
When new features or bugs are assigned, I find it extremely difficult to debug this as virtually all errors are suppressed and printed as logs; as a result I end up spending more time to deliver what is expected of me. The program never breaks. Any and all exceptions are captured and silenced as logs. So there isn't any way to find where an error happens without getting messy (using "traceback" calls, etc.) which is not really needed if the exceptions were handled judiciously.
What I have tried
I tried asking for help internally, obviously. The response is there, but most of the time it is something along the lines of "Debug and find the difference", but debugging isn't really helpful as I have explained earlier.
I spoke to my manager, and his response was that I can rewrite this codebase given some time, but I deliver what is expected before I start the rewrite, which again comes to the point: I can not figure out this spaghetti code. If I can I wouldn't even have to rewrite.
Why is this a problem?
I am not able to complete things on time, so I am not performing as much as I want to. This will affect my growth, and I may get fired for not being punctual. I am beginning to hate my job as a result of this, not being able to write code, because I do not want to spend time debugging a mess.
Other Information
I am in no way a veteran developer. I spend some of my time answering (also asking) questions on Stack Overflow and I have a fair bit of an idea on what good and bad code looks like. I have zero experience as a professional developer other than a few months (internships aside), so I do not know if this is a normal occurrence.
Do let me know if you need any additional information.
Update
Having taken into account the responses I have received here, I went ahead and spoke to the people who wrote this and their latest response is (non-verbatim)
"Change based on current needs. You are now the owner of this code base. Do what you want to make it work."
This pretty much feels like they are relieved it is not their (problem) anymore.
My manager did agree on letting me rewrite the code, but only after I complete my current backlog, which I guess is a sensible request from his end.