r/learnprogramming • • Mar 07 '23

Is it normal as a junior programmer..

To spend hours looking over the same block of code, trying to sort out ‘why the f*ck isn’t this working!?’, only to realize the error you made is so monumentally, and stupidly obvious that it leaves you feeling like a completely useless moron? Lol

1.6k Upvotes

297 comments sorted by

View all comments

Show parent comments

494

u/captainAwesomePants Mar 07 '23

Can confirm. Been a senior dev for years. Have lost days to a single semicolon or using the wrong variable or something.

123

u/nedal8 Mar 07 '23

I spent HOURS the other day, trying to figure out why this websocket wasn't working right.. turns out I never deleted the old instance when I rescoped it.. So there were two with the same name.. Still not sure how that even ran.

22

u/toferdelachris Mar 08 '23

This sounds like a nightmare scenario. That’s when it boils down to “shut the whole damn thing down and restart”

What’s that? Production server? Did I stutter? Shut it all down!

136

u/chaoticbean14 Mar 07 '23

an IDE saves a ton of time in some of these cases...

Literally big red "You missed a semicolon" or "this variable isn't used", etc.

Once I started using tools like that? My time spent programming dropped through the floor. Of course, my time spent just thinking about the efficiency of the code - went through the roof.

But it's very rare I make those kinds of mistakes now - and when I do time wasted on them is extremely small.

123

u/[deleted] Mar 07 '23

an IDE saves a ton of time in some of these cases...

Sure, but vim puts hair on your chest

/s

15

u/IlliterateJedi Mar 08 '23

For partial chest hair, use IdeaVim

17

u/tukanoid Mar 08 '23

For 65% use helix

11

u/mandradon Mar 08 '23

That gives you a different kind of cred because it's written in RUST!

7

u/[deleted] Mar 08 '23

Blazingly fast

→ More replies (1)

3

u/tukanoid Mar 08 '23

Ya caught me, I'm a Rust enjoyer

41

u/UpbeatCheetah7710 Mar 08 '23

Who’s hair?

19

u/cthulhujr Mar 08 '23

I screamed

17

u/a_reply_to_a_post Mar 08 '23

i only vim on prod and copy random stack overflow copypastas into the shell like "hope this works!"

18

u/[deleted] Mar 08 '23

This guy devs

→ More replies (1)
→ More replies (3)

16

u/patternboy Mar 08 '23

I'm experienced with R but a relative novice with python. I've never done any programming without an IDE, but yesterday I was reminded of the limitations of IDEs quite painfully. I spent hours trying to solve a problem with a set of dictionaries not being populated properly using a set of nested for loops. I understand this is a relatively simple task for any professional developer/data person. I'd never done such a complicated set of nested loops before though, iterating through several different lists/dictionaries of different lengths to be consolidated (all originating from a powershell subprocess stdout string).

It turned out that a totally correct line was just indented one loop too deep and this was messing up the loops. Literally a backspace solved the whole thing. But the IDE didn't help any as there was nothing wrong with the syntax. I of course felt the excitement once it finally worked, but also felt frustrated and stupid, and retired to bed at 4am and had recurring dreams about solving problems with key:value pairs that I had already solved.

17

u/chaoticbean14 Mar 08 '23

Yeah, there may be some instances where the IDE doesn't alert you - but I would say for the vast majority of typical issues that catch developers up for hours (sometimes days) an IDE will generally be a huge help. Red squiggles, grey text, lots of visual queues of "something here isn't right" as well as lots of things in the problem pane.

I'm glad you got it solved! Staying up late is almost never worth it, for me personally. A good nights sleep is so helpful to me. Come back in the AM with some coffee and a clear head - I usually have a whole handful of things to try.

7

u/patternboy Mar 08 '23

My immediate thought is why are developers not using IDEs? I genuinely assumed everyone used them, especially in tech. I did a bioscience PhD and we rarely saw anyone use R itself - we opted for RStudio specifically because it was much easier to read and write code, install packages, etc., and helped with highlighting errors and displaying graphs quickly. I've never opened the python app - have always used either PyCharm or VSCode. I thought this was all standard stuff?

But yeah I agree about the sleep. I even started noticing my ability to solve these problems and think clearly just reach somewhat of a stone wall during the night itself. It comes on gradually but I keep catching more of myself zoning out and losing track. I've very rarely had the motivation to stay up so late learning/solving complex problems so have never experienced this gradual onset of fatigue so vividly. It's been a learning experience!

3

u/mandradon Mar 08 '23

Anyone not using an IDE for R deserves what they get! Rstudio is great for what it does. It smoothed the learning process out for me when I was in grad school that I never through of R as a language and just thought of it as a stats package with really poor UI tools.

I've seen people recommend using just the python terminal to learn, or IDLE, but I think those people are insane. I get doing things simple from the start, but text editors and ides exist for a reason.

Also, with Python, it's error messages can be less than helpful for novices, though. A missed closing parenthesis will often throw an error on the wrong line, depending on the version or LSP/linter that's being used. Tab mistakes can take a long time to track down if you don't know what you're looking for, too.

→ More replies (1)

5

u/dehin Mar 08 '23

The new Python 10 compiler I believe now checks for some logic errors as well, not just syntax ones. Although, I'm not sure if it would have caught your issue.

3

u/lordheart Mar 08 '23

If I start having to nest to many loops I’ll pull out the inner loop into a function, and repeat till it’s cleared up.

→ More replies (1)

2

u/Majestic-Giraffe7093 Mar 08 '23

The problem is the cases where it is not syntactically incorrect but the semantics are changed. I spent 6hrs of debugging only to find that my colleague had put a comma in a json object where there should have been a colon and it caused all sorts of weird behaviour.

→ More replies (14)

15

u/a_reply_to_a_post Mar 08 '23

these kids these days don't even use semicolons in javascript anymore

sick little bastards and their eslinting

→ More replies (5)

6

u/freerider Mar 08 '23

I spent 3 hours on a similar If clause:

a = 4;
if(a < 3);
{ 
     std::cout << "a is less than 4" << std:: endl;
}
→ More replies (1)

2

u/[deleted] Mar 08 '23

I just lost days because I failed to noticed a date range mask I was using was YY NOT YYYY so a csv wouldn’t download. Yay.

2

u/Blaz3 Mar 08 '23

How about calling the wrong method or not calling a method at all and digging through config after config trying to figure out why your debug point never gets hit

→ More replies (5)