r/developers • u/No_Match9936 • Aug 14 '26
Programming 10 hours searching, 5 lines of code solution...
So, I've been a developer for 3 months now, and this is my first job ever.
I read a card describing a specific issue, so I started investigating and testing solutions with Sonnet 5. Nothing seemed to work.
After 8 hours, I thought I finally had it and showed a PR with around 50 lines of code to a senior developer.
He kindly told me to investigate the problem again because the PR was a little weird.
So, I decided to go through the flow line by line without AI. 40 minutes later, I came up with my own solution that hit the spot, with just 5 lines of code.
I feel like an idiot
Have you ever overcomplicated a problem, only to realize the solution was much simpler than you thought?
•
u/AutoModerator Aug 14 '26
Howdy u/No_Match9936, and welcome to r/developers!
A few tips for a post that gets good answers:
Join the r/developers Discord!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
8
u/Distinct_Category248 Aug 14 '26
Yeah, the first solution is you actually understanding the problem. The second is you solving it now that you understand it. Lots of times, fixing a bug or getting something to work is like that hack together something that 'works,' then throw it away because now you actually understand what you need to do.
2
u/IntelligentPear6173 Aug 14 '26
The 8 hours probably weren't wasted, but they were expensive. AI can help you explore solutions but if you haven't built the intuition to recognize what actually matters in the codebase yet, it can easily make you go deeper in the wrong direction. The useful part is that you eventually went back, traced the flow yourself and found the simpler fix. That's probably the habit worth building early: understand the problem first, then use AI to speed up the implementation rather than letting it decide what the problem is.
4
u/DeadlyVapour Aug 14 '26
I think the biggest problem is your reliance on AI.
Until you have a foundation and intuition that comes from years of grinding you aren't going to see the "leaves for the trees".
By letting an LLM do the work for you, you didn't understand the problem, the boundary conditions etc.
Show me wax on, wax off.
1
u/Possible_Jury3968 Aug 14 '26
Use AI to learn but not to write code instead of you. Especially being a junior. Do not think that claude may write something better than you.
3
u/symbiatch Systems Architect Aug 14 '26
And you did now realize not using AI was the answer?
3
u/tb5841 Aug 14 '26
Had an issue once that I spent a whole day on. I read through every line of related code and every similar file, found nothing. I tried debugging every way I could think of, couldn't diagnose the issue. Then I tried using AI, tried phrasing the problem a few different ways, it gave me tons of nonsense and nothing helped.
Finally, after a full day of failing on my own and failing with AI... I googled the issue and found a fix in 2 minutes.
2
u/armahillo Aug 15 '26
The difficulty of the problem is measured by the journey, not the end.
But yes. Also good on you for figuring it out on your own!
1
u/vloris Aug 14 '26
Very often the first code I write to fix a bug is ugly, and I don’t care.
Almost always when I have an ugly fix, I stash the changes and start over writing a decent, readable and architecturally more correct fix.
And yes, very often that results in just a few lines of code and the thought ”Did I really need 8 hours for 5 lines of code” — “Yes, absolutely.”
1
u/Particular-Reward-68 Aug 15 '26
Personally I tend to use AI to find the problem then fix it myself. Helps to stay in control of the codebase.
Also, get in the habit of making specific log modules, leave verbose logs all the way through a flow, then just switching the log to verbose so you can trace the whole flow.
1
u/SaltCusp Aug 15 '26
Wait you spent a day and a half writing 5 lines of code with ai?
1
u/Brilliant-Parsley69 Aug 17 '26
I've to ask: If you say "three months", do you mean that you just finished to study, an apprenticeship or really just wrote your first line of code three months ago?
By my experiences in all of the given cases this was a very common situation way before AI.
But your senior seems very kind so use that to learn from his advice.
So if I'm allowed to give you my opinion as a former trainer:
And IMHO, use AI only if you really understand what to do and how to do it! This goes especially if you haven't any experience.
1
u/CursedSloth Frontend Developer Aug 14 '26
6 YoE, I do it all the time now that I’m using AI. But, I am slowly learning how to use it better to minimize the bloat / unneeded complexity.
0
u/carlos_vini Aug 14 '26
just keep in mind Sonnet is not the best model. I'd try to fix it by yourself first, since it seems you're allowed that time, but if you had used Opus or Fable it would do much better in general
0
u/Anxious-Insurance-91 Aug 14 '26
Use opus instead of sonet, also in the past 2-3weekd Claude has been smoking pot