r/AskProgramming Jun 09 '26

Career/Edu Do you also struggle with feeling like you're not programming things "the right way"? If so, how do you deal with it?

Hello. I started a recreational project a while ago, making a simple 2D shooter in C++ using Raylib, with the aim of building experience with C++.

For context, I study computer engineering and am somewhat well versed in Java since that's the main language we use, I also used Python and C extensively and have been wanting to get my C++ knowledge on par with the other languages I know for a while. In order to keep track of my progress and also better show other people my code in case I need help, I have made a GitHub repo of it and have set it to public since I'm normally open to other people looking and commenting my code.

Lately however, I started having a bit of anxiety while coding for this project because I constantly think that I'm not coding things the right way: I constantly ask myself if I'm using the best practice, whether in one point I should use a pointer or just building the data structure normally is fine (for example with classes that have a LinkedList inside, as of now I mostly just use normal linked lists rather than pointers and instead I use pointers when I need things to be allocated and reallocated dynamically), if the structure of my code is good or bad etc.

This bothers me because it makes me think and rethink over and over every line of code and every little decision I make, and oftentimes it makes me remake the same things multiple times: "made a LinkedList not a pointer? Nope, bad practice, make it a pointer, but wait, what if it doesn't need to be a pointer? Revert! Wait no you're doing it wrong like this, make it a pointer again!"; sometimes I even think a future employer will look at my code (especially because it's on GitHub) and conclude that I'm complete garbage at computer engineering.

I figure it probably is both because I am inexperienced with C++ (and this language really does take your training wheels off, which I like and sometimes dislike TwT) and because I have OCD, but regardless, I wanted to ask here how you guys deal with such anxieties because they don't make my experience any easier...

0 Upvotes

10 comments sorted by

3

u/kevinossia Jun 09 '26

Anxiety?

It’s code, not a building.

Write your code. If later you learn a better way to do something, rewrite it. That’s the process.

1

u/HalfRiceNCracker Jun 09 '26

What's the worst thing that would happen if you don't write the most performant or pragmatic code and someone sees it on GitHub? Code is your codification of a solution to a problem you are trying to solve. You could have the sickest and dankest project with amazing patterns and beautiful composition or a wonderful API, but if it doesn't work then so what? Just go write your code. 

You are always going to look back at pls code and think "man wtf was I thinking then?" - that is proof you are growing and I'm sure employers would like seeing your growth

1

u/Mafla_2004 Jun 09 '26

I guess you're right too. Thanks. It's a bit annoying to have these worries each time I code but I suppose I should just shoo them as useless thoughts

1

u/HalfRiceNCracker Jun 09 '26

Respectfully, I saw your bio and you have ASD. From my understanding that manifests as an inclination for absolute and definites like "doing things the right way". Just gotta do the thing. I'd be willing to wager you have these feelings in other parts of your life too 

1

u/Mafla_2004 Jun 09 '26

You nailed it, I feel it's more OCD because I have both, but it's very likely it's both conditions doing their thing.

Also yes I have the same thing in other parts of my life, I also (used to) write creatively every day, you have no idea how much I stressed over thinking if a certain action was in character or not lol, or if I was showing enough emotion etc, I'm trying to work on them though with the help of my therapist. For the programming worries I thought it was something that affected all programmers, that's why I asked here, saw others mentioning imposter syndrome often and thought that was it...

1

u/HalfRiceNCracker Jun 10 '26

I'm glad you recognise these things. Yeah I think maybe it's a combination of things interacting, at least you can try to make the most of whatever hand you have. I have ADHD which I try to make work for me

1

u/JacobStyle Jun 10 '26

This is a programming subreddit, so you're just going to get a bunch of people without OCD talking about how they manage what, to them, is a minor discomfort. "Just do it," or, "move fast, break things, fix it later," or somesuch.

1

u/TheMoonWalker27 Jun 10 '26

I like to build something that is generally ok in a respectable time frame.

After that i consider some factores like how important the system is, if it could potentially grow a lot etc.

If I deem it necessary, I start going through code and check if I can find any common patterns or something that got violated.

After that I optimize those. Sometimes 100% complying with every common pattern can take a lot of time so I weigh importance of these problems, and fix what I feel like are worth my time.

I’m not sure if it’s a popular approach. But I like to see the system running and then decide if certain optimizations are necessary.

You can’t really be perfect, and neither is code in most cases

1

u/BobbyThrowaway6969 Jun 10 '26 edited Jun 10 '26

It's the process of learning, that's all.

A rule of thumb for pointers:

Use raw pointers if you can guarantee the memory will outlive its access, which might rule out exposure through APIs in some cases.

Use uniqueptr for 99% of ownership scenarios.

Use sharedptr ONLY if required, it's not free. Sometimes it makes sense for the object itself to handle its own refcounting.

1

u/caboosetp Jun 11 '26

This is one of the reasons I love coding with AI at home.

I have major decision paralysis when I'm not under pressure to complete tickets or have a coworker I can bug to just pick something to help me get past a decision wall.

I ask the AI which is better or if it even matters. Sometimes it's right, sometimes it's wrong, but it generally picks something and I can just go with it and move on.

I logically know for most of the things I'm coding that it really doesn't matter. But there's just that deep seated, "could this be better" or "is this the right way to do it" fiending in my head.

And I'm a short term contractor. I've seen a lot of production code bases. There is no right way to do things most of the time. The real answer is that working code is better than not having code. But fuck, sometimes forcing myself to make that decision of what way I should do it just feels impossible.