Ask HN: I've realized I'm a bad software engineer and I'm over 30, what's next?

320 points by mxmpawn ↗ HN
Hi folks, I've been working as a software engineer for about 10 years but always in small companies with few or none programmers or as a freelancer. I've been able to always have work on my desk because I'm always moving and talking with people in the industry but some months ago I decided to go to work on a proper medium software company.

I'd been assigned a medium complexity task and I've failed to accomplish it, the code was all filled with hardcoded values, wrong structure, difficult to debug bugs and similar things.

I've realized I'm not a senior software engineer as I thought and now I don't know what to do next. If you read my resume it'll seem I am a senior but I don't really know where to place me in the "experience" spectrum. I've always managed to solve the problems in front of me but in a "hacky way" and now the issue was totally revealed to me.

I'm thinking about looking for semi senior roles but I'm afraid it'll look weird for the company interviewing me to hire a semi senior with +10 years of experience.

I've also thought about transitioning to a PM role but I'm not sure if I can be a PM if I'm not able to code things the right way myself.

A third option would be to take a break from work and try to learn to write good code but I'm not sure it's possible without working on a company with other people.

As you very probably see, I'm quite lost right now so I'd be very grateful if you can advise me what I could do next with my career.

274 comments

[ 3.2 ms ] story [ 283 ms ] thread
Project management is potentially a good option. Before you give up though I think you are potentially being too hard on yourself. Projects fail (a lot of them).

I'm guessing that potentially you brought your smaller problem solving skills to a bigger task than you are accustomed to. If that is true it might simply be the case that if you were to have broken the large/medium task into a bunch of small tasks then you would have been a smashing success.

>I'm not sure if I can be a PM if I'm not able to code things the right way myself.

You don't need to know how to code the solution to be a good PM, it's a different set of skills.

QA - writing testcases, automated regression tests is also a possible path. Lots of companies want QA engineers that can write automated regresion tests (selenium etc)

> "QA - writing testcases, automated regression tests is also a possible path."

No. QA automation code is still code. If a person can't write solid code, they're not going to succeed in QA doing automation either.

Depends on the path right? If its backend/systems related yes it may require you to write actual code and the person may still feel out of his depth. But there are areas in front-end for example where writing testcafe/cypress stuff is more like "go here, click on the thing, then click here", which doesn't need much more than basic coding ability.
This statement is far too definitive given the amount of info OP provided.
It is code, and sometimes bigger and more complex than the product itself, but OTOH it is usually easier to get away with mediocre code level like I do...
What was this medium complexity task? I wouldn't discredit your ability entirely on the basis of one project.
Why would you need to be a great coder to be a Product Manager? The challenge will be proving your product chops. Being a bad coder is quite good enough technically to be a good PM.
You know there are issues, so that is a good thing.

Hang tight. You can clearly learn to fix these issues and become better at building/architecting solutions. Spend some time reviewing projects on github and see how others have tackled the issues you are struggling with. Practice by creating your own projects. They don't need to be complete but will allow you to try different strategies for structure, hard coded values etc.

You could become a PM if you really wanted to... the PM's I work with have zero coding experience. This would be difficult for me as I don't see a PM as being creative and I like to build things.

You can do this!

(comment deleted)
> You know there are issues, so that is a good thing.

That was my thought too. Programming is kind of like American Idol--a lot of programmers don't know how bad they are. The submitter said they failed to accomplish a medium complexity task, but it's not clear what this means: got stuck and gave up; missed a deadline; finished, but with poor quality?

From one of the submitter's thirty previous Ask HN submissions, I see experience working with a variety of tools, including machine learning. With batteries-included languages and powerful libraries, you can get pretty far in Tinkertoy mode, assembling the pieces of a solution. When you're faced with a task that demands more programming skill, it can be an adjustment.

If you have a passion for software development, self awareness, and a desire to improve, I think you'll be okay.

Don't beat yourself up - if you've gone 10 years without failing at a task then you did a lot better than I did.

At least you recognise where the problems were - why not try and fix those problems in your next bit of work?

Also sometimes the best cure is more practice. You need to replace one set of habits with another.

Start small. Like how to do a flavor of integration testing. Perhaps take some online courses? There is also a huge amount of YT vids out there.

One thing you may need to do is go back to the basics. Also make a task of it. Have a set time where you for 1 hour a day 'learn new coding skills'. Such as refactoring, code style and when and why to us it. Also find a project that you are interested in and follow it. I learn quite a bit doing this I have a dozen or so I follow and watch the pull requests to see interesting uses of code and style, even if I disagree with them. I do not contribute to them but I follow the style and commits they do. You can learn a lot by doing your own code reviews of other peoples code. Seeing how other do it and work on that.

Being a PM doesn't mean you have to code. In fact most PMs can't really.

Another option is to progress to team leadership. That role is more about listening to your team's good ideas and having good enough instincts to empower the good idea rather than you being a rock star developer yourself.

Alternatively you can just keep doing what you're doing but use this awareness you already have to continually up your game. Even the best of us are constantly learning.

  > try to learn to write good code
  > not sure it's possible without working on a company with other people
Sounds like you are in the perfect place to learn how to write better code right now. Use the feedback you're getting to improve and get to the level you feel you should be at. You probably aren't as far away as you think.
1. The quality of your work as a developer has no bearing on the quality of your work as a PM. It's a different skillset altogether and you may or may not have it but your experience as a developer is only an asset when applying to be a PM. Whether you decide to go in that direction is a personal decision, but you should do it because you're interested in that kind of work, not because you think that your software work is subpar.

2. You don't need to take a break. You can incrementally improve on the things that you know that you're doing wrong at your current job and improve while you're still there. Since you're already aware of a bunch of them, it shouldn't be too difficult to improve on them over time.

3. You may or may not be too self-critical. The way to find out is to prepare for interviews for a bit and then try out a few. Don't disqualify yourself, let other people do that.

Adding on to this, the kind of "hacky" code you produced while freelancing or working with small companies may have been entirely sufficient for that kind of problem. Now that you're a programmer in a much larger institution the way you code will need to change. It's going to feel very foreign to you for the first few months. The processes and patterns are almost entirely different and it's okay to take a lot of time to adjust.
A long time ago, I described what I did as a programmer, and my friend said "Oh, so you get paid to learn?" I thought about it, and agreed. Part of programming is learning.

Sounds like you've got a great opportunity to learn what you don't yet know: you already have a list of things you know you need to work on, a codebase, and a job. Do you think one or more of your co-workers would be willing to give you feedback? Would you be willing to take time (maybe extra time, 'off the clock') to practice?

If, e.g., hard-coding is where you're at, maybe something like working your way through 'Code Complete' would be of help, but I would pair the reading with doing, as close to the company's codebase and personnel as makes sense.

I've heard tell of people who asked to be shifted to a lower-level position so they could work at the level they were comfortable with.

Do you want to be a software developer still? (That isn't clear from your summary). If so, you need to learn better habits.

I suggest picking up a book on the subject, like "Code Complete" (at Amazon or wherever books are sold. Pretty sure it's at the library if you'd rather read it for free -- but it'll do better as a reference book on your desk for a few years). Use it and start practicing with personal projects hosted out of Github.

I also suggest using a daily practice like a code kata: http://codekata.com/

Thirding Code Complete (another top-level recommended it). I read that book very early on, and I credit it with my current ability to write clean code.

Another good one is The Pragmatic Programmer.

Lastly, this wiki is a gold mine of wisdom from hardened devs: http://wiki.c2.com/?StartingPoints

I really recommend you read lots and lots of those pages.

To your last point, it doesn't sound like algorithmic and practice problems are really OP's issue, as they suggested they can solve almost any problem given but do so in a way they now feel is amateur or hack-ish.

In a similar line of thinking to your Code Complete suggestion, a book like Architecture of Open Source Applications[1] might also be a good fit.

1 - http://aosabook.org/en/index.html

About Code Katas -- agreed. They can be used from simply an algorithmic learning viewpoint. They can also be used like an athlete uses weightlifting: Over time, certain motions become second nature.

When you're talking about such a mentally heavy discipline, it helps to have certain behaviors happen effortlessly. You might otherwise learn these things over time with a large team, but I think certain brains needs this kind of practice.

Just like there are different ways of learning any subject, there are different ways of maintaining proficiency (IMHO).

Yep, read these books and apply the ideas directly to your work as you go: Code Complete (which IMO is more detailed and explanatory than Clean Code) then Clean Architecture.
Well do you enjoy programming? If so I would say stick it out, you'll get it eventually
most bad engineers I've experienced have no idea that they're even bad, in the sense they can't identify what's wrong with their code or even be aware of hacky patterns.

that you can self-critique would indicate you potentially have a great future of leveling-up ahead of you.

Those were my thoughts too, recognizing bad code is a quality of good programmers.

The big question I would have for OP is 'do you want to do this anymore?'. I personally don't, I've loved development for 20 years but it's just not for me anymore, at least not for a day job. In that respect I'm in the same boat as OP, "What do I do now ?"

Keep at it. Why would you quit just because you've realized that you've done some things the wrong way?

I get the feeling that quite a few engineers come at it from your kind of side. Only one dev, stuff needs to be done, it gets done with a lot of heaving and sweating.

Now you're in a larger place, there should be some breathing room. Find out how people do things:

- Maybe read the GoF patterns book to get some cookie-cutter solutions to common problems.

- A lot of the simpler DS&A learnings can be practiced with introductory leetcode problems. Don't sweat it too much, I'm sure there are a lot unuseful brainteasers there too.

- Get used to all the tooling around the code. Git, CI/CD. Build scripts.

I’m a product manager partly because I’m not a great coder. Other engineers are faster and better, so I wanted to add value by helping figure out what they should actually be building based on user needs. It has its up and downs but you can still do well without being the most proficient coder.
I’m not sure I really follow - what’s an example of a project you solved successfully before in “hacky” way?

When you get knocked off your horse you either give up or stand up. Maybe you are feeling it really hurt. But you’ve invested a lot in this industry and career, so don’t give up after your first real challenge. Get the fuck up and figure out how to deliver successfully on this project 1) what parts can you solve? Do those 2) for the parts you can’t, how can you? How do you break it down into specific problems? In this case, maybe one piece is centralizing hard coded variables into one place. What’s the best way to do that? Once you have specific questions, you’ll be able to find specific answers. Start working through them. If you can’t find self help, what about some colleagues you’ve amassed over 10 years? Worst case ask your manager, at some point you can’t bullshit things anymore, but give it an honest try first and outline what you were able to do and which problem(s) you are stuck on and what you tried already. Your manager will appreciate your ownership and your concrete ask for help.

Context: I made a career change and got fired from my first job 5 months in. It was devastating, but I got back up and got another job. I got a second job, went ok until i got a manager who said I was focused on the wrong things. After a year he kept complaining about it and in the end gave me a bad performance review. It left me shaken. I got back up and got a third job, where I am today, and I am crushing it. I still doubt myself, I still have wounds from before, and I even have doubts sometimes if I could succeed elsewhere, but I keep getting better, and getting up when I’m knocked off.

Good luck

My company is starting to move away from custom software development for our clients in favor of leveraging and configuring commercial software packages and services. You might need to create a python script or a make a few API calls, but most of the job is learning how to get the software to solve the client's business needs. Maybe you would enjoy that more? Maybe we could switch jobs. :)
I'd argue differently. Congrats for having the courage to recognize your problem.

The analogy that comes to mind is I've been playing basketball in my local town, and now I've gotten promoted to play in the big city. I now feel like a small fish in a big pond.

If you enjoy software engineering, I'd say, double down. Now that you're at the medium software company, seek mentorship and coaching from others.

In addition, there might be more homework (hitting the gym sort of), things you also have to do on your own.

It isn't going to feel good being humbled and I've been there myself. But if you think about the goal as "learning to get better" than "prove to others I am better", you'll have a better time walking through this challenge. This all comes from a person who is a PM.

So some tactical thoughts of possible advice: 1. Face the issues head on -> take all the negative feedback on the code and rework the medium complexity task 2. Learn to unlearn bad habits. Yes, it's harder, but it comes with practice. 3. Commit to maybe taking a course work online (maybe seek advice from others on what are good ones to address weaknesses you have)

Hope this helps.

BTW, you don't need to be able to code things the right way to be a PM. Coding is only one specific skill and not always necessary for a PM.

> Now that you're at the medium software company, seek mentorship and coaching from others.

Agreed. My abilities as a developer increased tremendously at one of my jobs, and I can attribute 90% of that to a single person at that company who mentored me and helped me grow. (Hi, René, you probably don't read this.)

You can read all the articles and books you want, but actively pairing with someone on tasks and getting personalized feedback has a much greater pay-off.

Totally agree with this. If you see someone who's better at something than you are, go up to them and ask if they are willing to spend some time with you working on a topic. You'd be surprised how many people would love to help out. Depending on the company they may even have decent learning/pairing programs for this.

Can share that experience as well, my first job there were 2 devs who were great programmers, highly educated. At every chance I tried to get as much knowledge from them as possible. They were happy to share and equally happy when they saw me improving.

Pairing, pairing, pairing, and more pairing.
This. Suggest and attend stand-ups. Treat them like professors' office hours. Encourage and nurture people who are very good to give you things you can do, maybe with some help, but which are real tasks that are useful in the end.
interesting... I have never been in an environment where pair-programming was practised..

makes me think how much I could have improved...

I don't think pair programming should be done for every line of code written, but it's a really good way to transfer knowledge and mentor folks.
Also try to identify on three levels : how is your understanding of structure, how is your understanding on the functional level and how is the understanding on the syntax level (in the context of the company you are working for)
Do you have tips or things you did to get more effective mentor ship? My company has assigned me a mentor but I always thing I am not using it to the fullest extent.

The `only` time I speak with my mentor is when I get stuck with a bug and need help getting started. I have asked frequently on how to do better code reviews or how did she get so good at programming - she always said it takes time. To get better with the code base - it takes time.

It is true that it takes time. And to some extent just observing others’ work is a lot of the benefit of time. But if you’re looking for your mentor to be more involved and she’s not engaging that, try asking more specific questions. Like “oh this bit of code is interesting and it wouldn’t occur to me to do it that way, what was your reasoning/thought process? Where can I learn more about this approach?”

You can also find others on your team whose work you admire and ask them similar questions. Lots of people are happy to talk about their work when asked.

Ideally, this person should be on your team, or otherwise someone you work with regularly. But asking your mentor when you run into bugs is a good start! Pairing on those helps.

I guess in terms of concrete advice:

1. Put time on a calendar to work with this person; don't just slack back and forth about some specific issue for a bit.

2. If you're looking to become a better programmer, actually pair with them - take turns driving and writing code. If she's doing the driving, it would help to hear out her rationale for what she's doing - probably even before she starts writing. If you're driving, try to do the same.

3. Ask for code reviews on as many of your pull requests as she can provide; this is going to be pretty workplace specific, and is going to depend on how much code you end up putting up for review and how much time she has. It's a good way to get async feedback.

And yeah, it takes time and practice.

Absolutely- getting a mentor who will make time for pair programming is invaluable. Early in my career as a self-taught dev (my degree was in a different area), I landed a job as an associate dev and was assigned a "mentor" who wouldn't give me the time of day. While I'm sure he was very busy, it was also very frustrating to be told every time I reached out: "Give me one sec, I've gotta finish something up, I'll message you when I'm done" only for them to ghost me for days even after I'd reach out again (I couldn't even drop by their desk since we were both remote devs). So I made different connections, got to know my other coworkers better, and found a person who wasn't just willing to mentor me and pair with me, but was excited about it and glad I would reach out! I learned more from him in a week than three months with my former "mentor".

Moral of the story: find someone who's happy to mentor you, willing to pair program, and wants to see you grow and succeed. I can't promise that you'll never feel like a fraud again, but I can promise that you'll feel more confident about the work you do. The sooner you can do this, the sooner you'll find your "muchness" and become "much more muchier" (to quote Tim Burton's adaptation of the Mad Hatter).

(comment deleted)
At my first company, in order to commit anything we had to get someone else on the team to sit down with us and we'd have to go over the diffs with them and walk them through the changes and why. Incredibly annoying, but a great way to learn. I still rewrite "if (!condition)" to "if (positive_condition)" to this day based one guy's feedback that negative logic is hard to read and reason about. It was also really humbling to not remember why I did things, so I'd have to prepare for the code review so I'd have something besides "um, I don't remember" to say.

I have also realized that there are some categories of problems that I really don't know how to solve well. So if I find myself struggling, I try to ask someone for ideas.

Totally agreed! My first thought on reading this was "this doesn't sound like a bad engineer, this sounds like an engineer with potential who's just been exposed to some good practices they hadn't encountered before."

Just set your mind to doing better and in as little as a year it'll be a different story.

Seriously. The bad engineers are the ones who accomplish nothing. I’d be concerned if he said the codebase was too hard for him make any significant changes.

About the only

I really appreciate your (and everyone) help. I've always knew I was behind some things but this real world experience slapped me in the face and now I'm trying to readjust.

My manager has already been aware of my lack of knowledge but I'll talk to him to know if they still want me there. If I keep my job I for sure will be asking for more help at the start of a new project.

Don't phrase the conversation like that. If you want to get better start there. Say you'd like to improve. That your first attempt here was rough and didn't work out but pairing up with a more experienced developer would give you some rails to keep you on the right path.

Either way. Keep your head up! Asking for help is the first step of an endless journey.

Crucially, don't start the discussion with "do you still want me" but with "I'm concerned that I might run into problems and wanted to discuss how we can avoid them" (or something like that).

Some managers would welcome this discussion. It shows that you are aware that you have limitations and that you would like to improve. If nothing else it helps keep the manager / company from placing you on a task that you wouldn't be able to complete successfully, which would ultimately hit their bottom line. If the company / management are sufficiently enlightened (such companies do exist), they may be able to find additional training or development opportunities to enhance your skills

FWIW, when I was a manager, I ALWAYS liked to find things out before they created a problem, when there was time to fix them, rather than in the middle of some critical task.

Good luck!

An even better starting point would be: "Hey Manager, I'm dissatisfied with the quality of my work on medium_complexity_project and want to make sure that I'm improving going forward. Here are the steps I'm taking (list steps) do you have any other suggestions on what I can do to improve here?"
Yes. In fact this is an interesting topic in its own right - how do you approach management when you have found a problem. In my experience, there is a sort of scale here, along the lines of:

* do nothing and keep quiet (almost always the wrong thing)

* say "help"

* say "I've found this specific problem, but I don't know what to do"

* say "I've found this specific problem, here are some options for fixing it - what do you think?"

* say ""I've found this specific problem, doing X will fix it - what do you think?"

This will vary a lot in practice and depending on circumstances, but I think as people increase in experience and knowledge they tend to approach management with solutions rather than just problems.

I agree with the sibling, but let me be more explicit: It's going to be hard to take time off, "level up" and then come back and get another job. Your best bet is to stay where you are and keep your job. The company has already invested in you and your manager has every incentive to help you improve rather than finding someone else.

You should go to you manager with a look to the future: come with some specific things you can do differently on the next project, and perhaps also some general 'goals' for improving your skill.

Then, most importantly, do what you said, and get better.

All this assumes you are happy and want to stay in engineering, if you do think you'll be happier doing something else, then by all means go ahead and do that.

> I'll talk to him to know if they still want me there.

Why would you think they don't want you there? This is not a helpful mindset to have. Here are the facts:

1) You passed the interview process.

2) They made you an offer.

3) They've continued to invest in you as an engineer by giving you feedback on your weak spots and where you can improve.

If you were really that far behind, they would have realized that in the hiring process and you would /not/ have received an offer. So let's start there. They definitely still want you there. That is why they hired you.

Second, let's talk about your "lack of knowledge," "being behind some things" and "real world experience" that "slapped [you] in the face" -- based on your mindset it looks like you are viewing this as a negative, or as proof of failure. Why is that the case?

You have 10 years of experience solving problems and getting paid for it. Now, you are solving different kinds of problems, so you're developing new muscles. It's expected on their end (and should be expected on yours) that there is some kind of /ramp up/. Talk about what ramp up means. Figure out your manager's expectations, and figure out what resources you have available to engage in ramp up. I guarantee you this, there's ramp up at any new medium-big company anywhere you go. There's tribal knowledge, spinning up on the industry vertical, etc -- all of this is incompressible, doesn't matter how good of an engineer your are.

If your manager is any good, they likely know about this and will appreciate you being aware of this problem as a logistics problem, not a moral problem. So think about it that way. Stop thinking about "whether they want you there" -- start thinking about "what blockers are in your way towards being productive" and start building a game plan with your manager. Worst case scenario, you're not able to accomplish it, but at least you gave it an effort and approached it the right way. That's a much more mature, proactive and effective approach than self-sabotaging yourself with feelings of inadequacy. I have a hunch that you won't fail if you do this, though. Just thinking about what you want to get accomplished and the nitty gritty details of how you get there and collaborating with your manager to get to a plan you're both happy with is /a lot/ of work -- once you've done that, if you work at a functional organization, the chances of you succeeding are very high!

Give yourself a pat on the back, while you're at it. Getting to a point where you're still being challenged after 10 years of experience is a /good/ thing! It reflects well on you and indicates your desire for growth. In all likelihood, your company saw this motivation in you and that's why they hired you. Look at the positives and opportunities here, and I'm sure you'll do amazing.

Good luck!

This is excellent advice. Take this to the heart, OP!
Make sure to really listen to what your manager says is the real problem. Sometimes in these situations we get flustered and jump to solving the wrong thing.

Maybe the real issue here isn't engineering ability but communication, that you didn't let anyone know you were having challenges, didn't set expectations about how the project was going.

There could be more or less going on here than just code quality, so like I said, really listen and ask questions and keep an open mind.

Also to reiterate what others are saying, don't go asking about being fired because it can come off like you want to leave or have given up. You've been humbled but it doesn't take away the good parts of what you do, you're a pragmatic, independent, get stuff out the door type adjusting to a larger team. This is normal growing pains.

id argue acquiring the skills and experience to be a good pm is on par with doing the same to become a better engineer. good pms have very different skills to software engineers - communication, communication, more communication. obviously software experience lends itself to managing software projects well so youre half way there, but i wouldnt underestimate it. it sounds to me, that if you recognize and have identified your weaknesses as an engjneer, youre also half way there to learning from them and getting better at it. the question is what do you enjoy and what will you be motivated to work at? do that.
Agreed with everyone else here that it's great that you've recognized areas of improvement for yourself. That's an important step, and in your position I would validate by chatting with your coworkers about it. Every time a colleague has asked me for my opinion on what they can improve upon or work on, I've always tried to give a straightforward critique; see if your colleagues independently bring up the same issues you think you have.

More generally, without having worked at a company that size yet, you can't be expected to come in with all the domain knowledge that dev team veterans have. Forget about titles like "senior" and what that means. Doing mostly-solo dev work for a long time is just a very different kind of work than writing code in a shared codebase with a team of coworkers of varying experience and skill levels. There will be aspects of maintainability and clarity which simply aren't a big concern in your solo projects but make a big difference when you have dozens or more developers working on the same code. Communication with coworkers becomes an important skill, collaborative project management etc. These are things which you can't just study and learn on your own, you ramp up on them over the course of working in that kind of environment. So yes, you might be pretty "junior" at some of these medium-sized-company aspects of software development, but that's fine and only to be expected at this stage. Keep at it, gain experience, level up by doing.

I don't think I've come across coursework that's intended to level up coding ability itself (i.e. good software engineering/design) rather than teaching basic knowledge things. I'm curious if anyone has come across anything of that nature.
For me this knowledge has always come from working on a variety of projects and seeing the effects of various architectural and design decisions on the result. Hard to imagine how such things could be taught otherwise, honestly.
I've come across the book Clean Code, which presumes to improve your craftsmanship. It has been improving craftsmanship for 12 years, and everyone has noticed of course.

Have you seen a shortage in people who dress up their preferences as facts? Maybe a better question is, who is producing the good software? Oh, and software ought to include malware (personal preference).

I don't know, but some of the people I consider to be really good software developers seem to reference "The Pragmatic Programmer" (perhaps even more than I realize do since I never read the book but have heard of "rubber duck debugging" & "DRY").

Generally, good software would have to be first defined and there's no universal definition. In most projects, I require it to have the following properties: * New developers find it easy to ramp up on * A handle on the defect rate (usually through adoption of best-practices like unit tests, fuzzers, automated tools, CI/CD, reproducible builds, etc). * "Fires" infrequently enough relative to team size that it's manageable to accomplish your business goals. * No "surprises" in adding new features/fix bugs where you didn't expect them. * Meets business requirements today & can meet them tomorrow.

However, in other cases, like prototyping, "good software" means, "explores the problem space as quickly & cheaply as possible without worrying about any of those other things". Some of those other things can be useful in accomplishing this, especially if you plan to pivot from prototyping to the above definition. If you don't use them effectively then throw away your prototype before productionizing & start from scratch.

(comment deleted)
>So some tactical thoughts of possible advice: 1. Face the issues head on -> take all the negative feedback on the code and rework the medium complexity task 2. Learn to unlearn bad habits. Yes, it's harder, but it comes with practice. 3. Commit to maybe taking a course work online (maybe seek advice from others on what are good ones to address weaknesses you have)

I'd also add to this: learn the why as well as the what. There are reasons why hardcoded values shouldn't be used, why OP's structure was bad, and so on. Learning why will help build those habits and make them stick.

Sounds to me like you just need to get better at refactoring. The first working code for a feature should be a mess because it's a learning exercise. The important thing is that you don't stop there and push to develop; refactor the initial working-but-messy code so that it becomes well structured and self documenting.
There's a thing called the imposter syndrome, which a lot of software engineers seem to experience through their career.

Also, one needs time to get used to a new project, new environment, new colleagues, etc.

In every domain, the more you learn, the less you feel knowing about, and that's a good sign.

In this industry, the ones that make it, are the ones that keep on going forward.

> I'd been assigned a medium complexity task and I've failed to accomplish it, the code was all filled with hardcoded values, wrong structure, difficult to debug bugs and similar things.

First thing is work out to spin this properly - you're seeing this as a failure with hindsight, but why is it really like that? E.g: were the requirements firmly defined or were you trying to hit a moving target? Were you trying to appease too many owners? Were you lazy? Lack support? The most valuable thing you can provide is some objective context around why things are the way they are. Theres also different "software engineers". Maybe its the company type that you dns fit in well with? Rule number one: cut yourself some slack like you've probably given the other folk involved in the project.

> I'm thinking about looking for semi senior roles but I'm afraid it'll look weird for the company interviewing me to hire a semi senior with +10 years of experience.

I think this is definitely an option if you want to go for it. There might be some companies who will discriminate against you, but they'll definitely be some who won't. The key will be explaining to them (and convincing them) that the reason you're not as senior as one might expect is because you were never exposed to good practices or challenged to do better, rather than because you tried and failed to learn how to do things better. It sounds like this is genuinely the case, so I imagine it wouldn't be too hard to find people you can convince.

However:

> If you read my resume it'll seem I am a senior but I don't really know where to place me in the "experience" spectrum

To me it very much sounds like "junior". So it really depends if you are prepared to suck it up and learn everything afresh with an open mind. If you are, then I'd certainly be willing to hire you for a junior position (if I were interviewing you).

With 10 years of experience, and ability to solve most problems given (even if it is hacky), I think junior is WAY too uncharitable.
I guess that depends on your perspective. From mine "not hacky" is absolutely required to move up from junior level. Hacky code is only useful if it's single-use or you can pass it off to a client and be done with it. In a bigger project (presumably what OP wants to be working on), hacky code is worse than no code at all.
Just to be clear, Product Management is not really a backup role for bad Software Engineers, unless that is what they were really good at instead of coding.

If you are bad at PM you can do mid-long term damage to a product which is not fixable like a problem in the code.

PM might have coding experience or not, it helps a lot if they do, but good PMs have a set of skills which are completely unrelated to being a software developer.

I don't see what the big deal is. Just go back and improve your code. Your team needs to be patient, nobody should be expected to push perfect code in every commit, even seniors.

If you can spot your own code smells, you're doing fine. Otherwise, read up on how to do so. I recommend Code Complete.

so, what's your actual programming experience? It sounds like you are just an IT guy from The IT Crowd.